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)
| 63 | |
| 64 | |
| 65 | def 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 | |
| 83 | class NotInstalled: |
no outgoing calls
no test coverage detected