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
e06ed718
Commit
e06ed718
authored
5 years ago
by
Dominique Benielli
Browse files
Options
Downloads
Patches
Plain Diff
add removed file
parent
355b18a9
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#4441
failed
5 years ago
Stage: test
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
multimodal/tests/data/digit.py
+0
-62
0 additions, 62 deletions
multimodal/tests/data/digit.py
multimodal/tests/data/digit_y.npy
+0
-0
0 additions, 0 deletions
multimodal/tests/data/digit_y.npy
with
0 additions
and
62 deletions
multimodal/tests/data/digit.py
deleted
100644 → 0
+
0
−
62
View file @
355b18a9
from
sklearn
import
datasets
import
numpy
as
np
import
PIL
import
matplotlib.pyplot
as
plt
import
os
import
matplotlib.pyplot
as
plt
from
multimodal.datasets.base
import
load_dict
,
save_dict
from
multimodal.tests.data.get_dataset_path
import
get_dataset_path
from
multimodal.datasets.data_sample
import
MultiModalArray
from
multimodal.kernels.mvml
import
MVML
#Load the digits dataset
digits
=
datasets
.
load_digits
()
#Display the first digit
plt
.
figure
(
1
,
figsize
=
(
3
,
3
))
plt
.
imshow
(
digits
.
images
[
-
1
],
cmap
=
plt
.
cm
.
gray_r
,
interpolation
=
'
nearest
'
)
plt
.
show
()
colors
=
digits
.
data
gradiant
=
np
.
gradient
(
digits
.
images
,
axis
=
[
1
,
2
])
print
(
gradiant
[
0
].
shape
)
gradiant0
=
gradiant
[
0
].
reshape
(
colors
.
shape
[
0
],
colors
.
shape
[
1
])
gradiant1
=
gradiant
[
1
].
reshape
(
colors
.
shape
[
0
],
colors
.
shape
[
1
])
for
ind
in
range
(
digits
.
images
.
shape
[
0
]):
ima0
=
digits
.
images
[
ind
,
:,:]
ima1
=
gradiant
[
0
][
ind
,
:,:]
ima2
=
gradiant
[
1
][
ind
,
:,:]
ama_pil0
=
PIL
.
Image
.
fromarray
(
ima0
,
mode
=
None
)
ama_pil1
=
PIL
.
Image
.
fromarray
(
ima1
,
mode
=
None
)
ama_pil2
=
PIL
.
Image
.
fromarray
(
ima2
,
mode
=
None
)
histo_color
=
np
.
asarray
(
ama_pil0
.
histogram
())
histo_gradiant0
=
np
.
asarray
(
ama_pil1
.
histogram
())
histo_gradiant1
=
np
.
asarray
(
ama_pil2
.
histogram
())
if
ind
==
0
:
list_histogram_color
=
histo_color
list_histogram_gradiant0
=
histo_gradiant0
list_histogram_gradiant1
=
histo_gradiant1
else
:
list_histogram_color
=
np
.
vstack
((
list_histogram_color
,
histo_color
))
list_histogram_gradiant0
=
np
.
vstack
((
list_histogram_gradiant0
,
histo_gradiant0
))
list_histogram_gradiant1
=
np
.
vstack
((
list_histogram_gradiant1
,
histo_gradiant1
))
dict_digit
=
{
0
:
list_histogram_color
,
1
:
list_histogram_gradiant0
,
2
:
list_histogram_gradiant1
}
print
(
list_histogram_color
.
shape
)
print
(
list_histogram_gradiant0
.
shape
)
print
(
list_histogram_gradiant1
.
shape
)
file
=
get_dataset_path
(
"
digit_histogram.npy
"
)
save_dict
(
dict_digit
,
file
)
d2
=
load_dict
(
file
)
figure
=
plt
.
figure
(
figsize
=
(
27
,
9
))
ax
=
plt
.
subplot
(
2
,
1
,
1
)
ax
.
scatter
(
list_histogram_color
[:,
3
],
list_histogram_color
[:,
4
],
c
=
digits
.
target
,
edgecolors
=
'
k
'
)
ax
=
plt
.
subplot
(
2
,
1
,
2
)
ax
.
scatter
(
list_histogram_color
[:,
0
],
list_histogram_color
[:,
1
],
c
=
digits
.
target
,
edgecolors
=
'
k
'
)
plt
.
show
()
mvml
=
MVML
(
lmbda
=
0.1
,
eta
=
1
,
nystrom_param
=
0.2
)
mvml
.
fit
(
d2
,
digits
.
target
)
This diff is collapsed.
Click to expand it.
multimodal/tests/data/digit_y.npy
0 → 100644
+
0
−
0
View file @
e06ed718
File added
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