Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bolsonaro
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Luc Giffon
bolsonaro
Commits
a98fd932
Commit
a98fd932
authored
4 years ago
by
Charly Lamothe
Browse files
Options
Downloads
Patches
Plain Diff
Fix missing EnsembleSelectionForestClassifier in sanity checks of trainer
parent
c6160646
No related branches found
Branches containing commit
No related tags found
1 merge request
!23
Resolve "integration-sota"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
code/bolsonaro/trainer.py
+6
-4
6 additions, 4 deletions
code/bolsonaro/trainer.py
with
6 additions
and
4 deletions
code/bolsonaro/trainer.py
+
6
−
4
View file @
a98fd932
...
...
@@ -3,7 +3,7 @@ from bolsonaro.models.omp_forest_regressor import OmpForestRegressor
from
bolsonaro.models.omp_forest_classifier
import
OmpForestBinaryClassifier
,
OmpForestMulticlassClassifier
from
bolsonaro.models.similarity_forest_regressor
import
SimilarityForestRegressor
,
SimilarityForestClassifier
from
bolsonaro.models.kmeans_forest_regressor
import
KMeansForestRegressor
,
KMeansForestClassifier
from
bolsonaro.models.ensemble_selection_forest_regressor
import
EnsembleSelectionForestRegressor
from
bolsonaro.models.ensemble_selection_forest_regressor
import
EnsembleSelectionForestRegressor
,
EnsembleSelectionForestClassifier
from
bolsonaro.error_handling.logger_factory
import
LoggerFactory
from
bolsonaro.data.task
import
Task
from
.
import
LOG_PATH
...
...
@@ -134,7 +134,8 @@ class Trainer(object):
y_pred
=
np
.
sign
(
y_pred
)
y_pred
=
np
.
where
(
y_pred
==
0
,
1
,
y_pred
)
result
=
self
.
_classification_score_metric
(
y_true
,
y_pred
)
elif
type
(
model
)
in
[
SimilarityForestRegressor
,
SimilarityForestClassifier
,
KMeansForestRegressor
,
EnsembleSelectionForestRegressor
,
KMeansForestClassifier
]:
elif
type
(
model
)
in
[
SimilarityForestRegressor
,
SimilarityForestClassifier
,
KMeansForestRegressor
,
EnsembleSelectionForestRegressor
,
KMeansForestClassifier
,
EnsembleSelectionForestClassifier
]:
result
=
model
.
score
(
X
,
y_true
)
return
result
...
...
@@ -142,7 +143,7 @@ class Trainer(object):
if
type
(
model
)
in
[
OmpForestRegressor
,
SimilarityForestRegressor
,
KMeansForestRegressor
,
EnsembleSelectionForestRegressor
]:
y_pred
=
model
.
predict_base_estimator
(
X
)
result
=
self
.
_base_regression_score_metric
(
y_true
,
y_pred
)
elif
type
(
model
)
in
[
OmpForestBinaryClassifier
,
OmpForestMulticlassClassifier
,
KMeansForestClassifier
,
SimilarityForestClassifier
]:
elif
type
(
model
)
in
[
OmpForestBinaryClassifier
,
OmpForestMulticlassClassifier
,
KMeansForestClassifier
,
SimilarityForestClassifier
,
EnsembleSelectionForestClassifier
]:
y_pred
=
model
.
predict_base_estimator
(
X
)
result
=
self
.
_base_classification_score_metric
(
y_true
,
y_pred
)
elif
type
(
model
)
==
RandomForestClassifier
:
...
...
@@ -183,7 +184,8 @@ class Trainer(object):
elif
type
(
model
)
==
OmpForestBinaryClassifier
:
model_weights
=
model
.
_omp
if
type
(
model
)
in
[
SimilarityForestRegressor
,
EnsembleSelectionForestRegressor
,
KMeansForestRegressor
]:
if
type
(
model
)
in
[
SimilarityForestRegressor
,
KMeansForestRegressor
,
EnsembleSelectionForestRegressor
,
SimilarityForestClassifier
,
KMeansForestClassifier
,
EnsembleSelectionForestClassifier
]:
self
.
_selected_trees
=
model
.
selected_trees
if
len
(
self
.
_selected_trees
)
>
0
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment