MaartenGr / MaartenGr/BERTopic
Improve Cluster Rand Score in BERTopic
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.8k
- Forks
- 920
- Avg merge
- 22h 24m
- Merged PRs (30d)
- 5
Description
**Hi Maarten!** Thank You for this awesome library that makes topic modelling to much easy. I am really impress to this library and show best library compare to other topic modelling technique. My focus is on evaluation metrics (Cluster Rand Index). My Documents consist of five categories. Each document assign to one category. Details of Documents and categories are:
1. Business->198
2. Entertainment->210
3. Sports->200
4. Health->200
5. Weird->200
Because of my focus to improve rand score. I select K-means clustering with n_clusters=5 over HDBSCAN to avoid the creation of outliers. After conducting experiment, I have obtained the following counts for each topic or cluster:

**Here's my code**
```python
from sentence_transformers import SentenceTransformer
model = SentenceTransformer('sentence-transformers/paraphrase-multilingual-mpnet-base-v2')
embeddings = model.encode(documents, show_progress_bar=True)
print(embeddings)
from bertopic.vectorizers import ClassTfidfTransformer
ctfidf_model = ClassTfidfTransformer(bm25_weighting=True, reduce_frequent_words=True)
from umap import UMAP
dim_model = UMAP(n_neighbors=100,
n_components=50,
min_dist=0.3,
metric='cosine',
random_state=42)
from sklearn.cluster import KMeans
cluster_model = KMeans(n_clusters=5)
topic_model = BERTopic(language="urdu", low_memory=True ,calculate_probabilities=True, vectorizer_model=vectorizer_model,seed_topic_list=seed_topic_list, top_n_words=10, hdbscan_model=cluster_model, umap_model=dim_model,ctfidf_model=ctfidf_model,verbose=True)
topics, probs = topic_model.fit_transform(documents, embeddings)
```
I tried different clustering techniques and UMAP parameters. I wanna improve clustering technique for rand score. May be its stupid question but I’m beginner and wanna learn more .Any suggestion please. Thank you Again
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the provided topic_model.fit_transform(...) example and reproduce the experiment with the five labeled document categories, KMeans, and UMAP settings shown. Compare the resulting cluster assignments with the category labels and evaluate whether a clustering or dimensionality-reduction change improves the Rand score.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, scikit-learn
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 15/100