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
Merge requests
!15
Resolve "Adding new datasets"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "Adding new datasets"
17-adding-new-datasets
into
master
Overview
0
Commits
39
Pipelines
0
Changes
1
Merged
Leo Bouscarrat
requested to merge
17-adding-new-datasets
into
master
5 years ago
Overview
0
Commits
39
Pipelines
0
Changes
1
Expand
Closes
#17 (closed)
Edited
5 years ago
by
Charly Lamothe
0
0
Merge request reports
Viewing commit
34bca5fe
Prev
Next
Show latest version
1 file
+
21
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
34bca5fe
Argmax instead of mean for predict in binary
· 34bca5fe
Léo Bouscarrat
authored
5 years ago
code/bolsonaro/models/omp_forest.py
+
4
−
2
Options
@@ -33,6 +33,8 @@ class OmpForest(BaseEstimator, metaclass=ABCMeta):
# sklearn baseestimator api methods
def
fit
(
self
,
X_forest
,
y_forest
,
X_omp
,
y_omp
):
# print(y_forest.shape)
# print(set([type(y) for y in y_forest]))
self
.
_base_forest_estimator
.
fit
(
X_forest
,
y_forest
)
self
.
_extract_subforest
(
X_omp
,
y_omp
)
# type: OrthogonalMatchingPursuit
return
self
@@ -140,8 +142,8 @@ class SingleOmpForest(OmpForest):
forest_predictions
/=
self
.
_forest_norms
weights
=
self
.
_omp
.
coef_
omp_trees_indices
=
np
.
nonzero
(
weights
)
omp_trees_indices
=
np
.
nonzero
(
weights
)
[
0
]
select_trees
=
np
.
mean
(
forest_predictions
[
omp_trees_indices
],
axis
=
0
)
print
(
len
(
omp_trees_indices
))
return
select_trees
Loading