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
!19
WIP: Resolve "Adding new datasets"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
WIP: Resolve "Adding new datasets"
17-adding-new-datasets
into
master
Overview
0
Commits
20
Pipelines
0
Changes
2
Merged
Charly Lamothe
requested to merge
17-adding-new-datasets
into
master
5 years ago
Overview
0
Commits
20
Pipelines
0
Changes
2
Expand
0
0
Merge request reports
Viewing commit
af068a00
Prev
Next
Show latest version
2 files
+
3
−
8
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
af068a00
Better to take non zero values of list as indicated in the numpy doc
· af068a00
Léo Bouscarrat
authored
5 years ago
code/bolsonaro/models/omp_forest.py
+
2
−
5
Options
@@ -136,14 +136,11 @@ class SingleOmpForest(OmpForest):
:param X: a Forest
:return: a np.array of the predictions of the entire forest
"""
forest_predictions
=
self
.
_base_estimator
_predictions
(
X
).
T
forest_predictions
=
np
.
array
([
tree
.
predict
(
X
)
for
tree
in
self
.
_base_
forest_
estimator
.
estimators_
])
if
self
.
_models_parameters
.
normalize_D
:
forest_predictions
/=
self
.
_forest_norms
weights
=
self
.
_omp
.
coef_
omp_trees_indices
=
np
.
nonzero
(
weights
)[
0
]
select_trees
=
np
.
mean
(
forest_predictions
[
omp_trees_indices
],
axis
=
0
)
print
(
len
(
omp_trees_indices
))
select_trees
=
np
.
mean
(
forest_predictions
[
weights
!=
0
],
axis
=
0
)
return
select_trees
Loading