File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -181,7 +181,6 @@ def __init__(
181181 self .feature_importance = feature_importance
182182 self .n_reduce_to = n_reduce_to
183183 self .reduction_method = reduction_method
184- self .components_ = None
185184
186185 def _merge_agglomerative (self , n_reduce_to : int ) -> np .ndarray :
187186 n_topics = self .components_ .shape [0 ]
@@ -328,7 +327,7 @@ def fit_transform_dynamic(
328327 if embeddings is None :
329328 embeddings = self .encoder_ .encode (raw_documents )
330329 for i_timebin in np .arange (len (self .time_bin_edges ) - 1 ):
331- if self . components_ is not None :
330+ if hasattr ( self , 'components_' ) :
332331 doc_topic_matrix = label_binarize (
333332 self .labels_ , classes = self .classes_
334333 )
Original file line number Diff line number Diff line change @@ -101,7 +101,6 @@ def __init__(
101101 self .gmm_ = make_pipeline (dimensionality_reduction , mixture )
102102 else :
103103 self .gmm_ = mixture
104- self .components_ = None
105104
106105 def fit_transform (
107106 self , raw_documents , y = None , embeddings : Optional [np .ndarray ] = None
@@ -163,7 +162,7 @@ def fit_transform_dynamic(
163162 bins : Union [int , list [datetime ]] = 10 ,
164163 ):
165164 time_labels , self .time_bin_edges = bin_timestamps (timestamps , bins )
166- if self . components_ is not None :
165+ if hasattr ( self , 'components_' ) :
167166 doc_topic_matrix = self .transform (
168167 raw_documents , embeddings = embeddings
169168 )
You can’t perform that action at this time.
0 commit comments