renamed a lot of stuff

This commit is contained in:
Jonas Weinz 2018-07-27 12:11:38 +02:00
parent 6525dbc120
commit a221d9f3b5
12 changed files with 4119 additions and 4108 deletions

View File

@ -4,7 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Continous Learner for Emoji classifier 🤓\n",
"# Learner for Emoji classifier 🤓\n",
"**usage:**\n",
"run all cells, then go to the [user interface](#User-Interface)"
]
@ -46,7 +46,7 @@
}
],
"source": [
"import simple_twitter_learning as stl\n",
"import twitter_learning as twl\n",
"import glob\n",
"import sys\n",
"from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer, HashingVectorizer\n",
@ -158,7 +158,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "9035abacb17b41e4ac3875663fb23014",
"model_id": "e94b33b8493a48798d3adda091986a78",
"version_major": 2,
"version_minor": 0
},
@ -493,7 +493,7 @@
" \n",
" min_words = shown_widgets[\"min_words\"].value\n",
" \n",
" sdm = stl.sample_data_manager.generate_and_read(path=shown_widgets[\"root_path\"].value,\n",
" sdm = twl.sample_data_manager.generate_and_read(path=shown_widgets[\"root_path\"].value,\n",
" n_top_emojis=shown_widgets[\"n_top_emojis\"].value,\n",
" file_range=range(r[0], r[1]),\n",
" n_kmeans_cluster=-1,\n",
@ -546,7 +546,7 @@
" \n",
" p = progress_indicator()\n",
" \n",
" tr = stl.trainer(sdm=sdm, pm=pm)\n",
" tr = twl.trainer(sdm=sdm, pm=pm)\n",
" tr.fit(progress_callback=p.update, batch_size=batch_size if batch_size > 0 else None, n_epochs=n_epochs)\n",
" \n",
"\n",
@ -613,7 +613,7 @@
" if shown_widgets[\"d2v_use_pretrained\"].value:\n",
" vectorizer = pickle.load( open( \"doc2VecModel.p\", \"rb\" ) )\n",
" else:\n",
" vectorizer = stl.skd2v.Doc2VecTransformer(size=shown_widgets[\"d2v_size\"].value,\n",
" vectorizer = twl.skd2v.Doc2VecTransformer(size=shown_widgets[\"d2v_size\"].value,\n",
" window=shown_widgets[\"d2v_window\"].value,\n",
" min_count=shown_widgets[\"d2v_min_count\"].value)\n",
" else:\n",
@ -764,7 +764,7 @@
"outputs": [],
"source": [
"top_20 = list(\"😳😋😀😌😏😔😒😎😢😅😁😉🙌🙏😘😊😩😍😭😂\")\n",
"top_20_sents = stl.emoji2sent(top_20)\n",
"top_20_sents = twl.emoji2sent(top_20)\n",
"\n",
"pred = None\n",
"\n",
@ -782,9 +782,9 @@
" X = shown_widgets[\"test_input\"].value\n",
" pred = pm.predict([X])\n",
" target_list=list(shown_widgets[\"prediction_ground_set\"].value)\n",
" shown_widgets[\"prediction\"].value = \"<h1> \" + str(stl.sent2emoji(pred,custom_target_emojis=target_list)[0]) + \"</h1>\"\n",
" shown_widgets[\"prediction\"].value = \"<h1> \" + str(twl.sent2emoji(pred,custom_target_emojis=target_list)[0]) + \"</h1>\"\n",
" if shown_widgets[\"show_sorted_list\"].value:\n",
" mp(\"## \" + \"\".join(stl.edist.sentiment_vector_to_emoji(pred, only_emoticons=True, n_results=100, custom_target_emojis=target_list)))\n",
" mp(\"## \" + \"\".join(twl.edist.sentiment_vector_to_emoji(pred, only_emoticons=True, n_results=100, custom_target_emojis=target_list)))\n",
" \n",
"\n",
"\n",
@ -810,7 +810,7 @@
" return\n",
" \n",
" if tr is None:\n",
" tr = stl.trainer(sdm=sdm, pm=pm)\n",
" tr = twl.trainer(sdm=sdm, pm=pm)\n",
" \n",
" pred, y = tr.test(emoji_subset=list(shown_widgets[\"validation_emojis\"].value))\n",
" print(len(pred))\n",

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,35 @@
# Advanced Approach
----
## Folder Overview
| Filename | short_description |
| -------------------------------------------- | ------------------------------------------------------------ |
| twitter_learning.py / twitter_learning.ipynb | module containing the main classes for the learning process |
| Learner.ipynb | notebook containing a user interface to control the learn process |
| Evaluation_sentiment_dataset.ipynb | notebook creating an evaluation on the sentiment dataset |
----
## twitter_learning.py
TODO
----
## Learner.ipynb
This file provides all controls for the train process and feeds the classifier with data. To use it just run all cells and jump to the user interface Part. Some explanations for the options:
### load datasets
![1532531542185](README.assets/1532531542185.png)
----
## Evaluation_sentiment_dataset.ipynb
TODO

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +0,0 @@
# Simple Approach
----
just a slightly better approach than the naive one 💁