Skip to content

Commit

Permalink
Fixed issues with default vectorizer
Browse files Browse the repository at this point in the history
  • Loading branch information
x-tabdeveloping committed Feb 1, 2024
1 parent 091533c commit 652a933
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion turftopic/models/decomp.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def __init__(
else:
self.encoder_ = encoder
if vectorizer is None:
self.vectorizer = default_vectorizer
self.vectorizer = default_vectorizer()
else:
self.vectorizer = vectorizer
self.objective = objective
Expand Down
7 changes: 3 additions & 4 deletions turftopic/models/gmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,19 @@ def __init__(
Encoder, str
] = "sentence-transformers/all-MiniLM-L6-v2",
vectorizer: Optional[CountVectorizer] = None,
weight_prior: Literal[
"dirichlet", "dirichlet_process", None
] = "dirichlet",
weight_prior: Literal["dirichlet", "dirichlet_process", None] = None,
gamma: Optional[float] = None,
):
self.n_components = n_components
self.encoder = encoder
self.weight_prior = weight_prior
self.gamma = gamma
if isinstance(encoder, str):
self.encoder_ = SentenceTransformer(encoder)
else:
self.encoder_ = encoder
if vectorizer is None:
self.vectorizer = default_vectorizer
self.vectorizer = default_vectorizer()
else:
self.vectorizer = vectorizer
if self.weight_prior is not None:
Expand Down
2 changes: 1 addition & 1 deletion turftopic/models/keynmf.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def __init__(
else:
self.encoder_ = encoder
if vectorizer is None:
self.vectorizer = default_vectorizer
self.vectorizer = default_vectorizer()
else:
self.vectorizer = vectorizer
self.dict_vectorizer_ = DictVectorizer()
Expand Down

0 comments on commit 652a933

Please sign in to comment.