forked from gvernard/minotaur
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_code2.py
More file actions
28 lines (21 loc) · 1.09 KB
/
run_code2.py
File metadata and controls
28 lines (21 loc) · 1.09 KB
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
import numpy as np
from functions import create_save_features, train_mode, predict_mode
dname_train = 'data/output_RXJ1131_train/' # folder with time-series folders
dname_test = 'data/output_RXJ1131_test/'
# create bspline features (just call it once. It is a bit time-consuming)
#create_save_features(dname_train)
#create_save_features(dname_test)
# select which filters to use
all_filters = ['f_1.dat','f_2.dat','f_3.dat','f_4.dat','f_5.dat','f_6.dat'] # all six filters
filters = ['f_1.dat','f_3.dat','f_6.dat'] # chosen subset of filters
# train of the predictive model
model_fname = dname_train + 'mnr_coef.dat'
train_mode(dname_train, filters, model_fname)
# predict on training data
output_fname = dname_train + 'results_trained_on_RXJ1131.dat'
res_train = predict_mode(dname_train, filters, model_fname, output_fname)
# predictions on (out-of-distribution) test data
output_fname = dname_test + 'results_trained_on_RXJ1131.dat'
res_test = predict_mode(dname_test, filters, model_fname, output_fname)
recon_08_08 = np.loadtxt(output_fname, delimiter=',')
idx = np.where(np.diff(recon_08_08[:,0])<0)