@@ -1795,18 +1795,26 @@ def _validate_parameters(self):
17951795 if self .n_components < 1 :
17961796 raise ValueError ("n_components must be greater than 0" )
17971797 self .n_epochs_list = None
1798- if isinstance (self .n_epochs , list ) or isinstance (self .n_epochs , tuple ) or \
1799- isinstance (self .n_epochs , np .ndarray ):
1800- if not issubclass (np .array (self .n_epochs ).dtype .type , np .integer ) or \
1801- not np .all (np .array (self .n_epochs ) >= 0 ):
1802- raise ValueError ("n_epochs must be a nonnegative integer "
1803- "or a list of nonnegative integers" )
1798+ if (
1799+ isinstance (self .n_epochs , list )
1800+ or isinstance (self .n_epochs , tuple )
1801+ or isinstance (self .n_epochs , np .ndarray )
1802+ ):
1803+ if not issubclass (
1804+ np .array (self .n_epochs ).dtype .type , np .integer
1805+ ) or not np .all (np .array (self .n_epochs ) >= 0 ):
1806+ raise ValueError (
1807+ "n_epochs must be a nonnegative integer "
1808+ "or a list of nonnegative integers"
1809+ )
18041810 self .n_epochs_list = list (self .n_epochs )
18051811 elif self .n_epochs is not None and (
1806- self .n_epochs < 0 or not isinstance (self .n_epochs , int )
1812+ self .n_epochs < 0 or not isinstance (self .n_epochs , int )
18071813 ):
1808- raise ValueError ("n_epochs must be a nonnegative integer "
1809- "or a list of nonnegative integers" )
1814+ raise ValueError (
1815+ "n_epochs must be a nonnegative integer "
1816+ "or a list of nonnegative integers"
1817+ )
18101818 if self .metric_kwds is None :
18111819 self ._metric_kwds = {}
18121820 else :
@@ -2765,7 +2773,9 @@ def fit(self, X, y=None):
27652773 print (ts (), "Construct embedding" )
27662774
27672775 if self .transform_mode == "embedding" :
2768- epochs = self .n_epochs_list if self .n_epochs_list is not None else self .n_epochs
2776+ epochs = (
2777+ self .n_epochs_list if self .n_epochs_list is not None else self .n_epochs
2778+ )
27692779 self .embedding_ , aux_data = self ._fit_embed_data (
27702780 self ._raw_data [index ],
27712781 epochs ,
@@ -2775,11 +2785,15 @@ def fit(self, X, y=None):
27752785
27762786 if self .n_epochs_list is not None :
27772787 if "embedding_list" not in aux_data :
2778- raise KeyError ("No list of embedding were found in 'aux_data'. "
2779- "It is likely the layout optimization function "
2780- "doesn't support the list of int for 'n_epochs'." )
2788+ raise KeyError (
2789+ "No list of embedding were found in 'aux_data'. "
2790+ "It is likely the layout optimization function "
2791+ "doesn't support the list of int for 'n_epochs'."
2792+ )
27812793 else :
2782- self .embedding_list_ = [e [inverse ] for e in aux_data ["embedding_list" ]]
2794+ self .embedding_list_ = [
2795+ e [inverse ] for e in aux_data ["embedding_list" ]
2796+ ]
27832797
27842798 # Assign any points that are fully disconnected from our manifold(s) to have embedding
27852799 # coordinates of np.nan. These will be filtered by our plotting functions automatically.
0 commit comments