This workflow demonstrates how to use a local model in KNIME Analytics Platform for sentiment analysis, offering an alternative to traditional lexicon-based methods.
You can easily download and run the workflow directly in your KNIME installation. For optimal performance, we recommend using the latest version of the KNIME Analytics Platform.
Workflow Details
This workflow showcases how to use a local model in KNIME Analytics Platform. Refer to the node description of the "Local GPT4ALL Chat Model Connector" for more information about setting up a local model on your machine.
You can only run this workflow locally since its large model size—several GB—makes it unsuitable for uploading to any KNIME Hub.
Note that the model's processing speed is related to your local machine's capacity. These models are designed to run with a powerful GPU so that performance may be slower on less capable machines.
Advantages of a Local Model:
No internet connection is needed.
There is no risk of data leaks.
Workflow Steps
Model Setup
Set up your local model using the "Local ChatGPT4ALL Chat Model Connector" node description as a reference. You need to download the model to your machine.
Data Input
E-commerce reviews are used to perform sentiment analysis using the local model.
Data Sampling
Use the Row Sampling node to sample the data; initially, there were more than 20,000 entries but only 20 rows. This step is crucial for running the workflow on a standard laptop, as processing a large dataset would take a long time.
Prompt Creation
Create the prompt for the LLM prompter. Example prompt: "Please analyze the sentiment of the following text and respond with either 'positive,' 'negative,' or 'neutral.' Provide only the sentiment label. Here is the review: This shirt is semi-fitted. I like it because it is not boxy but not overly tight. It is not heavy even though it is a sweatshirt material. I wish the neck was a bit higher, but I will wear a tee under it. The back is really cute. It is different, and I like that."
Processing and Visualization
After the LLM Prompter node finishes processing, the workflows takes the responses, categorize and summarize the reviews based on the sentiment label (negative, neutral, positive), and plot a bar chart by the department with the count of reviews by sentiment label.