This commit is contained in:
Sebastian 2022-06-07 17:49:00 +02:00
parent c35c5819c9
commit 79d4c51baa
6 changed files with 1154 additions and 1154 deletions

View File

@ -3,7 +3,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 23, "execution_count": 23,
"id": "c333fcd7", "id": "3312dc2a",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -15,7 +15,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 24, "execution_count": 24,
"id": "e550c221", "id": "a5d2718d",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -36,7 +36,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 25, "execution_count": 25,
"id": "57585a3e", "id": "2273a549",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -57,8 +57,8 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 35, "execution_count": 37,
"id": "a3a5ea9a", "id": "83f7c5b5",
"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 --learning_rate 0.95')\n", "model = vowpalwabbit.Workspace('--oaa 7 --learning_rate 0.99')\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": 36, "execution_count": 38,
"id": "ee80e14d", "id": "caa9bb3b",
"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 1951 bytes to run.py\n" "[NbConvertApp] Writing 1952 bytes to run.py\n"
] ]
} }
], ],

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 23, "execution_count": 23,
"id": "c333fcd7", "id": "3312dc2a",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -15,7 +15,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 24, "execution_count": 24,
"id": "e550c221", "id": "a5d2718d",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -36,7 +36,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 25, "execution_count": 25,
"id": "57585a3e", "id": "2273a549",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -57,8 +57,8 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 35, "execution_count": 37,
"id": "a3a5ea9a", "id": "83f7c5b5",
"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 --learning_rate 0.95')\n", "model = vowpalwabbit.Workspace('--oaa 7 --learning_rate 0.99')\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": 36, "execution_count": 38,
"id": "ee80e14d", "id": "caa9bb3b",
"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 1951 bytes to run.py\n" "[NbConvertApp] Writing 1952 bytes to run.py\n"
] ]
} }
], ],

6
run.py
View File

@ -44,7 +44,7 @@ def to_vowpalwabbit(row, categories):
return vw return vw
# In[ ]: # In[37]:
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 --learning_rate 0.95') model = vowpalwabbit.Workspace('--oaa 7 --learning_rate 0.99')
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[34]: # In[36]:
get_ipython().system('jupyter nbconvert --to script run.ipynb') get_ipython().system('jupyter nbconvert --to script run.ipynb')

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff