-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimple_test.py
More file actions
18 lines (14 loc) · 814 Bytes
/
Copy pathsimple_test.py
File metadata and controls
18 lines (14 loc) · 814 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# SequentialModelAlgorith Class
from lib.SequentialModelAlgorithm import SequentialModelAlgorithm
import pandas as pd
import numpy as np
# We fisrt select a dataset
dataset = pd.read_csv('./datasets/adultDataset.csv', header = 0)
# Then we chose its attribute columns and its objetive column
attr_cols = dataset.loc[:, 'capital-gain':'native-country']
obj_col = dataset['income']
# The default values for the main hyperarguments. There are arguments to change, and this can optimize the problem scenario.
model = SequentialModelAlgorithm(nmodels=300, sample_size=0.65, max_depth=10, lr=0.1)
submodels, score = model.start(attributes_cols = attr_cols, objetive_col = obj_col)
# The score evaluated with BalancedAccuracyScore from sklearn from the last submodel
print('The BalancedAccuracyScore is: '+str(score))