-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathproblem.py
48 lines (31 loc) · 1.05 KB
/
problem.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import rampwf as rw
import pandas as pd
from pathlib import Path
from sklearn.model_selection import StratifiedShuffleSplit
problem_title = 'Template RAMP kit to create data challenges'
_prediction_label_names = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
# A type (class) which will be used to create wrapper objects for y_pred
Predictions = rw.prediction_types.make_multiclass(
label_names=_prediction_label_names
)
# An object implementing the workflow
workflow = rw.workflows.Estimator()
score_types = [
rw.score_types.Accuracy(name='accuracy', precision=4),
]
def get_cv(X, y):
cv = StratifiedShuffleSplit(n_splits=8, test_size=0.2, random_state=57)
return cv.split(X, y)
def load_data(path='.', file='X_train.csv'):
path = Path(path) / "data"
X_df = pd.read_csv(path / file)
y = X_df['target']
X_df = X_df.drop(columns=['target'])
return X_df, y
# READ DATA
def get_train_data(path='.'):
file = 'X_train.csv'
return load_data(path, file)
def get_test_data(path='.'):
file = 'X_test.csv'
return load_data(path, file)