def test_nmf_clustering_with_tweets(self): from_date = datetime.datetime(2011, 1, 23, 0, 0, 0) to_date = datetime.datetime(2011, 1, 27, 0, 0, 0) items = ws.get_documents_by_date(from_date, to_date, limit=500) nmfc = NMFClusterer(ngram=1) nmfc.add_documents(items) nmfc.run(seed = 'random_vcol', method='nmf', rank=30, max_iter=65, display_N_tokens = 6, display_N_documents =10) nmfc.dump_clusters_to_file("nmf_with_tweets") nmfc.plot_growth_timeline(cumulative=True)
def test_nmf_clustering_with_tweets(self): from_date = datetime.datetime(2011, 1, 23, 0, 0, 0) to_date = datetime.datetime(2011, 1, 27, 0, 0, 0) items = ws.get_documents_by_date(from_date, to_date, limit=500) nmfc = NMFClusterer(ngram=1) nmfc.add_documents(items) nmfc.run(seed="random_vcol", method="nmf", rank=30, max_iter=65, display_N_tokens=6, display_N_documents=10) nmfc.dump_clusters_to_file("nmf_with_tweets") nmfc.plot_growth_timeline(cumulative=True)
''' Created on 26 Jan 2012 @author: george ''' import unittest, numpy from analysis.clustering.nmf import NMFClusterer from tests.test_document import get_test_documents expected, sample_docs_raw, samples = get_test_documents() nmfc = NMFClusterer(ngram=1) nmfc.add_documents(samples) class Test(unittest.TestCase): def test_nmf_cluster(self): nmfc.run(seed='random_vcol', method='nmf', rank=2, max_iter=65, display_N_tokens=6, display_N_documents=3) nmfc.dump_clusters_to_file("nmf_with_samples") if __name__ == "__main__": unittest.main()
''' Created on 26 Jan 2012 @author: george ''' import unittest, numpy from analysis.clustering.nmf import NMFClusterer from tests.test_document import get_test_documents expected, sample_docs_raw, samples = get_test_documents() nmfc = NMFClusterer(ngram=1) nmfc.add_documents(samples) class Test(unittest.TestCase): def test_nmf_cluster(self): nmfc.run(seed = 'random_vcol', method='nmf', rank=2, max_iter=65, display_N_tokens = 6, display_N_documents =3) nmfc.dump_clusters_to_file("nmf_with_samples") if __name__ == "__main__": unittest.main()