-
Notifications
You must be signed in to change notification settings - Fork 22
/
main.py
42 lines (32 loc) · 1.28 KB
/
main.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
import numpy as np
import pandas as pd
from copy import deepcopy
import gc
from col_headers import Header
from experiments import Experiments, Configs
from experiments.useful import timestamped_to_vector, unison_shuffled_copies, extract_neg
# Load data
headers = Header()
c = headers.classification_col
v = headers.vector_col
data = pd.read_csv("data.csv")
test = data[data["test_set"] == True]
train = data[data["test_set"] == False]
train = train.as_matrix(columns=headers.training_headers)
test = test.as_matrix(columns=headers.training_headers)
x_test, y_test = timestamped_to_vector(test, vector_col=v, time_start=0, classification_col=c)
x_train, y_train = timestamped_to_vector(train, vector_col=v, time_start=0, classification_col=c)
# Random search with thresholding
rand_params = Configs.get_all()
expt = Experiments.Experiment(rand_params, search_algorithm="random",
data=(x_train, y_train), folds=10, folder_name="random_search_reults",
thresholding=True, threshold=0.5)
# parameter configurations
A_B_C = Configs.get_A_B_C
# Ensemble model
ensemble_config = Experiments.Ensemble_configurations(list(A_B_C.values()),
x_test=x_test, y_test=y_test,
x_train=x_train, y_train=y_train,
folder_name="test_train_results",
batch_size=64)
ensemble_config.run_experiments()