-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_experiments.py
More file actions
65 lines (58 loc) · 1.4 KB
/
run_experiments.py
File metadata and controls
65 lines (58 loc) · 1.4 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import pandas as pd
from models.naive_bayes import NaiveBayes
from models.svm import SVMclassifier
from models.knn_classifier import KNNClassifier
from models.decision_tree import DecisionTree
from models.random_forest import RandomForest
from main import experiment
from utils import log_experiment
split_ratio = 0.2
run_grid_search = True
run_pca = True
n_components = 3 # originally, the dataset has 13 features
seed = 42
csv_path = "data/processed/h358-2015.csv"
data = pd.read_csv(csv_path, index_col=0)
for model in [
NaiveBayes(),
# SVMclassifier(),
KNNClassifier(),
DecisionTree(),
RandomForest(),
]:
# run with PCA
run_pca = True
acc, prec, rec, f1_score, cm, roc, report = experiment(
data, model, split_ratio, run_pca, run_grid_search, n_components, seed
)
log_experiment(
model,
run_pca,
run_grid_search,
split_ratio,
n_components,
seed,
acc,
prec,
rec,
f1_score,
roc,
)
# run without PCA
run_pca = False
acc, prec, rec, f1_score, cm, roc, report = experiment(
data, model, split_ratio, run_pca, run_grid_search, n_components, seed
)
log_experiment(
model,
run_pca,
run_grid_search,
split_ratio,
n_components,
seed,
acc,
prec,
rec,
f1_score,
roc,
)