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
143b37a8
Commit
143b37a8
authored
6 years ago
by
Baptiste Bauvin
Browse files
Options
Downloads
Patches
Plain Diff
Added init_hypotheses
parent
5dce3320
Branches
Branches containing commit
Tags
Tags containing commit
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
+14
-11
14 additions, 11 deletions
...oMultiViewClassifiers/Monoview/Additions/QarBoostUtils.py
with
14 additions
and
11 deletions
multiview_platform/MonoMultiViewClassifiers/Monoview/Additions/QarBoostUtils.py
+
14
−
11
View file @
143b37a8
...
@@ -51,23 +51,15 @@ class ColumnGenerationClassifierQar(BaseEstimator, ClassifierMixin, BaseBoost):
...
@@ -51,23 +51,15 @@ class ColumnGenerationClassifierQar(BaseEstimator, ClassifierMixin, BaseBoost):
if
scipy
.
sparse
.
issparse
(
X
):
if
scipy
.
sparse
.
issparse
(
X
):
logging
.
info
(
'
Converting to dense matrix.
'
)
logging
.
info
(
'
Converting to dense matrix.
'
)
X
=
np
.
array
(
X
.
todense
())
X
=
np
.
array
(
X
.
todense
())
if
self
.
estimators_generator
is
None
:
self
.
estimators_generator
=
StumpsClassifiersGenerator
(
n_stumps_per_attribute
=
self
.
n_stumps
,
self_complemented
=
self
.
self_complemented
)
# Initialization
# Initialization
y
[
y
==
0
]
=
-
1
y
[
y
==
0
]
=
-
1
y
=
y
.
reshape
((
y
.
shape
[
0
],
1
))
self
.
init_info_containers
()
self
.
estimators_generator
.
fit
(
X
,
y
)
self
.
classification_matrix
=
self
.
_binary_classification_matrix
(
X
)
self
.
init_info_containers
()
m
,
n
=
self
.
classification_matrix
.
shape
y
=
y
.
reshape
((
m
,
1
))
y_kernel_matrix
=
np
.
multiply
(
y
,
self
.
classification_matrix
)
m
,
n
,
y_kernel_matrix
=
self
.
init_hypotheses
(
X
,
y
)
self
.
example_weights
=
self
.
_initialize_alphas
(
m
).
reshape
((
m
,
1
))
self
.
example_weights
=
self
.
_initialize_alphas
(
m
).
reshape
((
m
,
1
))
...
@@ -173,6 +165,17 @@ class ColumnGenerationClassifierQar(BaseEstimator, ClassifierMixin, BaseBoost):
...
@@ -173,6 +165,17 @@ class ColumnGenerationClassifierQar(BaseEstimator, ClassifierMixin, BaseBoost):
self
.
predict_time
=
end
-
start
self
.
predict_time
=
end
-
start
return
signs_array
return
signs_array
def
init_hypotheses
(
self
,
X
,
y
):
if
self
.
estimators_generator
is
None
:
self
.
estimators_generator
=
StumpsClassifiersGenerator
(
n_stumps_per_attribute
=
self
.
n_stumps
,
self_complemented
=
self
.
self_complemented
)
self
.
estimators_generator
.
fit
(
X
,
y
)
self
.
classification_matrix
=
self
.
_binary_classification_matrix
(
X
)
m
,
n
=
self
.
classification_matrix
.
shape
y_kernel_matrix
=
np
.
multiply
(
y
,
self
.
classification_matrix
)
return
m
,
n
,
y_kernel_matrix
def
init_info_containers
(
self
):
def
init_info_containers
(
self
):
self
.
weights_
=
[]
self
.
weights_
=
[]
self
.
chosen_columns_
=
[]
self
.
chosen_columns_
=
[]
...
...
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