Skip to content

Instantly share code, notes, and snippets.

@Raahul-Singh
Created June 28, 2020 21:57
Show Gist options
  • Save Raahul-Singh/44a2b5967db3aae933bd016bf79b8b7c to your computer and use it in GitHub Desktop.
Save Raahul-Singh/44a2b5967db3aae933bd016bf79b8b7c to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Combining the positive and negative classes"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>noaa</th>\n",
" <th>complexity</th>\n",
" <th>flares</th>\n",
" <th>normalized_complexity</th>\n",
" </tr>\n",
" <tr>\n",
" <th>#id</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>6075</th>\n",
" <td>9753</td>\n",
" <td>1174.534727</td>\n",
" <td>0</td>\n",
" <td>-0.206763</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2346</th>\n",
" <td>9167</td>\n",
" <td>1295.203948</td>\n",
" <td>0</td>\n",
" <td>0.989350</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10898</th>\n",
" <td>10528</td>\n",
" <td>1439.256041</td>\n",
" <td>1</td>\n",
" <td>1.224598</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8978</th>\n",
" <td>10226</td>\n",
" <td>1413.661416</td>\n",
" <td>1</td>\n",
" <td>0.952866</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3550</th>\n",
" <td>9349</td>\n",
" <td>1042.441614</td>\n",
" <td>0</td>\n",
" <td>-1.516113</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2929</th>\n",
" <td>9256</td>\n",
" <td>1146.595092</td>\n",
" <td>0</td>\n",
" <td>-0.483710</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7835</th>\n",
" <td>10051</td>\n",
" <td>1357.941952</td>\n",
" <td>0</td>\n",
" <td>1.611229</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7870</th>\n",
" <td>10051</td>\n",
" <td>1281.968382</td>\n",
" <td>1</td>\n",
" <td>-0.445289</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6604</th>\n",
" <td>9830</td>\n",
" <td>1425.241469</td>\n",
" <td>1</td>\n",
" <td>1.075809</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3756</th>\n",
" <td>9392</td>\n",
" <td>1121.968529</td>\n",
" <td>0</td>\n",
" <td>-0.727816</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" noaa complexity flares normalized_complexity\n",
"#id \n",
"6075 9753 1174.534727 0 -0.206763\n",
"2346 9167 1295.203948 0 0.989350\n",
"10898 10528 1439.256041 1 1.224598\n",
"8978 10226 1413.661416 1 0.952866\n",
"3550 9349 1042.441614 0 -1.516113\n",
"2929 9256 1146.595092 0 -0.483710\n",
"7835 10051 1357.941952 0 1.611229\n",
"7870 10051 1281.968382 1 -0.445289\n",
"6604 9830 1425.241469 1 1.075809\n",
"3756 9392 1121.968529 0 -0.727816"
]
},
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"all_flares = pd.concat([does_flare, does_not_flare])\n",
"all_flares.sample(frac=1).head(10)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## For Assumption 4"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"plt.figure(figsize=(12,12), dpi=100)\n",
"sns.boxplot(y=all_flares.normalized_complexity, x=all_flares.flares)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"plt.figure(figsize=(12,12), dpi=100)\n",
"sns.violinplot(y=all_flares.normalized_complexity, x=all_flares.flares)\n",
"plt.show()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.10"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment