diff --git a/src/test/java/org/mastodon/mamut/feature/dimensionalityreduction/umap/UmapSmileDemo.java b/src/test/java/org/mastodon/mamut/feature/dimensionalityreduction/umap/UmapSmileDemo.java index 407027475..93e7aca7c 100644 --- a/src/test/java/org/mastodon/mamut/feature/dimensionalityreduction/umap/UmapSmileDemo.java +++ b/src/test/java/org/mastodon/mamut/feature/dimensionalityreduction/umap/UmapSmileDemo.java @@ -10,6 +10,7 @@ public class UmapSmileDemo { + /* public static void main( final String[] args ) { int numCluster1 = 50; @@ -19,7 +20,7 @@ public static void main( final String[] args ) double[][] result = Arrays.stream( umapResult ).map( row -> Arrays.stream( row ).toArray() ).toArray( double[][]::new ); PlotPoints.plot( sampleData, result, resultValues -> resultValues[ 0 ] > 1 ); } - + static double[][] setUpUmap( final double[][] sampleData ) { int iterations = sampleData.length < 10_000 ? 500 : 200; // https://github.com/lmcinnes/umap/blob/a012b9d8751d98b94935ca21f278a54b3c3e1b7f/umap/umap_.py#L1073 @@ -27,4 +28,6 @@ static double[][] setUpUmap( final double[][] sampleData ) int nNeighbors = 15; return UMAP.of( sampleData, MathEx::distance, nNeighbors, 2, iterations, 1, minDist, 1.0, 5, 1 ); } + + */ } diff --git a/src/test/java/org/mastodon/mamut/feature/dimensionalityreduction/umap/UmapSmileDemoIris.java b/src/test/java/org/mastodon/mamut/feature/dimensionalityreduction/umap/UmapSmileDemoIris.java index 64d5edb1c..e5b0bd7cd 100644 --- a/src/test/java/org/mastodon/mamut/feature/dimensionalityreduction/umap/UmapSmileDemoIris.java +++ b/src/test/java/org/mastodon/mamut/feature/dimensionalityreduction/umap/UmapSmileDemoIris.java @@ -26,6 +26,7 @@ public class UmapSmileDemoIris private static final Logger logger = LoggerFactory.getLogger( MethodHandles.lookup().lookupClass() ); + /* public static void main( String[] args ) throws IOException, CsvValidationException { File file = new File( "src/test/resources/org/mastodon/mamut/feature/dimensionalityreduction/iris.tsv" ); @@ -47,13 +48,13 @@ public static void main( String[] args ) throws IOException, CsvValidationExcept long t0 = System.currentTimeMillis(); double[][] result = setUpUmap( inputData ); logger.info( "UMAP took {} ms", System.currentTimeMillis() - t0 ); - + result = Arrays.stream( result ).map( row -> Arrays.stream( row ).map( value -> value * 10d ).toArray() ) // scale up .toArray( double[][]::new ); PlotPoints.plot( null, result, null ); } } - + static double[][] setUpUmap( double[][] data ) { int iterations = data.length < 10_000 ? 500 : 200; // https://github.com/lmcinnes/umap/blob/a012b9d8751d98b94935ca21f278a54b3c3e1b7f/umap/umap_.py#L1073 @@ -61,4 +62,6 @@ static double[][] setUpUmap( double[][] data ) int nNeighbors = 15; return UMAP.of( data, MathEx::distance, nNeighbors, 2, iterations, 1, minDist, 1.0, 5, 1 ); } + + */ } diff --git a/src/test/java/org/mastodon/mamut/feature/dimensionalityreduction/umap/UmapSmileDemoTgmmMini.java b/src/test/java/org/mastodon/mamut/feature/dimensionalityreduction/umap/UmapSmileDemoTgmmMini.java index 7fa201f4a..264a2b7bb 100644 --- a/src/test/java/org/mastodon/mamut/feature/dimensionalityreduction/umap/UmapSmileDemoTgmmMini.java +++ b/src/test/java/org/mastodon/mamut/feature/dimensionalityreduction/umap/UmapSmileDemoTgmmMini.java @@ -26,6 +26,7 @@ public class UmapSmileDemoTgmmMini private static final Logger logger = LoggerFactory.getLogger( MethodHandles.lookup().lookupClass() ); + /* public static void main( String[] args ) throws IOException, CsvValidationException { File file = new File( "src/test/resources/org/mastodon/mamut/feature/dimensionalityreduction/tgmm-mini-spot.csv" ); @@ -47,13 +48,13 @@ public static void main( String[] args ) throws IOException, CsvValidationExcept long t0 = System.currentTimeMillis(); double[][] result = setUpUmap( inputData ); logger.info( "UMAP took {} ms", System.currentTimeMillis() - t0 ); - + double[][] resultScaled = Arrays.stream( result ).map( row -> Arrays.stream( row ).map( value -> value * 10d ).toArray() ) .toArray( double[][]::new ); PlotPoints.plot( null, resultScaled, null ); } } - + static double[][] setUpUmap( double[][] data ) { int iterations = data.length < 10_000 ? 500 : 200; // https://github.com/lmcinnes/umap/blob/a012b9d8751d98b94935ca21f278a54b3c3e1b7f/umap/umap_.py#L1073 @@ -61,4 +62,6 @@ static double[][] setUpUmap( double[][] data ) int nNeighbors = 15; return UMAP.of( data, MathEx::distance, nNeighbors, 2, iterations, 1, minDist, 1.0, 5, 1 ); } + + */ } diff --git a/src/test/java/org/mastodon/mamut/feature/dimensionalityreduction/umap/UmapSmileTest.java b/src/test/java/org/mastodon/mamut/feature/dimensionalityreduction/umap/UmapSmileTest.java index ec7337b21..3fcf5f191 100644 --- a/src/test/java/org/mastodon/mamut/feature/dimensionalityreduction/umap/UmapSmileTest.java +++ b/src/test/java/org/mastodon/mamut/feature/dimensionalityreduction/umap/UmapSmileTest.java @@ -19,6 +19,7 @@ class UmapSmileTest { private static final Logger logger = LoggerFactory.getLogger( MethodHandles.lookup().lookupClass() ); + /* @Test void test() { @@ -26,7 +27,7 @@ void test() int numCluster2 = 100; // create two distinct clusters of points in 3D space, one having 50 points and the other 100 points double[][] sampleData = RandomDataTools.generateSampleData( numCluster1, numCluster2 ); - + // Recommendations for UMAP defaults: https://github.com/lmcinnes/umap/blob/a012b9d8751d98b94935ca21f278a54b3c3e1b7f/umap/umap_.py#L1073 int iterations = sampleData.length < 10_000 ? 500 : 200; double minDist = 0.1; @@ -34,13 +35,15 @@ void test() long t0 = System.currentTimeMillis(); double[][] umapResult = UMAP.of( sampleData, MathEx::distance, nNeighbors, 2, iterations, 1, minDist, 1.0, 5, 1 ); logger.info( "UMAP took {} ms", System.currentTimeMillis() - t0 ); - + assertEquals( 2, umapResult[ 0 ].length ); assertEquals( umapResult.length, sampleData.length ); // fails, because only the largest connected component is used inside the algorithm - + double[][] umapResult1 = Arrays.copyOfRange( umapResult, 0, numCluster1 ); double[][] umapResult2 = Arrays.copyOfRange( umapResult, numCluster1, numCluster1 + numCluster2 ); - + DimensionalityReductionTestUtils.testNonOverlappingClusters( umapResult1, umapResult2 ); // should pass } + + */ }