Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
C
covid_analysis
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
COMPARA
covid_analysis
Commits
cd7aff2a
Commit
cd7aff2a
authored
May 10, 2024
by
Joaquin Torres
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
completed model definition after tuning manually
parent
d57b78fe
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
29 deletions
+29
-29
model_selection/test_models.py
model_selection/test_models.py
+29
-29
No files found.
model_selection/test_models.py
View file @
cd7aff2a
...
@@ -91,48 +91,48 @@ def get_tuned_models(group_id, method_id):
...
@@ -91,48 +91,48 @@ def get_tuned_models(group_id, method_id):
# 2.1) Trained with original dataset
# 2.1) Trained with original dataset
if
method_id
==
0
:
if
method_id
==
0
:
tuned_models
=
{
tuned_models
=
{
"DT"
:
DecisionTreeClassifier
(
**
{
'splitter'
:
'best'
,
'max_features'
:
'
log2'
,
'criterion'
:
'gini
'
}),
"DT"
:
DecisionTreeClassifier
(
**
{
'splitter'
:
'best'
,
'max_features'
:
'
sqrt'
,
'criterion'
:
'log_loss
'
}),
"RF"
:
RandomForestClassifier
(
**
{
'criterion'
:
'entropy'
,
'max_features'
:
'sqrt'
,
'n_estimators'
:
213
}),
"RF"
:
RandomForestClassifier
(
**
{
'criterion'
:
'entropy'
,
'max_features'
:
'sqrt'
,
'n_estimators'
:
120
}),
"Bagging"
:
BaggingClassifier
(
**
{
'max_features'
:
1.0
,
'max_samples'
:
0.8
,
'n_estimators'
:
3
2
,
'warm_start'
:
True
}),
"Bagging"
:
BaggingClassifier
(
**
{
'max_features'
:
1.0
,
'max_samples'
:
0.8
,
'n_estimators'
:
3
8
,
'warm_start'
:
True
}),
"AB"
:
AdaBoostClassifier
(
**
{
'learning_rate'
:
1.
7806904141367559
,
'n_estimators'
:
66
,
'algorithm'
:
'SAMME'
}),
"AB"
:
AdaBoostClassifier
(
**
{
'learning_rate'
:
1.
9069394544838472
,
'n_estimators'
:
121
,
'algorithm'
:
'SAMME'
}),
"XGB"
:
XGBClassifier
(
**
{
'learning_rate'
:
0.2
1889089898592098
,
'max_depth'
:
6
,
'n_estimators'
:
8
56
}),
"XGB"
:
XGBClassifier
(
**
{
'learning_rate'
:
0.2
4787889985627387
,
'max_depth'
:
4
,
'n_estimators'
:
9
56
}),
"LR"
:
LogisticRegression
(
**
{
'solver'
:
'lbfgs'
,
'penalty'
:
None
,
'max_iter'
:
1000
}),
"LR"
:
LogisticRegression
(
**
{
'solver'
:
'lbfgs'
,
'penalty'
:
'l2'
}),
#"SVM" : SVC(**{'C': 1.9890638540240584
, 'kernel': 'linear', 'max_iter':1000, 'probability': True}),
"SVM"
:
SVC
(
**
{
'C'
:
1.7965537393241109
,
'kernel'
:
'linear'
,
'max_iter'
:
1000
,
'probability'
:
True
}),
"MLP"
:
MLPClassifier
(
**
{
'activation'
:
'
logistic'
,
'hidden_layer_sizes'
:
112
,
'learning_rate'
:
'constant
'
,
'max_iter'
:
500
})
"MLP"
:
MLPClassifier
(
**
{
'activation'
:
'
relu'
,
'hidden_layer_sizes'
:
147
,
'learning_rate'
:
'invscaling
'
,
'max_iter'
:
500
})
}
}
# 2.2) Trained with original dataset and cost-sensitive learning
# 2.2) Trained with original dataset and cost-sensitive learning
elif
method_id
==
1
:
elif
method_id
==
1
:
tuned_models
=
{
tuned_models
=
{
"DT"
:
DecisionTreeClassifier
(
**
{
'splitter'
:
'best'
,
'max_features'
:
'sqrt'
,
'criterion'
:
'
log_loss
'
,
'class_weight'
:
'balanced'
}),
"DT"
:
DecisionTreeClassifier
(
**
{
'splitter'
:
'best'
,
'max_features'
:
'sqrt'
,
'criterion'
:
'
gini
'
,
'class_weight'
:
'balanced'
}),
"RF"
:
RandomForestClassifier
(
**
{
'criterion'
:
'entropy'
,
'max_features'
:
'sqrt'
,
'n_estimators'
:
1
64
,
'class_weight'
:
'balanced'
}),
"RF"
:
RandomForestClassifier
(
**
{
'criterion'
:
'entropy'
,
'max_features'
:
'sqrt'
,
'n_estimators'
:
1
38
,
'class_weight'
:
'balanced'
}),
"Bagging"
:
BaggingClassifier
(
**
{
'max_features'
:
1.0
,
'max_samples'
:
0.8
,
'n_estimators'
:
11
,
'warm_start'
:
True
,
'estimator'
:
DecisionTreeClassifier
(
class_weight
=
'balanced'
)}),
"Bagging"
:
BaggingClassifier
(
**
{
'max_features'
:
1.0
,
'max_samples'
:
1.0
,
'n_estimators'
:
66
,
'warm_start'
:
True
,
'estimator'
:
DecisionTreeClassifier
(
class_weight
=
'balanced'
)}),
"AB"
:
AdaBoostClassifier
(
**
{
'learning_rate'
:
1.
7102248217141944
,
'n_estimators'
:
108
,
'algorithm'
:
'SAMME'
,
'estimator'
:
DecisionTreeClassifier
(
class_weight
=
'balanced'
)}),
"AB"
:
AdaBoostClassifier
(
**
{
'learning_rate'
:
1.
92541653518023
,
'n_estimators'
:
114
,
'algorithm'
:
'SAMME'
,
'estimator'
:
DecisionTreeClassifier
(
class_weight
=
'balanced'
)}),
"LR"
:
LogisticRegression
(
**
{
'solver'
:
'lbfgs'
,
'penalty'
:
None
,
'max_iter'
:
1000
,
'class_weight'
:
'balanced'
}),
"LR"
:
LogisticRegression
(
**
{
'solver'
:
'lbfgs'
,
'penalty'
:
'l2'
,
'max_iter'
:
1000
,
'class_weight'
:
'balanced'
}),
#"SVM": SVC(**{'C': 1.1313840454519628, 'kernel': 'sigmoid
', 'max_iter': 1000, 'class_weight': 'balanced', 'probability': True})
"SVM"
:
SVC
(
**
{
'C'
:
0.8395104850983046
,
'kernel'
:
'linear
'
,
'max_iter'
:
1000
,
'class_weight'
:
'balanced'
,
'probability'
:
True
})
}
}
# 2.3) Trained with oversampled training dataset
# 2.3) Trained with oversampled training dataset
elif
method_id
==
2
:
elif
method_id
==
2
:
tuned_models
=
{
tuned_models
=
{
# "DT" : DecisionTreeClassifier(**{'splitter': 'random', 'max_features': 'sqrt', 'criterion': 'log_loss
'}),
"DT"
:
DecisionTreeClassifier
(
**
{
'splitter'
:
'best'
,
'max_features'
:
'log2'
,
'criterion'
:
'entropy
'
}),
# "RF" : RandomForestClassifier(**{'criterion': 'gini', 'max_features': 'sqrt', 'n_estimators': 135
}),
"RF"
:
RandomForestClassifier
(
**
{
'criterion'
:
'gini'
,
'max_features'
:
'sqrt'
,
'n_estimators'
:
118
}),
# "Bagging" : BaggingClassifier(**{'max_features': 1.0, 'max_samples': 1.0, 'n_estimators': 26, 'warm_start': Tru
e}),
"Bagging"
:
BaggingClassifier
(
**
{
'max_features'
:
1.0
,
'max_samples'
:
1.0
,
'n_estimators'
:
56
,
'warm_start'
:
Fals
e
}),
# "AB" : AdaBoostClassifier(**{'learning_rate': 1.6590924545876917, 'n_estimators': 141
, 'algorithm': 'SAMME'}),
"AB"
:
AdaBoostClassifier
(
**
{
'learning_rate'
:
1.5933610622176648
,
'n_estimators'
:
114
,
'algorithm'
:
'SAMME'
}),
# "XGB": XGBClassifier(**{'learning_rate': 0.26946295284728783, 'max_depth': 7, 'n_estimators': 893
}),
"XGB"
:
XGBClassifier
(
**
{
'learning_rate'
:
0.059934879882855396
,
'max_depth'
:
9
,
'n_estimators'
:
660
}),
#
"LR" : LogisticRegression(**{'solver': 'lbfgs', 'penalty': 'l2', 'max_iter': 1000}),
"LR"
:
LogisticRegression
(
**
{
'solver'
:
'lbfgs'
,
'penalty'
:
'l2'
,
'max_iter'
:
1000
}),
# "SVM" : SVC(**{'C': 1.676419306008229
, 'kernel': 'poly', 'max_iter':1000, 'probability': True}),
"SVM"
:
SVC
(
**
{
'C'
:
1.2237930722499044
,
'kernel'
:
'poly'
,
'max_iter'
:
1000
,
'probability'
:
True
}),
# "MLP" : MLPClassifier(**{'activation': 'relu', 'hidden_layer_sizes': 116
, 'learning_rate': 'invscaling', 'max_iter':500})
"MLP"
:
MLPClassifier
(
**
{
'activation'
:
'identity'
,
'hidden_layer_sizes'
:
134
,
'learning_rate'
:
'invscaling'
,
'max_iter'
:
500
})
}
}
# 2.4) Trained with undersampled training dataset
# 2.4) Trained with undersampled training dataset
elif
method_id
==
3
:
elif
method_id
==
3
:
tuned_models
=
{
tuned_models
=
{
"DT"
:
DecisionTreeClassifier
(
**
{
'splitter'
:
'best'
,
'max_features'
:
'
sqrt'
,
'criterion'
:
'entropy
'
}),
"DT"
:
DecisionTreeClassifier
(
**
{
'splitter'
:
'best'
,
'max_features'
:
'
log2'
,
'criterion'
:
'log_loss
'
}),
"RF"
:
RandomForestClassifier
(
**
{
'criterion'
:
'gini'
,
'max_features'
:
'sqrt'
,
'n_estimators'
:
224
}),
"RF"
:
RandomForestClassifier
(
**
{
'criterion'
:
'gini'
,
'max_features'
:
'sqrt'
,
'n_estimators'
:
151
}),
"Bagging"
:
BaggingClassifier
(
**
{
'max_features'
:
1.0
,
'max_samples'
:
0.8
,
'n_estimators'
:
13
,
'warm_start'
:
Tru
e
}),
"Bagging"
:
BaggingClassifier
(
**
{
'max_features'
:
1.0
,
'max_samples'
:
1.0
,
'n_estimators'
:
20
,
'warm_start'
:
Fals
e
}),
"AB"
:
AdaBoostClassifier
(
**
{
'learning_rate'
:
1.
836659462701278
,
'n_estimators'
:
138
,
'algorithm'
:
'SAMME'
}),
"AB"
:
AdaBoostClassifier
(
**
{
'learning_rate'
:
1.
6523810056317618
,
'n_estimators'
:
89
,
'algorithm'
:
'SAMME'
}),
"XGB"
:
XGBClassifier
(
**
{
'learning_rate'
:
0.
2517946893282251
,
'max_depth'
:
4
,
'n_estimators'
:
64
6
}),
"XGB"
:
XGBClassifier
(
**
{
'learning_rate'
:
0.
18430397856234193
,
'max_depth'
:
4
,
'n_estimators'
:
95
6
}),
"LR"
:
LogisticRegression
(
**
{
'solver'
:
'lbfgs'
,
'penalty'
:
'l2'
,
'max_iter'
:
1000
}),
"LR"
:
LogisticRegression
(
**
{
'solver'
:
'lbfgs'
,
'penalty'
:
'l2'
,
'max_iter'
:
1000
}),
#"SVM" : SVC(**{'C': 1.8414678085000697
, 'kernel': 'linear', 'max_iter':1000, 'probability': True}),
"SVM"
:
SVC
(
**
{
'C'
:
1.1807459108651588
,
'kernel'
:
'linear'
,
'max_iter'
:
1000
,
'probability'
:
True
}),
"MLP"
:
MLPClassifier
(
**
{
'activation'
:
'
relu'
,
'hidden_layer_sizes'
:
76
,
'learning_rate'
:
'constant'
,
'max_iter'
:
500
})
"MLP"
:
MLPClassifier
(
**
{
'activation'
:
'
identity'
,
'hidden_layer_sizes'
:
55
,
'learning_rate'
:
'constant'
,
'max_iter'
:
500
})
}
}
return
tuned_models
return
tuned_models
# --------------------------------------------------------------------------------------------------------
# --------------------------------------------------------------------------------------------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment