forked from kubapok/retroc2
4
This commit is contained in:
parent
f6a8309517
commit
3ade31cf7d
@ -44,7 +44,7 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"train = pd.read_csv('train/train.tsv', header=None, sep='\\t', error_bad_lines=False)\n",
|
"train = pd.read_csv('train/train.tsv', header=None, sep='\\t', error_bad_lines=False)\n",
|
||||||
"print(len(train))\n",
|
"print(len(train))\n",
|
||||||
"train = train.head(40000)"
|
"train = train.head(10000)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -122,7 +122,7 @@
|
|||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"4289.2810262872745\n"
|
"4086.3369441409172\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
40000
dev-0/out.tsv
40000
dev-0/out.tsv
File diff suppressed because it is too large
Load Diff
@ -44,7 +44,7 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"train = pd.read_csv('train/train.tsv', header=None, sep='\\t', error_bad_lines=False)\n",
|
"train = pd.read_csv('train/train.tsv', header=None, sep='\\t', error_bad_lines=False)\n",
|
||||||
"print(len(train))\n",
|
"print(len(train))\n",
|
||||||
"train = train.head(40000)"
|
"train = train.head(10000)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -122,7 +122,7 @@
|
|||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"4289.2810262872745\n"
|
"4086.3369441409172\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
10
run.py
10
run.py
@ -39,14 +39,14 @@ x_dev[20000] = "a ten tekst jest najbardziej testowy"
|
|||||||
y_dev = pd.read_csv('dev-0/expected.tsv', header=None, sep='\t')
|
y_dev = pd.read_csv('dev-0/expected.tsv', header=None, sep='\t')
|
||||||
|
|
||||||
|
|
||||||
# In[ ]:
|
# In[5]:
|
||||||
|
|
||||||
|
|
||||||
model = make_pipeline(TfidfVectorizer(), LinearRegression())
|
model = make_pipeline(TfidfVectorizer(), LinearRegression())
|
||||||
model.fit(x_train, y_train)
|
model.fit(x_train, y_train)
|
||||||
|
|
||||||
|
|
||||||
# In[ ]:
|
# In[6]:
|
||||||
|
|
||||||
|
|
||||||
dev_predicted = model.predict(x_dev)
|
dev_predicted = model.predict(x_dev)
|
||||||
@ -59,13 +59,13 @@ dev_out = pd.read_csv('dev-0/out.tsv', header=None, sep='\t')
|
|||||||
dev_expected = pd.read_csv('dev-0/expected.tsv', header=None, sep='\t')
|
dev_expected = pd.read_csv('dev-0/expected.tsv', header=None, sep='\t')
|
||||||
|
|
||||||
|
|
||||||
# In[ ]:
|
# In[7]:
|
||||||
|
|
||||||
|
|
||||||
print(mean_squared_error(dev_out, dev_expected))
|
print(mean_squared_error(dev_out, dev_expected))
|
||||||
|
|
||||||
|
|
||||||
# In[ ]:
|
# In[8]:
|
||||||
|
|
||||||
|
|
||||||
with open('test-A/in.tsv', 'r', encoding = 'utf-8') as f:
|
with open('test-A/in.tsv', 'r', encoding = 'utf-8') as f:
|
||||||
@ -81,7 +81,7 @@ with open('test-A/out.tsv', 'wt') as f:
|
|||||||
f.write(str(i)+'\n')
|
f.write(str(i)+'\n')
|
||||||
|
|
||||||
|
|
||||||
# In[ ]:
|
# In[9]:
|
||||||
|
|
||||||
|
|
||||||
get_ipython().system('jupyter nbconvert --to script run.ipynb')
|
get_ipython().system('jupyter nbconvert --to script run.ipynb')
|
||||||
|
28440
test-A/out.tsv
28440
test-A/out.tsv
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user