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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dev
scikit-multimodallearn
Commits
c33aa00e
Commit
c33aa00e
authored
3 years ago
by
Baptiste Bauvin
Browse files
Options
Downloads
Patches
Plain Diff
Removed some comments
parent
c9347ef4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
multimodal/boosting/combo.py
+3
-15
3 additions, 15 deletions
multimodal/boosting/combo.py
with
3 additions
and
15 deletions
multimodal/boosting/combo.py
+
3
−
15
View file @
c33aa00e
...
...
@@ -215,7 +215,7 @@ class MuComboClassifier(BaseEnsemble, ClassifierMixin, UBoosting):
# required by some scikit-learn classifiers (for example
# sklearn.svm.SVC)
dist
=
np
.
empty
(
cost
.
shape
[:
2
],
dtype
=
cost
.
dtype
,
order
=
"
C
"
)
# NOTE: In Sokol's PhD thesis, the formula for dist is mistakenly given
# NOTE: In Sokol
Koco
's PhD thesis, the formula for dist is mistakenly given
# with a minus sign in section 2.2.2 page 31
sum_cost
=
np
.
sum
(
cost
[:,
np
.
arange
(
n_samples
),
y
],
axis
=
1
)[:,
np
.
newaxis
]
sum_cost
[
sum_cost
==
0
]
=
1
...
...
@@ -233,7 +233,6 @@ class MuComboClassifier(BaseEnsemble, ClassifierMixin, UBoosting):
indicatrice_one_yi
[:,
np
.
arange
(
n_samples
),
y_i
]
=
1
delta
=
np
.
ones
((
self
.
n_views_
,
n_samples
,
self
.
n_classes_
),
dtype
=
np
.
int
)
delta
[:,
np
.
arange
(
n_samples
),
y_i
]
=
-
1
# indic_minus_one = np.where(np.arange(self.n_classes_) == y)
return
indicate_ones
,
indicatrice_one_yi
,
delta
def
_compute_edges
(
self
,
cost
,
predicted_classes
,
y
):
...
...
@@ -268,10 +267,6 @@ class MuComboClassifier(BaseEnsemble, ClassifierMixin, UBoosting):
n_views
=
predicted_classes
.
shape
[
0
]
n_samples
=
y
.
shape
[
0
]
if
use_coop_coef
:
# coop_coef = self._compute_coop_coef(predicted_classes, y)
# ajout mucumbo verifier les dim
# ????? coop_cof_beta = betas[predicted_classes]
increment
=
alphas
[:,
np
.
newaxis
,
np
.
newaxis
]
*
betas
[:,
np
.
newaxis
,
:]
increment
=
np
.
tile
(
increment
,(
1
,
n_samples
,
1
))
else
:
...
...
@@ -324,7 +319,6 @@ class MuComboClassifier(BaseEnsemble, ClassifierMixin, UBoosting):
-------
betas arrays
"""
# delta = self.delta_c_yi(predicted_classes, y)
indicat
,
indicate_yi
,
delta
=
self
.
_indicatrice
(
predicted_classes
,
y
)
delta_vue
=
np
.
block
(
np
.
split
(
delta
,
self
.
n_views_
,
axis
=
0
)).
squeeze
()
indicate_vue
=
np
.
block
(
np
.
split
(
indicat
,
self
.
n_views_
,
axis
=
0
)).
squeeze
()
...
...
@@ -460,10 +454,7 @@ class MuComboClassifier(BaseEnsemble, ClassifierMixin, UBoosting):
self
.
estimator_weights_beta_
=
np
.
zeros
((
self
.
n_iterations_
,
n_views
),
dtype
=
np
.
float
)
self
.
estimator_errors_
=
np
.
array
([],
dtype
=
np
.
float64
)
return
# probablement la list de h de t global que l'on a a la fin
self
.
estimators_
=
[]
# modification mu cumbo
# mettre deux dim sur n_estimators * n_views
self
.
estimator_weights_alpha_
=
np
.
zeros
((
self
.
n_iterations_
,
n_views
),
dtype
=
np
.
float64
)
self
.
estimator_weights_beta_
=
np
.
zeros
((
self
.
n_iterations_
,
n_views
,
self
.
n_classes_
),
dtype
=
np
.
float
)
self
.
estimator_errors_
=
np
.
zeros
((
n_views
,
self
.
n_iterations_
),
dtype
=
np
.
float64
)
...
...
@@ -473,7 +464,7 @@ class MuComboClassifier(BaseEnsemble, ClassifierMixin, UBoosting):
predicted_classes
,
score_function_dif
,
betas
,
n_yi
)
=
self
.
_init_var
(
n_views
,
y
)
self
.
n_yi_
=
n_yi
for
current_iteration
in
range
(
self
.
n_iterations_
):
# list
de
h
pris a l'e
ta
p
e t
# list
of
h
at s
ta
g
e t
dist
=
self
.
_compute_dist
(
cost
,
y
)
# get h_t _i with edges delta
for
ind_view
in
range
(
n_views
):
...
...
@@ -488,13 +479,11 @@ class MuComboClassifier(BaseEnsemble, ClassifierMixin, UBoosting):
# end of choose cost matrix
# TO DO estimator_errors_ estimate
###########################################
#############self.estimator_errors_[current_iteration] = to do
#self.estimator_errors_[current_iteration] = to do
# update C_t de g
edges
=
self
.
_compute_edges
(
cost
,
predicted_classes
,
y
)
alphas
=
self
.
_compute_alphas
(
edges
)
# modif mu cumbo
self
.
estimator_weights_alpha_
[
current_iteration
,
:]
=
alphas
betas
=
self
.
_compute_betas
(
alphas
,
y
,
score_function_dif
,
predicted_classes
)
...
...
@@ -540,7 +529,6 @@ class MuComboClassifier(BaseEnsemble, ClassifierMixin, UBoosting):
dec_func
=
np
.
zeros
((
n_samples
,
n_classes
))
# update muCombo
# for ind_estimator in range(n_estimators):
for
ind_estimator
in
range
(
n_estimators
):
ind_iteration
=
ind_estimator
//
self
.
n_views_
current_vue
=
ind_estimator
%
self
.
n_views_
...
...
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