amkyawdev commited on
Commit
3b6c8e1
·
verified ·
1 Parent(s): 723f202

Add notebooks

Browse files
Files changed (1) hide show
  1. 01_data_exploration.ipynb +103 -0
01_data_exploration.ipynb ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {},
6
+ "source": [
7
+ "# 📊 Myanmar Ghost - Data Exploration\n",
8
+ "\n",
9
+ "This notebook explores the Myanmar Ghost dataset."
10
+ ]
11
+ },
12
+ {
13
+ "cell_type": "code",
14
+ "execution_count": null,
15
+ "metadata": {},
16
+ "outputs": [],
17
+ "source": [
18
+ "import sys\n",
19
+ "sys.path.insert(0, '..')\n",
20
+ "\n",
21
+ "import pandas as pd\n",
22
+ "import matplotlib.pyplot as plt\n",
23
+ "import seaborn as sns\n",
24
+ "\n",
25
+ "sns.set_style('whitegrid')\n",
26
+ "%matplotlib inline"
27
+ ]
28
+ },
29
+ {
30
+ "cell_type": "code",
31
+ "execution_count": null,
32
+ "metadata": {},
33
+ "outputs": [],
34
+ "source": [
35
+ "# Load sample data\n",
36
+ "df = pd.read_csv('../data/processed/splits/train.csv')\n",
37
+ "df.head()"
38
+ ]
39
+ },
40
+ {
41
+ "cell_type": "code",
42
+ "execution_count": null,
43
+ "metadata": {},
44
+ "outputs": [],
45
+ "source": [
46
+ "# Label distribution\n",
47
+ "plt.figure(figsize=(8, 5))\n",
48
+ "df['label'].value_counts().plot(kind='bar', color='steelblue')\n",
49
+ "plt.title('Sentiment Label Distribution')\n",
50
+ "plt.xlabel('Sentiment')\n",
51
+ "plt.ylabel('Count')\n",
52
+ "plt.xticks(rotation=45)\n",
53
+ "plt.tight_layout()\n",
54
+ "plt.show()"
55
+ ]
56
+ },
57
+ {
58
+ "cell_type": "code",
59
+ "execution_count": null,
60
+ "metadata": {},
61
+ "outputs": [],
62
+ "source": [
63
+ "# Text length distribution\n",
64
+ "df['text_length'] = df['text'].str.len()\n",
65
+ "\n",
66
+ "plt.figure(figsize=(10, 5))\n",
67
+ "sns.histplot(data=df, x='text_length', hue='label', kde=True)\n",
68
+ "plt.title('Text Length Distribution by Sentiment')\n",
69
+ "plt.xlabel('Text Length (characters)')\n",
70
+ "plt.show()"
71
+ ]
72
+ },
73
+ {
74
+ "cell_type": "code",
75
+ "execution_count": null,
76
+ "metadata": {},
77
+ "outputs": [],
78
+ "source": [
79
+ "# Sample texts\n",
80
+ "print(\"=== Positive Examples ===\")\n",
81
+ "for text in df[df['label']=='positive']['text'].head(3):\n",
82
+ " print(f\"- {text}\")\n",
83
+ "\n",
84
+ "print(\"\\n=== Negative Examples ===\")\n",
85
+ "for text in df[df['label']=='negative']['text'].head(3):\n",
86
+ " print(f\"- {text}\")"
87
+ ]
88
+ }
89
+ ],
90
+ "metadata": {
91
+ "kernelspec": {
92
+ "display_name": "Python 3",
93
+ "language": "python",
94
+ "name": "python3"
95
+ },
96
+ "language_info": {
97
+ "name": "python",
98
+ "version": "3.10.0"
99
+ }
100
+ },
101
+ "nbformat": 4,
102
+ "nbformat_minor": 4
103
+ }