machine-intelligence-laboratory / TopicNet

Interface for easier topic modelling.
https://machine-intelligence-laboratory.github.io/TopicNet
MIT License
140 stars 17 forks source link

Custom needs more custom handling #90

Closed Alvant closed 1 month ago

Alvant commented 1 year ago

What is the problem

There is an error if one uses custom regularizers:

# Create some custom regularizer
# regularizer = ...

topic_model._fit(
    dataset.get_batch_vectorizer(),
    num_iterations=10,
    custom_regularizers={
        regularizer.name: regularizer
    },
)

image

image ... image

How to fix

In the file ~/lib/miniconda3/envs/topicnet/lib/python3.8/site-packages/topicnet/cooking_machine/models/topic_model.py:289, wrap meta stuff in list:

attached_rwt = pd.DataFrame(data=nd_array, columns=list(meta.topic_name), index=list(meta.token))

Environment

topicnet==0.8.0
pandas==2.0.0
protobuf==3.20.3
Alvant commented 1 month ago

Fixing PR: https://github.com/machine-intelligence-laboratory/TopicNet/pull/98