https://cdn-icons-png.flaticon.com/512/4310/4310173.png

Classify customer reviews or support tickets as positive, negative, or neutral to analyze the satisfaction of customers.

A sentiment model analyzes text data to determine expressed sentiment. It is trained on a labeled dataset of positive, negative, or neutral examples. These models are used in e.g. social media and customer feedback analysis. They can provide valuable insights into customer opinions and preferences, allowing businesses to improve their products**.**

Here is an example on how to build an ML model in Peliqan.io with a few lines of Python code.

Import required modules

import pandas as pd
import numpy as np
import string
from sklearn.svm import SVC
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
from sklearn.feature_extraction.text import TfidfVectorizer
from joblib import dump

Load a dataset

Load data from a table into a dataframe (df), e.g. support tickets on which we want to apply sentiment analysis.

# Load Data
dbconn = pq.dbconnect('dw_123')
df = dbconn.fetch('db_name', 'schema_name', 'support_tickets', df = True)
df = df.drop('Prediction', axis=1)

Using Streamlit to build an app

We use the Streamlit module (st), built into Peliqan.io, to build a UI and show data.

# Show a title (st = Streamlit module)
st.title("Sentiment Analysis")

# Show some text
st.text("Sample data")

# Show the dataframe
st.dataframe(df.head(), use_container_width=True)

Untitled

Untitled

Data Pre-processing