GithubHelp home page GithubHelp logo

Comments (2)

EssbieWGT avatar EssbieWGT commented on August 22, 2024

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.

ernests avatar ernests commented on August 22, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.