Skip to content

Commit

Permalink
update tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
tstringerquantmetry committed Mar 13, 2019
1 parent bda09ff commit 81c54c1
Show file tree
Hide file tree
Showing 16 changed files with 1,615 additions and 521 deletions.
2 changes: 1 addition & 1 deletion melusine/data/data_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

def load_email_data():
"""
Load a pickle file containing toy email data
Load a csv file containing toy email data
Return
------
Expand Down
Binary file removed tutorial/data/emails.pickle
Binary file not shown.
1,075 changes: 1,075 additions & 0 deletions tutorial/data/emails_preprocessed.csv

Large diffs are not rendered by default.

Binary file removed tutorial/data/emails_preprocessed.pickle
Binary file not shown.
41 changes: 41 additions & 0 deletions tutorial/data/metadata.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
extension__0;extension__1;extension__2;extension__3;extension__4;extension__5;extension__6;extension__7;extension__8;dayofweek__0;dayofweek__1;dayofweek__3;dayofweek__4;hour__6;hour__8;hour__9;hour__10;hour__11;hour__12;hour__14;hour__15;hour__16;hour__17;hour__18;hour__20;hour__22;min__0;min__2;min__4;min__6;min__9;min__10;min__11;min__12;min__15;min__16;min__19;min__20;min__21;min__22;min__24;min__28;min__29;min__30;min__32;min__33;min__37;min__38;min__39;min__40;min__44;min__45;min__49;min__54;min__56;min__58
0;0;0;0;0;0;0;0;1;0;0;1;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;1;0;0;0
0;0;0;0;0;0;0;0;1;0;0;0;1;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0
1;0;0;0;0;0;0;0;0;0;0;0;1;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;1;0;0;0;0
0;0;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0;0;0;0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;0
Binary file removed tutorial/data/metadata.pickle
Binary file not shown.
47 changes: 20 additions & 27 deletions tutorial/tutorial01_emails_format.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,13 @@
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd"
]
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"df_emails = pd.read_pickle('./data/emails.pickle')"
"from melusine.data.data_loader import load_email_data\n",
"\n",
"df_emails = load_email_data()"
]
},
{
Expand Down Expand Up @@ -67,7 +60,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 2,
"metadata": {},
"outputs": [
{
Expand All @@ -76,7 +69,7 @@
"Index(['body', 'header', 'date', 'from', 'to', 'label'], dtype='object')"
]
},
"execution_count": 4,
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -101,7 +94,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 3,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -139,7 +132,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 4,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -184,7 +177,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 5,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -228,7 +221,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 6,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -310,7 +303,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 7,
"metadata": {},
"outputs": [
{
Expand All @@ -334,7 +327,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 8,
"metadata": {},
"outputs": [
{
Expand All @@ -358,7 +351,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 9,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -389,7 +382,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 10,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -420,7 +413,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 11,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -451,7 +444,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 12,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -482,7 +475,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 13,
"metadata": {},
"outputs": [
{
Expand All @@ -501,7 +494,7 @@
" 'sinistres']"
]
},
"execution_count": 15,
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -520,9 +513,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "melusine_maif",
"display_name": "test_melusine3",
"language": "python",
"name": "melusine_maif"
"name": "test_melusine3"
},
"language_info": {
"codemirror_mode": {
Expand Down
46 changes: 23 additions & 23 deletions tutorial/tutorial02_transformerscheduler.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,10 @@
]
},
{
"cell_type": "code",
"execution_count": null,
"cell_type": "markdown",
"metadata": {},
"outputs": [],
"source": [
"```python\n",
"from melusine.utils.transformer_scheduler import TransformerScheduler\n",
"\n",
"melusine_transformer = TransformerScheduler(\n",
Expand All @@ -53,7 +52,8 @@
" (my_function_3, (argument1, ), None),\n",
" mode='apply_by_multiprocessing',\n",
" n_jobs=4)\n",
" ])"
" ])\n",
"```"
]
},
{
Expand All @@ -80,12 +80,12 @@
]
},
{
"cell_type": "code",
"execution_count": null,
"cell_type": "markdown",
"metadata": {},
"outputs": [],
"source": [
"df = melusine_transformer.fit_transform(df)"
"```python\n",
"df = melusine_transformer.fit_transform(df)\n",
"```"
]
},
{
Expand All @@ -103,11 +103,10 @@
]
},
{
"cell_type": "code",
"execution_count": null,
"cell_type": "markdown",
"metadata": {},
"outputs": [],
"source": [
"```python\n",
"from sklearn.pipeline import Pipeline\n",
"\n",
"pipeline = Pipeline([\n",
Expand All @@ -116,7 +115,8 @@
" ('TransformerName3', TransformerObject3),\n",
"])\n",
"\n",
"df = pipeline.fit_tranform(df)"
"df = pipeline.fit_tranform(df)\n",
"```"
]
},
{
Expand All @@ -128,7 +128,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 1,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -189,7 +189,7 @@
"4 5"
]
},
"execution_count": 2,
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -209,7 +209,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -219,7 +219,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -229,7 +229,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -239,7 +239,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -258,7 +258,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 6,
"metadata": {},
"outputs": [
{
Expand All @@ -275,7 +275,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 7,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -360,7 +360,7 @@
"4 5 6 7 8 9"
]
},
"execution_count": 8,
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -379,9 +379,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "melusine_maif",
"display_name": "test_melusine3",
"language": "python",
"name": "melusine_maif"
"name": "test_melusine3"
},
"language_info": {
"codemirror_mode": {
Expand Down

0 comments on commit 81c54c1

Please sign in to comment.