-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathget_split.py
More file actions
40 lines (27 loc) · 792 Bytes
/
get_split.py
File metadata and controls
40 lines (27 loc) · 792 Bytes
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
'''
This script evaluates
the differences in the train/test
set
'''
from src import feat, mod
from sklearn.model_selection import train_test_split
today = feat.today_str()
all_dat = feat.get_both()
train, test = mod.split(all_dat,test_size=3000)
cv2 = ['latitude','longitude','maxe','dife']
cm = mod.CatMod(ord_vars=['region'],
dum_vars=None,
dat_vars=None,
ide_vars=cv2,
y='test')
cm.fit(train)
cm.feat_import()
train['pred'] = cm.predict(train)
test['pred'] = cm.predict(test)
mod.rmse_region(train,'pred','test')
mod.rmse_region(test,'pred','test')
cm.fit(all_dat)
all_dat['pred'] = cm.predict(all_dat)
#feat.add_table(all_dat[['uid','pred']],'split_pred')
# Saving the model
mod.save_model(cm,f'weight_{today}')