Git Product home page Git Product logo

hamedr96 / antm Goto Github PK

View Code? Open in Web Editor NEW
26.0 26.0 6.0 32.33 MB

Aligned Neural Topic Model (ANTM) for Exploring Evolving Topics: a dynamic neural topic model that uses document embeddings (data2vec) to compute clusters of semantically similar documents at different periods, and aligns document clusters to represent topic evolution.

License: MIT License

Jupyter Notebook 99.26% Python 0.74%
dynamic-topic-modeling neural-topic-models

antm's People

Contributors

allaa-boutaleb avatar hamedr96 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  avatar  avatar

Watchers

 avatar  avatar

antm's Issues

Questions about running the ANTM model example

Sorry to bother you, I encountered the following problem when running the ANTM model example. How can I solve it? Thank you very much.

Aligned Dimension Reduction is initialized...
Traceback (most recent call last):
File "D:\TopicModel\ANTM-main\ExampleDemo\123.py", line 17, in
topics_per_period=model.fit(save=True)
^^^^^^^^^^^^^^^^^^^^
File "D:\TopicModel\ANTM-main\antm\main.py", line 85, in fit
self.umap_embeddings_clustering, self.umap_embeddings_visulization = aligned_umap(
^^^^^^^^^^^^^
File "D:\TopicModel\ANTM-main\antm\aligned_clustering_layer.py", line 11, in aligned_umap
model_umap_clustering = umap.aligned_umap.AlignedUMAP(
^^^^^^^^^^^^^^^^^
AttributeError: module 'umap' has no attribute 'aligned_umap'

Process finished with exit code 1

I can not run the example code in Colab

I try to run code in colab but I got some issue like this:

contextual document embedding is initiated...
Pandas Apply: 100%
2000/2000 [23:34<00:00, 1.27it/s]
Token indices sequence length is longer than the specified maximum sequence length for this model (549 > 512). Running this sequence through the model will result in indexing errors
Summarizing a document with BART due to its Large length for Embedding...
Summarizing a document with BART due to its Large length for Embedding...
Summarizing a document with BART due to its Large length for Embedding...
Summarizing a document with BART due to its Large length for Embedding...
Sliding Window Segmentation is initialized...
Aligned Dimension Reduction is initialized...
Sequential Document-cluster association is initialized...
Cluster Alignment Procedure is initialized...
---------------------------------------------------------------------------
LookupError                               Traceback (most recent call last)
[<ipython-input-5-675c8f899d3c>](https://localhost:8080/#) in <cell line: 2>()
      1 #learn the model and save it
----> 2 topics_per_period=model.fit(save=True)
      3 #output is a list of timeframes including all the topics associated with that period

8 frames
[/usr/local/lib/python3.10/dist-packages/nltk/data.py](https://localhost:8080/#) in find(resource_name, paths)
    581     sep = "*" * 70
    582     resource_not_found = f"\n{sep}\n{msg}\n{sep}\n"
--> 583     raise LookupError(resource_not_found)
    584 
    585 

LookupError: 
**********************************************************************
  Resource punkt not found.
  Please use the NLTK Downloader to obtain the resource:

  >>> import nltk
  >>> nltk.download('punkt')
  
  For more information see: https://www.nltk.org/data.html

  Attempted to load tokenizers/punkt/PY3/english.pickle

  Searched in:
    - '/root/nltk_data'
    - '/usr/nltk_data'
    - '/usr/share/nltk_data'
    - '/usr/lib/nltk_data'
    - '/usr/share/nltk_data'
    - '/usr/local/share/nltk_data'
    - '/usr/lib/nltk_data'
    - '/usr/local/lib/nltk_data'
    - ''
**********************************************************************

I run code in readme which is:

from antm import ANTM
import pandas as pd

# load data
df=pd.read_parquet("./data/dblpFullSchema_2000_2020_extract_big_data_2K.parquet")
df=df[["abstract","year"]].rename(columns={"abstract":"content","year":"time"})
df=df.dropna().sort_values("time").reset_index(drop=True).reset_index()

# choosing the windows size and overlapping length for time frames
window_size = 6
overlap = 2

#initialize model
model=ANTM(df,overlap,window_size,umap_n_neighbors=10, partioned_clusttering_size=5,mode="data2vec",num_words=10,path="./saved_data")

#learn the model and save it
topics_per_period=model.fit(save=True)    # <------- ERROR when save model.
#output is a list of timeframes including all the topics associated with that period

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.