File tree 1 file changed +21
-0
lines changed
1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -542,3 +542,24 @@ def test_index_offset():
542
542
# Make sure translating between 1D and N-D indices are preserved
543
543
assert_equal (_barnes_hut_tsne .test_index2offset (), 1 )
544
544
assert_equal (_barnes_hut_tsne .test_index_offset (), 1 )
545
+
546
+
547
+ def test_n_iter_without_progress ():
548
+ # Make sure that the parameter n_iter_without_progress is used correctly
549
+ random_state = check_random_state (0 )
550
+ X = random_state .randn (100 , 2 )
551
+ tsne = TSNE (n_iter_without_progress = 2 , verbose = 2 ,
552
+ random_state = 0 , method = 'exact' )
553
+
554
+ old_stdout = sys .stdout
555
+ sys .stdout = StringIO ()
556
+ try :
557
+ tsne .fit_transform (X )
558
+ finally :
559
+ out = sys .stdout .getvalue ()
560
+ sys .stdout .close ()
561
+ sys .stdout = old_stdout
562
+
563
+ # The output needs to contain the value of n_iter_without_progress
564
+ assert ("did not make any progress during the "
565
+ "last 2 episodes. Finished." in out )
You can’t perform that action at this time.
0 commit comments