Download BERTopic/bertopic/dimensionality/_base.py from kisejin/TopicModelingRepo: direct link, hf CLI and curl.
- Browser
- Download file 645 Bytes
-
https://huggingface.co/kisejin/TopicModelingRepo/resolve/5ecdc19ebac471cb51415c4e2fa755d81931c0ee/BERTopic/bertopic/dimensionality/_base.py
- Command line
-
hf download hf://kisejin/TopicModelingRepo@5ecdc19ebac471cb51415c4e2fa755d81931c0ee/BERTopic/bertopic/dimensionality/_base.py
-
curl -L -o _base.py https://huggingface.co/kisejin/TopicModelingRepo/resolve/5ecdc19ebac471cb51415c4e2fa755d81931c0ee/BERTopic/bertopic/dimensionality/_base.py
645 Bytes
| import numpy as np | |
| class BaseDimensionalityReduction: | |
| """ The Base Dimensionality Reduction class | |
| You can use this to skip over the dimensionality reduction step in BERTopic. | |
| Examples: | |
| This will skip over the reduction step in BERTopic: | |
| ```python | |
| from bertopic import BERTopic | |
| from bertopic.dimensionality import BaseDimensionalityReduction | |
| empty_reduction_model = BaseDimensionalityReduction() | |
| topic_model = BERTopic(umap_model=empty_reduction_model) | |
| ``` | |
| """ | |
| def fit(self, X: np.ndarray = None): | |
| return self | |
| def transform(self, X: np.ndarray) -> np.ndarray: | |
| return X | |