renamed a lot of stuff
This commit is contained in:
parent
6525dbc120
commit
a221d9f3b5
@ -4,7 +4,7 @@
|
|||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"# Continous Learner for Emoji classifier 🤓\n",
|
"# Learner for Emoji classifier 🤓\n",
|
||||||
"**usage:**\n",
|
"**usage:**\n",
|
||||||
"run all cells, then go to the [user interface](#User-Interface)"
|
"run all cells, then go to the [user interface](#User-Interface)"
|
||||||
]
|
]
|
||||||
@ -46,7 +46,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"import simple_twitter_learning as stl\n",
|
"import twitter_learning as twl\n",
|
||||||
"import glob\n",
|
"import glob\n",
|
||||||
"import sys\n",
|
"import sys\n",
|
||||||
"from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer, HashingVectorizer\n",
|
"from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer, HashingVectorizer\n",
|
||||||
@ -158,7 +158,7 @@
|
|||||||
{
|
{
|
||||||
"data": {
|
"data": {
|
||||||
"application/vnd.jupyter.widget-view+json": {
|
"application/vnd.jupyter.widget-view+json": {
|
||||||
"model_id": "9035abacb17b41e4ac3875663fb23014",
|
"model_id": "e94b33b8493a48798d3adda091986a78",
|
||||||
"version_major": 2,
|
"version_major": 2,
|
||||||
"version_minor": 0
|
"version_minor": 0
|
||||||
},
|
},
|
||||||
@ -493,7 +493,7 @@
|
|||||||
" \n",
|
" \n",
|
||||||
" min_words = shown_widgets[\"min_words\"].value\n",
|
" min_words = shown_widgets[\"min_words\"].value\n",
|
||||||
" \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",
|
" n_top_emojis=shown_widgets[\"n_top_emojis\"].value,\n",
|
||||||
" file_range=range(r[0], r[1]),\n",
|
" file_range=range(r[0], r[1]),\n",
|
||||||
" n_kmeans_cluster=-1,\n",
|
" n_kmeans_cluster=-1,\n",
|
||||||
@ -546,7 +546,7 @@
|
|||||||
" \n",
|
" \n",
|
||||||
" p = progress_indicator()\n",
|
" p = progress_indicator()\n",
|
||||||
" \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",
|
" tr.fit(progress_callback=p.update, batch_size=batch_size if batch_size > 0 else None, n_epochs=n_epochs)\n",
|
||||||
" \n",
|
" \n",
|
||||||
"\n",
|
"\n",
|
||||||
@ -613,7 +613,7 @@
|
|||||||
" if shown_widgets[\"d2v_use_pretrained\"].value:\n",
|
" if shown_widgets[\"d2v_use_pretrained\"].value:\n",
|
||||||
" vectorizer = pickle.load( open( \"doc2VecModel.p\", \"rb\" ) )\n",
|
" vectorizer = pickle.load( open( \"doc2VecModel.p\", \"rb\" ) )\n",
|
||||||
" else:\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",
|
" window=shown_widgets[\"d2v_window\"].value,\n",
|
||||||
" min_count=shown_widgets[\"d2v_min_count\"].value)\n",
|
" min_count=shown_widgets[\"d2v_min_count\"].value)\n",
|
||||||
" else:\n",
|
" else:\n",
|
||||||
@ -764,7 +764,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"top_20 = list(\"😳😋😀😌😏😔😒😎😢😅😁😉🙌🙏😘😊😩😍😭😂\")\n",
|
"top_20 = list(\"😳😋😀😌😏😔😒😎😢😅😁😉🙌🙏😘😊😩😍😭😂\")\n",
|
||||||
"top_20_sents = stl.emoji2sent(top_20)\n",
|
"top_20_sents = twl.emoji2sent(top_20)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"pred = None\n",
|
"pred = None\n",
|
||||||
"\n",
|
"\n",
|
||||||
@ -782,9 +782,9 @@
|
|||||||
" X = shown_widgets[\"test_input\"].value\n",
|
" X = shown_widgets[\"test_input\"].value\n",
|
||||||
" pred = pm.predict([X])\n",
|
" pred = pm.predict([X])\n",
|
||||||
" target_list=list(shown_widgets[\"prediction_ground_set\"].value)\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",
|
" 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",
|
"\n",
|
||||||
"\n",
|
"\n",
|
||||||
@ -810,7 +810,7 @@
|
|||||||
" return\n",
|
" return\n",
|
||||||
" \n",
|
" \n",
|
||||||
" if tr is None:\n",
|
" if tr is None:\n",
|
||||||
" tr = stl.trainer(sdm=sdm, pm=pm)\n",
|
" tr = twl.trainer(sdm=sdm, pm=pm)\n",
|
||||||
" \n",
|
" \n",
|
||||||
" pred, y = tr.test(emoji_subset=list(shown_widgets[\"validation_emojis\"].value))\n",
|
" pred, y = tr.test(emoji_subset=list(shown_widgets[\"validation_emojis\"].value))\n",
|
||||||
" print(len(pred))\n",
|
" print(len(pred))\n",
|
3250
Project/advanced_approach/Evaluation.ipynb
Normal file
3250
Project/advanced_approach/Evaluation.ipynb
Normal file
File diff suppressed because it is too large
Load Diff
824
Project/advanced_approach/Evaluation_sentiment_dataset.ipynb
Normal file
824
Project/advanced_approach/Evaluation_sentiment_dataset.ipynb
Normal file
File diff suppressed because one or more lines are too long
35
Project/advanced_approach/README.md
Normal file
35
Project/advanced_approach/README.md
Normal 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
@ -1,6 +0,0 @@
|
|||||||
# Simple Approach
|
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
just a slightly better approach than the naive one 💁
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user