Umap crashing if dataset smaller than numneighbours

Hi!

I’ve been having issues with umap hard crashing this patch when the dataset is smaller than the numneighbours I have defined. Sometimes it will be kind and will throw an error, but most time it will hard crash with no crash report. In the attached patch I switched to using pca for dimension reduction and it will not crash and only error. Since I don’t get a crash report, I was wondering if someone else could try and see if they can recreate a similar issue. Pushing the threshold of bufnoveltyslice closer and closer to 1 will eventually will create a dataset smaller than umap’s numneighbours (5).

max 8.2.2 arm64
tb2.beta6+


----------begin_max5_patcher----------
6994.3oc6c08iiiib+4Y+qPwXe3xs83vheyKuLI2gCHOEfDDfDrYw.01p616
Xa4HIO6L6gq+aOjhxtsrnUSIQI6Y2dVrc2Vl1h0OUr9hEq5u8cua18oeIIeV
zeJ5Gid269ae26dW4kLW3cUu9cy1D+kEqiyKG1rEoa1jrsX1c12qH4KEkWu3
orj7mhhW9y6yO9ta2uY010IEkeTn5h6hKV7zpsO9wrjEE1as.f4r6hjj4n6h
DRyOwn4nne5kumz8EG9hPUWc0xx6b58+76UxYlq82+tuy7i6FHs7Gyi2rKOZ
Q75E6WGWjrLJtHhJ+TWIKfivFZgSYyo.gyPL.yULBfuKBXntSmxdQmqW84j4
KWEu9.A743rswaRp+l+H7Sc94FojF..Mmw.NGywDoDiUz6hnf4snxKRd3pqZ
uTwW2kX+RmM6tnYOrNMVeS9olPfPN63DJSSDEIYeLYa78qSNcxlG+4jkeLtn
Ha086KRd4uxqvoJfxfEq2mj9vgKe35m90uNc6isgW0F7FMzWNSlib7t4OklU
3820APw02z9sqJxK9ZEYae+R9hC+pOLIOFuZ6yWjKo16ViGA2xh.EdNPQDFC
wwTIUHEZNFDvNvdneEgeQtDV0U0yS8Wc71sIqWjteawoKPZvAkuR+7ZsgO5k
+5Etp6LjS9E3tv2.bWmhyN4s3N4s1nefXd22KP9x6cw6j2bdzgy4sM4WzPeC
ovKiW7bDDg6LCmTNm2fgCJAkHVIaGF2EgtD0rvQUYQ3+hUW4+9+4e1IogtLo
Qon4RfIjTEA.IVxAihD9b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NFBHGDtK
Dp4.GJg62S7fjQtfO56gPXYA3iuX3ld8YOE1w6184jr7pQWdSlsI9msOrk2U
9xUasur7LgOKK4yqNLd6UhyV7zphjElF7osvAvsct0YaR0qT2teUkLpxx+4r
xybu4jvmuK1RIkGM+u6u+c++.e71HNA
-----------end_max5_patcher-----------

Hi @nodz and many thanks for the report,

There’s a github issue for this from last month but I evidently needed a reminder to do something about it!

2 Likes