Comments (2)
Circling back on this. While it negatively affects the visualization of the model by packing the clusters more tightly together, I found that making the following two changes solved the problem.
First, change the utils.py per this. Next make the following update to the workaround code:
matrix = []
for cluster in mgp.cluster_word_distribution:
total = sum([occurance for word, occurance in cluster.items()])
assert not math.isnan(total)
# assert total > 0
if total == 0:
row = [(1 / len(vocabulary))] * len(vocabulary)
else:
row = [cluster.get(term, 1) / total for term in vocabulary] # <--- updated from 0 to 1
for f in row:
assert not isinstance(f, complex)
matrix.append(row)
return matrix, doc_topic_dists2, doc_lengths, vocabulary, term_counts
These two steps got the visualization working for me just fine! Will close this one out.
from gsdmm.
Coming back to this!
I fixed this by adding mds='mmds'
as a parameter to prepare_visualization_data
function.
As I understand, it is different dimension reduction algorithm and works if scikit is installed(https://github.com/bmabey/pyLDAvis/blob/master/pyLDAvis/_prepare.py#L337).
Solution from here - `bmabey/pyLDAvis#69 (comment)
from gsdmm.
Related Issues (13)
- Is possible return the cluster without k? HOT 1
- IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices HOT 2
- Saving gsdmm model HOT 3
- Clarification on Output Meaning
- Unexpected argument for the fit method.
- how to use this repo for clustering some short text? HOT 1
- Slow clustering for large number of data HOT 1
- topic_allocation; visualisation not found HOT 11
- Missing Packages
- Score function assigns wrong topic to texts HOT 1
- A way to init sentence embedding for unsupervised text clustering, better than glove wordvec?
- Predict new documents HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gsdmm.