update
This commit is contained in:
parent
3683d13395
commit
15340647a1
@ -2,8 +2,8 @@
|
|||||||
"cells": [
|
"cells": [
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 11,
|
"execution_count": 23,
|
||||||
"id": "5182690b",
|
"id": "5e807436",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
@ -14,8 +14,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 12,
|
"execution_count": 24,
|
||||||
"id": "6ebd5310",
|
"id": "fa414610",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
@ -35,8 +35,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 13,
|
"execution_count": 25,
|
||||||
"id": "e5d2de9f",
|
"id": "180143ed",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
@ -57,8 +57,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 31,
|
||||||
"id": "f6ba46b9",
|
"id": "3f5ddebd",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
@ -88,7 +88,7 @@
|
|||||||
" \n",
|
" \n",
|
||||||
"data['train_input'] = data.apply(lambda row: to_vowpalwabbit(row, categories), axis=1)\n",
|
"data['train_input'] = data.apply(lambda row: to_vowpalwabbit(row, categories), axis=1)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"model = vowpalwabbit.Workspace('--oaa 7 --quite)\n",
|
"model = vowpalwabbit.Workspace('--oaa 7 --learning_rate 0.5')\n",
|
||||||
"\n",
|
"\n",
|
||||||
"for example in data['train_input']:\n",
|
"for example in data['train_input']:\n",
|
||||||
" model.learn(example)\n",
|
" model.learn(example)\n",
|
||||||
@ -100,8 +100,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 15,
|
"execution_count": 32,
|
||||||
"id": "0cdf4eaa",
|
"id": "5c1c1cb1",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
@ -109,7 +109,7 @@
|
|||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"[NbConvertApp] Converting notebook run.ipynb to script\n",
|
"[NbConvertApp] Converting notebook run.ipynb to script\n",
|
||||||
"[NbConvertApp] Writing 1933 bytes to run.py\n"
|
"[NbConvertApp] Writing 1950 bytes to run.py\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
18
run.ipynb
18
run.ipynb
@ -3,7 +3,7 @@
|
|||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 23,
|
"execution_count": 23,
|
||||||
"id": "4618be1f",
|
"id": "5e807436",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
@ -15,7 +15,7 @@
|
|||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 24,
|
"execution_count": 24,
|
||||||
"id": "fc616309",
|
"id": "fa414610",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
@ -36,7 +36,7 @@
|
|||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 25,
|
"execution_count": 25,
|
||||||
"id": "9553e9b0",
|
"id": "180143ed",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
@ -57,8 +57,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 28,
|
"execution_count": 31,
|
||||||
"id": "96e97cdf",
|
"id": "3f5ddebd",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
@ -88,7 +88,7 @@
|
|||||||
" \n",
|
" \n",
|
||||||
"data['train_input'] = data.apply(lambda row: to_vowpalwabbit(row, categories), axis=1)\n",
|
"data['train_input'] = data.apply(lambda row: to_vowpalwabbit(row, categories), axis=1)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"model = vowpalwabbit.Workspace('--oaa 7')\n",
|
"model = vowpalwabbit.Workspace('--oaa 7 --learning_rate 0.5')\n",
|
||||||
"\n",
|
"\n",
|
||||||
"for example in data['train_input']:\n",
|
"for example in data['train_input']:\n",
|
||||||
" model.learn(example)\n",
|
" model.learn(example)\n",
|
||||||
@ -100,8 +100,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 15,
|
"execution_count": 32,
|
||||||
"id": "e1fe9b4c",
|
"id": "5c1c1cb1",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
@ -109,7 +109,7 @@
|
|||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"[NbConvertApp] Converting notebook run.ipynb to script\n",
|
"[NbConvertApp] Converting notebook run.ipynb to script\n",
|
||||||
"[NbConvertApp] Writing 1933 bytes to run.py\n"
|
"[NbConvertApp] Writing 1950 bytes to run.py\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
6
run.py
6
run.py
@ -44,7 +44,7 @@ def to_vowpalwabbit(row, categories):
|
|||||||
return vw
|
return vw
|
||||||
|
|
||||||
|
|
||||||
# In[28]:
|
# In[ ]:
|
||||||
|
|
||||||
|
|
||||||
x_train = pd.read_csv('train/in.tsv', header=None, sep='\t')
|
x_train = pd.read_csv('train/in.tsv', header=None, sep='\t')
|
||||||
@ -65,7 +65,7 @@ print(categories)
|
|||||||
|
|
||||||
data['train_input'] = data.apply(lambda row: to_vowpalwabbit(row, categories), axis=1)
|
data['train_input'] = data.apply(lambda row: to_vowpalwabbit(row, categories), axis=1)
|
||||||
|
|
||||||
model = vowpalwabbit.Workspace('--oaa 7')
|
model = vowpalwabbit.Workspace('--oaa 7 --learning_rate 0.5')
|
||||||
|
|
||||||
for example in data['train_input']:
|
for example in data['train_input']:
|
||||||
model.learn(example)
|
model.learn(example)
|
||||||
@ -75,7 +75,7 @@ prediction('test-A/in.tsv', 'test-A/out.tsv', model, categories)
|
|||||||
prediction('test-B/in.tsv', 'test-B/out.tsv', model, categories)
|
prediction('test-B/in.tsv', 'test-B/out.tsv', model, categories)
|
||||||
|
|
||||||
|
|
||||||
# In[15]:
|
# In[30]:
|
||||||
|
|
||||||
|
|
||||||
get_ipython().system('jupyter nbconvert --to script run.ipynb')
|
get_ipython().system('jupyter nbconvert --to script run.ipynb')
|
||||||
|
Loading…
Reference in New Issue
Block a user