<jupyter_start><jupyter_text>Visualization<jupyter_code>## using pandas value counts on target will give us number of 0's with is non disaster tweets,
## and 1's which is disaster tweets. 
VCtrain=train['target'].value_counts().to_frame()

## seaborn barplot to display barchart
sns.barplot(data=VCtrain,x=VCtrain.index,y="target",palette="viridis")
VCtrain
## Going deep into disaster Tweets
display("Random sample of disaster tweets:",train[train.target==1].text.sample(3).to_frame())
display("Random sample of non disaster tweets:",train[train.target==0].text.sample(3).to_frame())<jupyter_output><empty_output><jupyter_text>Most common keywords<jupyter_code>common_keywords=train["keyword"].value_counts()[:20].to_frame()
fig=plt.figure(figsize=(15,6))
sns.barplot(data=common_keywords,x=common_keywords.index,y="keyword",palette="viridis")
plt.title("Most common keywords",size=16)
plt.xticks(rotation=70,size=12);<jupyter_output><empty_output><jupyter_text>Using pie chart<jupyter_code>train[train.text.str.contains("disaster")].target.\
 value_counts().to_frame().rename(index={1:"Disaster",0:"normal"}).\
  plot.pie(y="target",figsize=(12,6),title="Tweets with Disaster mentioned");<jupyter_output><empty_output><jupyter_text>Locations<jupyter_code>train.location.value_counts()[:10].to_frame()<jupyter_output><empty_output><jupyter_text>word Cloud<jupyter_code>disaster_tweets = train[train['target']==1]['text']
non_disaster_tweets = train[train['target']==0]['text']

fig, (ax1, ax2) = plt.subplots(1, 2, figsize=[16, 8])
wordcloud1 = WordCloud( background_color='white',
                        width=600,
                        height=400).generate(" ".join(disaster_tweets))
ax1.imshow(wordcloud1)
ax1.axis('off')
ax1.set_title('Disaster Tweets',fontsize=40);

wordcloud2 = WordCloud( background_color='white',
                        width=600,
                        height=400).generate(" ".join(non_disaster_tweets))
ax2.imshow(wordcloud2)
ax2.axis('off')
ax2.set_title('Non Disaster Tweets',fontsize=40);<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16204379562043797, 'fraction_numerical': 0.028710462287104624, 'mean_word_length': 7.191235059760956, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '294439', 'license': 'Apache-2.0', 'n_tokens_mistral': 754, 'n_tokens_neox': 716, 'n_words': 95, 'path': 'data-analysis.ipynb', 'repo_name': 'kingabzpro/ML-Pipeline-Disaster-tweets', 'size': '2055'}