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
d20f728e
Commit
d20f728e
authored
5 years ago
by
Dominique Benielli
Browse files
Options
Downloads
Patches
Plain Diff
Update plot_usecase_exampleMKL.py
parent
a4486a78
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#4178
failed
5 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/usecase/plot_usecase_exampleMKL.py
+24
-2
24 additions, 2 deletions
examples/usecase/plot_usecase_exampleMKL.py
with
24 additions
and
2 deletions
examples/usecase/plot_usecase_exampleMKL.py
+
24
−
2
View file @
d20f728e
...
...
@@ -10,7 +10,7 @@ multi class digit from sklearn, multivue
- vue 2 gradiant of image in second direction
"""
from
__future__
import
absolute_import
import
numpy
as
np
import
matplotlib.pyplot
as
plt
from
sklearn.multiclass
import
OneVsOneClassifier
...
...
@@ -22,7 +22,29 @@ from multimodal.datasets.data_sample import MultiModalArray
from
multimodal.kernels.mvml
import
MVML
from
multimodal.kernels.lpMKL
import
MKL
from
examples.usecase.usecase_function
import
plot_subplot
import
numpy
as
np
import
matplotlib.pyplot
as
plt
import
matplotlib._color_data
as
mcd
def
plot_subplot
(
X
,
Y
,
Y_pred
,
vue
,
subplot
,
title
):
cn
=
mcd
.
CSS4_COLORS
classes
=
np
.
unique
(
Y
)
n_classes
=
len
(
np
.
unique
(
Y
))
axs
=
plt
.
subplot
(
subplot
[
0
],
subplot
[
1
],
subplot
[
2
])
axs
.
set_title
(
title
)
#plt.scatter(X._extract_view(vue), X._extract_view(vue), s=40, c='gray',
# edgecolors=(0, 0, 0))
for
index
,
k
in
zip
(
range
(
n_classes
),
cn
.
keys
()):
Y_class
,
=
np
.
where
(
Y
==
classes
[
index
])
Y_class_pred
=
np
.
intersect1d
(
np
.
where
(
Y_pred
==
classes
[
index
])[
0
],
np
.
where
(
Y_pred
==
Y
)[
0
])
plt
.
scatter
(
X
.
_extract_view
(
vue
)[
Y_class
],
X
.
_extract_view
(
vue
)[
Y_class
],
s
=
40
,
c
=
cn
[
k
],
edgecolors
=
'
blue
'
,
linewidths
=
2
,
label
=
"
class real class:
"
+
str
(
index
))
#
plt
.
scatter
(
X
.
_extract_view
(
vue
)[
Y_class_pred
],
X
.
_extract_view
(
vue
)[
Y_class_pred
],
s
=
160
,
edgecolors
=
'
orange
'
,
linewidths
=
2
,
label
=
"
class prediction:
"
+
str
(
index
))
if
__name__
==
'
__main__
'
:
# file = get_dataset_path("digit_histogram.npy")
...
...
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