MaartenGr / MaartenGr/BERTopic
Saving predictions
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.8k
- Forks
- 920
- Avg merge
- 22h 24m
- Merged PRs (30d)
- 5
Description
Hi Maarten, I tried applying the transform function after training a model. So, I train the model and afterwards, I load my whole dataframe and preprocess the texts to make the predictions:
df= pd.read_csv(file_path)
df = df.loc[df["Text_cleaned"].apply(lambda x: isinstance(x, str))]
df.dropna(subset=["Text_cleaned"], inplace=True)
df["Text_cleaned"] = df["Text_cleaned"].astype(str)
texts = df['Text_cleaned'].tolist()
topics, probs = topic_model.transform(texts)
How can I now store the results in my df and export it as a csv file again?
All the best and thank you very much
Nikola
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
This is a usage question about applying BERTopic's transform function to texts loaded with pandas and exporting the resulting dataframe; no repository file or test is named. Start by reviewing the transform usage and dataframe workflow shown in the issue. Done means providing a clear, verified usage explanation or documenting the workflow.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- pandas, python
- Domain
- data, machine-learning
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100