Skip to content

Commit

Permalink
Merge pull request #202 from seanzhangkx8/dependency-package-update
Browse files Browse the repository at this point in the history
Dependency Packages Upgrade
  • Loading branch information
seanzhangkx8 authored Nov 1, 2023
2 parents c63c970 + c219fc0 commit c5b2bd7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions convokit/bag_of_words/bow_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def transform(

matrix = self.vectorizer.transform(docs)
try:
column_names = self.vectorizer.get_feature_names()
column_names = self.vectorizer.get_feature_names_out()
except AttributeError:
column_names = np.arange(matrix.shape[1])
corpus.set_vector_matrix(self.vector_name, matrix=matrix, ids=ids, columns=column_names)
Expand Down Expand Up @@ -134,4 +134,4 @@ def get_vocabulary(self):
"""
Get the vocabulary of the vectorizer object
"""
return self.vectorizer.get_feature_names()
return self.vectorizer.get_feature_names_out()
8 changes: 4 additions & 4 deletions convokit/expected_context_framework/col_normed_tfidf.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def transform(self, corpus, selector=lambda x: True):
docs.append(self.text_func(ut))
ut.add_vector(self.output_field)
vects = self.tfidf_obj.transform(docs)
column_names = self.tfidf_obj.get_feature_names()
column_names = self.tfidf_obj.get_feature_names_out()
corpus.set_vector_matrix(self.output_field, matrix=vects, ids=ids, columns=column_names)
n_feats = np.array((vects > 0).sum(axis=1)).flatten()
for id, n in zip(ids, n_feats):
Expand Down Expand Up @@ -93,7 +93,7 @@ def get_vocabulary(self):
"""
:return: array of feature names
"""
return self.tfidf_obj.get_feature_names()
return self.tfidf_obj.get_feature_names_out()

def load(self, dirname):
"""
Expand Down Expand Up @@ -140,8 +140,8 @@ def fit_transform(self, X, y=None):
self.fit(X, y)
return self.transform(X)

def get_feature_names(self):
return self.tfidf_model.get_feature_names()
def get_feature_names_out(self):
return self.tfidf_model.get_feature_names_out()

def get_params(self, deep=True):
return self.tfidf_model.get_params(deep=deep)
Expand Down
4 changes: 2 additions & 2 deletions convokit/prompt_types/promptTypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,12 +709,12 @@ def fit_prompt_type_model(model, n_types, random_state=None, max_dist=0.9, verbo
reference_clusters[reference_dists.min(axis=1) >= max_dist] = -1

prompt_df = pd.DataFrame(
index=model["prompt_tfidf_model"].get_feature_names(),
index=model["prompt_tfidf_model"].get_feature_names_out(),
data=np.hstack([prompt_dists, prompt_clusters[:, np.newaxis]]),
columns=list(range(n_types)) + ["type_id"],
)
reference_df = pd.DataFrame(
index=model["reference_tfidf_model"].get_feature_names(),
index=model["reference_tfidf_model"].get_feature_names_out(),
data=np.hstack([reference_dists, reference_clusters[:, np.newaxis]]),
columns=list(range(n_types)) + ["type_id"],
)
Expand Down

0 comments on commit c5b2bd7

Please sign in to comment.