Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Supervised MultiModal Integration Tool
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
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
Baptiste Bauvin
Supervised MultiModal Integration Tool
Commits
a3e21e60
Commit
a3e21e60
authored
6 years ago
by
Baptiste Bauvin
Browse files
Options
Downloads
Patches
Plain Diff
Added choose_new_voter and append_new_voter
parent
9d0667f2
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
multiview_platform/MonoMultiViewClassifiers/Monoview/Additions/QarBoostUtils.py
+20
-8
20 additions, 8 deletions
...oMultiViewClassifiers/Monoview/Additions/QarBoostUtils.py
with
20 additions
and
8 deletions
multiview_platform/MonoMultiViewClassifiers/Monoview/Additions/QarBoostUtils.py
+
20
−
8
View file @
a3e21e60
...
...
@@ -68,10 +68,8 @@ class ColumnGenerationClassifierQar(BaseEstimator, ClassifierMixin, BaseBoost):
# Find best weak hypothesis given example_weights. Select the one that has the lowest minimum
# C-bound with the previous vote or the one with the best weighted margin
if
self
.
c_bound_choice
:
sol
,
new_voter_index
=
self
.
_find_new_voter
(
y_kernel_matrix
,
formatted_y
)
else
:
new_voter_index
,
sol
=
self
.
_find_best_weighted_margin
(
y_kernel_matrix
)
sol
,
new_voter_index
=
self
.
choose_new_voter
(
y_kernel_matrix
,
formatted_y
)
# If the new voter selector could not find one, break the loop
if
type
(
sol
)
==
str
:
...
...
@@ -79,9 +77,7 @@ class ColumnGenerationClassifierQar(BaseEstimator, ClassifierMixin, BaseBoost):
break
# Append the weak hypothesis.
self
.
chosen_columns_
.
append
(
new_voter_index
)
self
.
new_voter
=
self
.
classification_matrix
[:,
new_voter_index
].
reshape
((
m
,
1
))
self
.
append_new_voter
(
new_voter_index
)
# Generate the new weight for the new voter
epsilon
=
self
.
_compute_epsilon
(
formatted_y
)
...
...
@@ -140,6 +136,22 @@ class ColumnGenerationClassifierQar(BaseEstimator, ClassifierMixin, BaseBoost):
self
.
predict_time
=
end
-
start
return
signs_array
def
append_new_voter
(
self
,
new_voter_index
):
self
.
chosen_columns_
.
append
(
new_voter_index
)
self
.
new_voter
=
self
.
classification_matrix
[:,
new_voter_index
].
reshape
(
(
self
.
n_total_examples
,
1
))
def
choose_new_voter
(
self
,
y_kernel_matrix
,
formatted_y
):
if
self
.
c_bound_choice
:
sol
,
new_voter_index
=
self
.
_find_new_voter
(
y_kernel_matrix
,
formatted_y
)
else
:
new_voter_index
,
sol
=
self
.
_find_best_weighted_margin
(
y_kernel_matrix
)
return
sol
,
new_voter_index
def
init_boosting
(
self
,
m
,
y
,
y_kernel_matrix
):
self
.
example_weights
=
self
.
_initialize_alphas
(
m
).
reshape
((
m
,
1
))
...
...
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