Ejemplo n.º 1
0
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",
                                         classification_col=2)
#	test
test_data = np.loadtxt("data/test.txt", delimiter=",")
x_test, y_test = timestamped_to_vector(test_data,
                                       timestamp_col=0,
                                       time_start=1,
                                       classification_col=2)
#	all data
x = np.concatenate((x_train, x_test))
y = np.concatenate((y_train, y_test))

# random search of hyperparameters
expt = Experiments.Experiment(Configs.get_all(),
                              folds=10,
                              search_algorithm="random",
                              data=(x_train, y_train),
                              folder_name="random_search",
                              thresholding=True,
                              threshold=0.5)
expt.run_experiments(num_experiments=400)

# Config A with separate test set
params_A = Configs.get_A()
params_A["sequence_length"] = list(range(1, 31))  # total real time length

expt = Experiments.Experiment(params_A,
                              search_algorithm="grid",
                              x_test=x_test,
                              y_test=y_test,
                              x_train=x_train,
                              y_train=y_train,