Skip to content

Instantly share code, notes, and snippets.

View amitness's full-sized avatar
⬆️
1.01³⁶⁵

Amit Chaudhary amitness

⬆️
1.01³⁶⁵
View GitHub Profile
@amitness
amitness / confusion_matrix.py
Created March 15, 2023 19:40
confusion matrix
import matplotlib.pyplot as plt
from sklearn.metrics import ConfusionMatrixDisplay, confusion_matrix
def plot_confusion_matrix(y_preds, y_true, labels):
cm = confusion_matrix(y_true, y_preds)
fig, ax = plt.subplots(figsize=(6, 6))
disp = ConfusionMatrixDisplay(confusion_matrix=cm, display_labels=labels)
disp.plot(cmap="Blues", values_format=".2f", ax=ax, colorbar=False)
plt.title("Normalized confusion matrix")
plt.show()
@amitness
amitness / streamlit-notes
Created March 23, 2022 22:22
streamlit-notes
# Download button
st.download_button(
label="Download sample file here",
data=sample_file,
file_name='sample_data.csv',
mime='text/csv',
)
@amitness
amitness / zipfile.py
Created March 6, 2022 13:58
zipfile add files
from zipfile import ZipFile
for annotator, subset in annotation_df.groupby('annotator'):
with ZipFile(f'{annotator}.zip', 'w') as z:
for path in subset['image_path']:
z.write(path, os.path.basename(path))
@amitness
amitness / install_requirements.sh
Created June 24, 2020 10:23
install requirements
pip install git+https://github.com/nexxt-intelligence/DeepMoji@tf-keras
pip install wordcloud matplotlib
@amitness
amitness / generate_emoji_cloud.py
Last active June 24, 2020 10:32
Generating Emoji Cloud
emoji_cloud = EmojiCloud(font_path='./Symbola.ttf', color='yellow')
emoji_cloud.generate(emojis)
@amitness
amitness / emoji_cloud.py
Last active June 24, 2020 12:00
Class for Emoji Cloud
import string
from wordcloud import WordCloud
from collections import Counter
import matplotlib.pyplot as plt
class EmojiCloud:
def __init__(self,
font_path='Symbola.ttf',
color='yellow'):
self.font_path = font_path
@amitness
amitness / emoji_cloud_class.py
Last active June 22, 2020 13:19
Generating EmojiCloud
import string
from wordcloud import WordCloud
from collections import Counter
import matplotlib.pyplot as plt
class EmojiCloud:
def __init__(self,
font_path='Symbola.ttf',
color='yellow'):
self.font_path = font_path
@amitness
amitness / deepmoji_usage.py
Last active June 24, 2020 11:13
DeepMoji usage
import pandas as pd
from deepmoji import DeepMoji
# Instantiate the Emoji Model
emoji_model = DeepMoji()
# Read a file containing user opinions
df = pd.read_csv('https://bit.ly/2VbfNiM')
# Predict the emojis for the open-ended text
@amitness
amitness / writing-research-proposal.md
Created March 9, 2020 17:15
Notes taken from a session on "Writing Research Proposal"

Writing a Research Proposal

Objectives (Motivation)

  • What will be solved?
  • What will be achieved?
  • Why is this research important?
    • Scientific
    • Application
    • Society
@amitness
amitness / clickbait.csv
Last active November 18, 2023 00:42
Dataset of clickbait and non-clickbait titles
We can't make this file beautiful and searchable because it's too large.
title,label
"15 Highly Important Questions About Adulthood, Answered By Michael Ian Black",1
250 Nuns Just Cycled All The Way From Kathmandu To New Delhi,1
"Australian comedians ""could have been shot"" during APEC prank",0
Lycos launches screensaver to increase spammers' bills,0
Fußball-Bundesliga 2008–09: Goalkeeper Butt signs with Bayern Munich,0
"In Afghanistan, Soldiers Bridge 2 Stages of War",0
"After Fleeing North Korea, an Artist Parodies Its Propaganda",0
Lessons (or Not) When a Start-Up Misses the Mark,0
Court Issues Order Against 3 Car-Warranty Calling Firms,0