MCPcopy
hub / github.com/MaartenGr/BERTopic / check_is_fitted

Function check_is_fitted

bertopic/_utils.py:65–80  ·  view source on GitHub ↗

Checks if the model was fitted by verifying the presence of self.matches. Arguments: topic_model: BERTopic instance for which the check is performed. Returns: None Raises: ValueError: If the matches were not found.

(topic_model)

Source from the content-addressed store, hash-verified

63
64
65def check_is_fitted(topic_model):
66 """Checks if the model was fitted by verifying the presence of self.matches.
67
68 Arguments:
69 topic_model: BERTopic instance for which the check is performed.
70
71 Returns:
72 None
73
74 Raises:
75 ValueError: If the matches were not found.
76 """
77 msg = "This %(name)s instance is not fitted yet. Call 'fit' with appropriate arguments before using this estimator."
78
79 if topic_model.topics_ is None:
80 raise ValueError(msg % {"name": type(topic_model).__name__})
81
82
83class NotInstalled:

Callers 15

transformMethod · 0.90
topics_over_timeMethod · 0.90
update_topicsMethod · 0.90
get_topicsMethod · 0.90
get_topicMethod · 0.90
get_topic_infoMethod · 0.90
get_topic_freqMethod · 0.90
merge_topicsMethod · 0.90
delete_topicsMethod · 0.90
reduce_topicsMethod · 0.90
visualize_topicsMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected