Components by Term FrameΒΆ

Example

>>> from sklearn.decomposition import LatentDirichletAllocation
>>> lda = LatentDirichletAllocation(
...     n_components=10,
...     learning_decay=0.7,
...     learning_offset=50.0,
...     max_iter=10,
...     batch_size=128,
...     evaluate_every=-1,
...     perp_tol=0.1,
...     mean_change_tol=0.001,
...     max_doc_update_iter=100,
...     random_state=0,
... )
>>> from techminer2.packages.topic_modeling.user import ComponentsByTermDataFrame
>>> (
...     ComponentsByTermDataFrame()
...     #
...     # FIELD:
...     .with_field("raw_descriptors")
...     .having_terms_in_top(50)
...     .having_terms_ordered_by("OCC")
...     .having_term_occurrences_between(None, None)
...     .having_term_citations_between(None, None)
...     .having_terms_in(None)
...     #
...     # DECOMPOSITION:
...     .using_decomposition_algorithm(lda)
...     .using_top_terms_by_theme(5)
...     #
...     # TFIDF:
...     .using_binary_term_frequencies(False)
...     .using_row_normalization(None)
...     .using_idf_reweighting(False)
...     .using_idf_weights_smoothing(False)
...     .using_sublinear_tf_scaling(False)
...     #
...     # DATABASE:
...     .where_root_directory_is("example/")
...     .where_database_is("main")
...     .where_record_years_range_is(None, None)
...     .where_record_citations_range_is(None, None)
...     .where_records_match(None)
...     #
...     .run()
... )
term       FINTECH 44:6942  ...  INVESTMENTS 03:0817
component                   ...
0                 7.492976  ...             0.100000
1                 5.100146  ...             0.100000
2                 2.099681  ...             1.100013
3                 4.893286  ...             0.100000
4                 2.099977  ...             0.100000
5                 4.489270  ...             1.099997
6                 5.402035  ...             0.100000
7                 6.222609  ...             0.100000
8                 0.100000  ...             0.100000
9                 7.100019  ...             1.099990

[10 rows x 50 columns]