Skip to content

Instantly share code, notes, and snippets.

@abhijeet-talaulikar
Last active September 10, 2023 14:41
Show Gist options
  • Save abhijeet-talaulikar/58c82f41840230850a6951cf1c4a8cf5 to your computer and use it in GitHub Desktop.
Save abhijeet-talaulikar/58c82f41840230850a6951cf1c4a8cf5 to your computer and use it in GitHub Desktop.
import plotly.express as px
# Best model
gmm = GaussianMixture(n_components=7)
gmm.fit(matrix)
# Get aspect labels and give names
labels = gmm.predict(matrix)
aspect_labels = {
0: "Loans - Repayment, high interest rates, false emails",
1: "Debt repayment - fraudulent activity, scam",
2: "Credit Report - false accounts, reporting errors",
3: "Credit Report - identity theft",
4: "Privacy - public disclosure of info, consent violation",
5: "False charges - incorrect account, debt",
6: "Privacy and identify theft mixed",
7: "Unknown verification requests"
}
review_data['labels'] = pd.Series(labels).map(aspect_labels)
# Plot
fig = px.scatter(x=x, y=y, color=review_data['labels'], labels=review_data['labels'])
fig.update_layout(
autosize=False,
width=1300,
height=600,
legend=dict(
title="Aspect",
font = dict(size = 10)
)
)
fig.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment