Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
scikit-multimodallearn
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
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dev
scikit-multimodallearn
Commits
a453e239
Commit
a453e239
authored
2 years ago
by
Dominique Benielli
Browse files
Options
Downloads
Patches
Plain Diff
Update mumbo.py
parent
f0ff1a72
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#11883
failed
2 years ago
Stage: test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
multimodal/boosting/mumbo.py
+7
-21
7 additions, 21 deletions
multimodal/boosting/mumbo.py
with
7 additions
and
21 deletions
multimodal/boosting/mumbo.py
+
7
−
21
View file @
a453e239
...
@@ -53,9 +53,7 @@ from sklearn.ensemble._forest import BaseForest
...
@@ -53,9 +53,7 @@ from sklearn.ensemble._forest import BaseForest
from
sklearn.metrics
import
accuracy_score
from
sklearn.metrics
import
accuracy_score
from
sklearn.tree
import
DecisionTreeClassifier
from
sklearn.tree
import
DecisionTreeClassifier
from
sklearn.tree
import
BaseDecisionTree
from
sklearn.tree
import
BaseDecisionTree
from
sklearn.tree._tree
import
DTYPE
ValueError
:
cannot
resize
an
array
that
references
or
is
referenced
from
sklearn.tree._tree
import
DTYPE
951
E
by
another
array
in
this
way
.
952
E
Use
the
np
.
resize
function
or
refcheck
=
False
from
sklearn.utils
import
check_array
,
check_X_y
,
check_random_state
from
sklearn.utils
import
check_array
,
check_X_y
,
check_random_state
from
sklearn.utils.multiclass
import
check_classification_targets
from
sklearn.utils.multiclass
import
check_classification_targets
from
sklearn.utils.validation
import
check_is_fitted
,
has_fit_parameter
from
sklearn.utils.validation
import
check_is_fitted
,
has_fit_parameter
...
@@ -68,9 +66,7 @@ class MumboClassifier(BaseEnsemble, ClassifierMixin, UBoosting):
...
@@ -68,9 +66,7 @@ class MumboClassifier(BaseEnsemble, ClassifierMixin, UBoosting):
classifiers focus more on difficult cases.
classifiers focus more on difficult cases.
A MuMBo classifier.
A MuMBo classifier.
A MuMBo classifier is a meta-estimator that implements a multimodal ValueError: cannot resize an array that references or is referenced
A MuMBo classifier is a meta-estimator that implements a multimodal
951E by another array in this way.
952E Use the np.resize function or refcheck=False
(or multi-view) boosting algorithm:
(or multi-view) boosting algorithm:
It fits a set of classifiers on the original dataset splitted into several
It fits a set of classifiers on the original dataset splitted into several
...
@@ -83,9 +79,7 @@ class MumboClassifier(BaseEnsemble, ClassifierMixin, UBoosting):
...
@@ -83,9 +79,7 @@ class MumboClassifier(BaseEnsemble, ClassifierMixin, UBoosting):
base_estimator : object, optional (default=DecisionTreeClassifier)
base_estimator : object, optional (default=DecisionTreeClassifier)
Base estimator from which the boosted ensemble is built.
Base estimator from which the boosted ensemble is built.
Support for sample weighting is required, as well as proper `classes_`
Support for sample weighting is required, as well as proper `classes_`
and `n_classes_` attributes. The default is a DecisionTreeClassifie ValueError: cannot resize an array that references or is referenced
and `n_classes_` attributes. The default is a DecisionTreeClassifie
951E by another array in this way.
952E Use the np.resize function or refcheck=Falser
with parameter ``max_depth=1``.
with parameter ``max_depth=1``.
n_estimators : integer, optional (default=50)
n_estimators : integer, optional (default=50)
...
@@ -116,9 +110,7 @@ class MumboClassifier(BaseEnsemble, ClassifierMixin, UBoosting):
...
@@ -116,9 +110,7 @@ class MumboClassifier(BaseEnsemble, ClassifierMixin, UBoosting):
n_classes\_ : int
n_classes\_ : int
Number of classes.
Number of classes.
estimator_weights\_ : numpy.ndarray of floats, shape = (len(estimators\ ValueError: cannot resize an array that references or is referenced
estimator_weights\_ : numpy.ndarray of floats, shape = (len(estimators\
951E by another array in this way.
952E Use the np.resize function or refcheck=False_),)
Weights for each estimator in the boosted ensemble.
Weights for each estimator in the boosted ensemble.
estimator_errors_ : array of floats
estimator_errors_ : array of floats
...
@@ -149,9 +141,7 @@ class MumboClassifier(BaseEnsemble, ClassifierMixin, UBoosting):
...
@@ -149,9 +141,7 @@ class MumboClassifier(BaseEnsemble, ClassifierMixin, UBoosting):
>>>
from
sklearn.tree
import
DecisionTreeClassifier
>>>
from
sklearn.tree
import
DecisionTreeClassifier
>>>
base_estimator
=
DecisionTreeClassifier
(
max_depth
=
2
)
>>>
base_estimator
=
DecisionTreeClassifier
(
max_depth
=
2
)
>>>
clf
=
MumboClassifier
(
base_estimator
=
base_estimator
,
random_state
=
0
)
>>>
clf
=
MumboClassifier
(
base_estimator
=
base_estimator
,
random_state
=
0
)
>>>
clf
.
fit
(
X
,
y
,
views_ind
)
# doctest: +NORMALIZE_WHITESPACE ValueError: cannot resize an array that references or is referenced
>>>
clf
.
fit
(
X
,
y
,
views_ind
)
# doctest: +NORMALIZE_WHITESPACE
951
E
by
another
array
in
this
way
.
952
E
Use
the
np
.
resize
function
or
refcheck
=
False
MumboClassifier
(
base_estimator
=
DecisionTreeClassifier
(
max_depth
=
2
),
MumboClassifier
(
base_estimator
=
DecisionTreeClassifier
(
max_depth
=
2
),
random_state
=
0
)
random_state
=
0
)
>>>
print
(
clf
.
predict
([[
5.
,
3.
,
1.
,
1.
]]))
>>>
print
(
clf
.
predict
([[
5.
,
3.
,
1.
,
1.
]]))
...
@@ -167,9 +157,7 @@ class MumboClassifier(BaseEnsemble, ClassifierMixin, UBoosting):
...
@@ -167,9 +157,7 @@ class MumboClassifier(BaseEnsemble, ClassifierMixin, UBoosting):
----------
----------
.. [1] Sokol Koço,
.. [1] Sokol Koço,
"
Tackling the uneven views problem with cooperation based ensemble
"
Tackling the uneven views problem with cooperation based ensemble
learning methods
"
, ValueError: cannot resize an array that references or is referenced
learning methods
"
,
951E by another array in this way.
952E Use the np.resize function or refcheck=False
"""
"""
def
__init__
(
self
,
def
__init__
(
self
,
...
@@ -183,9 +171,7 @@ class MumboClassifier(BaseEnsemble, ClassifierMixin, UBoosting):
...
@@ -183,9 +171,7 @@ class MumboClassifier(BaseEnsemble, ClassifierMixin, UBoosting):
self
.
n_estimators
=
n_estimators
self
.
n_estimators
=
n_estimators
self
.
estimator_params
=
[
tuple
()
for
_
in
base_estimator
]
self
.
estimator_params
=
[
tuple
()
for
_
in
base_estimator
]
else
:
ValueError
:
cannot
resize
an
array
that
references
or
is
referenced
else
:
951
E
by
another
array
in
this
way
.
952
E
Use
the
np
.
resize
function
or
refcheck
=
False
super
(
MumboClassifier
,
self
).
__init__
(
super
(
MumboClassifier
,
self
).
__init__
(
base_estimator
=
base_estimator
,
base_estimator
=
base_estimator
,
n_estimators
=
n_estimators
)
n_estimators
=
n_estimators
)
...
...
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