Coder Social home page Coder Social logo

dtmvisual's People

Contributors

gsukr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

yangyijane

dtmvisual's Issues

visualizing topics

Dear GSukr,
I use your very good code to visualize time varying topics. I can see the changes in the top 10 words of each topic without any problems in figures. But this is not the case with the topics. Would you please kindly help me in this regard? The relevant code is as below:

import pandas

result = pandas.read_csv('../sample-data/sample1.csv', encoding='utf_8')
news_abstract = result['newsAbstract']
news_text_normal = result['textField_normal']
news_time = result['time_jalali']

import dtmvisual

time_seq = [100,150,150,100]
dtm_path = 'C:/Downloads/dtm-win64.exe'

from dtmvisual.gensim_corpus import docs_to_list, corpus_dtm
sentences = docs_to_list(news_abstract)
corpus = corpus_dtm(sentences)

from dtmvisual.DTMmodel import dtm_model
model = dtm_model(dtm_path, corpus, time_seq, num_topics=8,
id2word=corpus.dictionary, alpha=0.01)

number_of_timespans = 4
number_of_topics = 8

from dtmvisual import visualize_words
df = visualize_words.DF(number_of_timespans, number_of_topics, model)
d = visualize_words.partitioning(df)
visualize_words.visualize_words(df, d)

#--------Topics evolution------
from dtmvisual import VisualizeTopics
df = VisualizeTopics.topic_distribution(number_of_topics, model, time_seq)
VisualizeTopics.visualize_topics(df)
'''
#Moreover, you save and then download your DTM model using:
dtmvisual.save_model(model, output_path, output_name)
model = dtmvisual.load_saved_model(output_path, output_name)
#To print the words for a timeslice for a topic use:
'''
from dtmvisual import DTMmodel
DTMmodel.print_all_topics(model, topicid = 7, time = 4, num_words=10)

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.