forked from kubapok/auta-public
Compare commits
No commits in common. "master" and "master" have entirely different histories.
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,3 @@
|
|||||||
*~
|
*~
|
||||||
*.swp
|
*.swp
|
||||||
*.pyc
|
*.pyc
|
||||||
env
|
|
1000
dev-0/out.tsv
1000
dev-0/out.tsv
File diff suppressed because it is too large
Load Diff
@ -1,31 +0,0 @@
|
|||||||
from sklearn.linear_model import LinearRegression
|
|
||||||
import pandas as pd
|
|
||||||
|
|
||||||
def prepare_data(file, type):
|
|
||||||
data = pd.read_csv(file, header=None, sep="\t")
|
|
||||||
for c in data.select_dtypes(include=object).columns.values:
|
|
||||||
data[c] = data[c].astype("category").cat.codes
|
|
||||||
if type == 'train':
|
|
||||||
data = pd.get_dummies(data, columns=[4])
|
|
||||||
else:
|
|
||||||
data = pd.get_dummies(data, columns=[3])
|
|
||||||
return data
|
|
||||||
|
|
||||||
data = prepare_data("./train/train.tsv", "train")
|
|
||||||
|
|
||||||
data = data.loc[(data[0] > 1000)]
|
|
||||||
|
|
||||||
price = data.iloc[:,0]
|
|
||||||
training_data = data.iloc[:,1:]
|
|
||||||
|
|
||||||
clf = LinearRegression().fit(training_data, price)
|
|
||||||
|
|
||||||
with open('dev-0/out.tsv', 'w') as writer:
|
|
||||||
dev_data = prepare_data('dev-0/in.tsv', "dev")
|
|
||||||
for result in clf.predict(dev_data.iloc[:,0:]):
|
|
||||||
writer.write(str(int(result)) + '\n')
|
|
||||||
|
|
||||||
with open('test-A/out.tsv', 'w') as writer:
|
|
||||||
test_data = prepare_data('test-A/in.tsv', "test")
|
|
||||||
for result in clf.predict(test_data.iloc[:,0:]):
|
|
||||||
writer.write(str(int(result)) + '\n')
|
|
@ -1,10 +0,0 @@
|
|||||||
joblib==1.0.1
|
|
||||||
numpy==1.20.3
|
|
||||||
pandas==1.2.4
|
|
||||||
python-dateutil==2.8.1
|
|
||||||
pytz==2021.1
|
|
||||||
scikit-learn==0.24.2
|
|
||||||
scipy==1.6.3
|
|
||||||
six==1.16.0
|
|
||||||
sklearn==0.0
|
|
||||||
threadpoolctl==2.1.0
|
|
1000
test-A/out.tsv
1000
test-A/out.tsv
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user