Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Baptiste Bauvin
Supervised MultiModal Integration Tool
Commits
846084bb
Commit
846084bb
authored
Mar 25, 2022
by
Florence
Browse files
New imbalance_bagging.py
parent
9a38aef0
Changes
1
Hide whitespace changes
Inline
Side-by-side
summit/multiview_platform/monoview_classifiers/imbalance_bagging.py
0 → 100644
View file @
846084bb
from
imblearn.ensemble
import
BalancedBaggingClassifier
from
sklearn.tree
import
DecisionTreeClassifier
from
..monoview.monoview_utils
import
BaseMonoviewClassifier
from
..utils.base
import
base_boosting_estimators
from
..utils.hyper_parameter_search
import
CustomRandint
,
CustomUniform
classifier_class_name
=
"ImbalanceBagging"
class
ImbalanceBagging
(
BaseMonoviewClassifier
,
BalancedBaggingClassifier
):
def
__init__
(
self
,
random_state
=
None
,
base_estimator
=
"DecisionTreeClassifier"
,
n_estimators
=
10
,
sampling_strategy
=
"auto"
,
replacement
=
False
,
base_estimator_config
=
None
):
base_estimator
=
self
.
get_base_estimator
(
base_estimator
,
base_estimator_config
)
super
(
ImbalanceBagging
,
self
).
__init__
(
random_state
=
random_state
,
base_estimator
=
base_estimator
,
n_estimators
=
n_estimators
,
sampling_strategy
=
sampling_strategy
,
replacement
=
replacement
)
self
.
param_names
=
[
"n_estimators"
,
"base_estimator"
,
"sampling_strategy"
,]
self
.
classed_params
=
[
"base_estimator"
]
self
.
distribs
=
[
CustomRandint
(
low
=
1
,
high
=
50
),
base_boosting_estimators
,
[
"auto"
]]
self
.
weird_strings
=
{
"base_estimator"
:
"class_name"
}
self
.
base_estimator_config
=
base_estimator_config
Write
Preview
Supports
Markdown
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