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
65e5c1a5
Commit
65e5c1a5
authored
4 years ago
by
Dominique Benielli
Browse files
Options
Downloads
Patches
Plain Diff
testcumbo
parent
4f44aaa4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#4447
passed
4 years ago
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
multimodal/tests/test_cumbo.py
+44
-44
44 additions, 44 deletions
multimodal/tests/test_cumbo.py
with
44 additions
and
44 deletions
multimodal/tests/test_cumbo.py
+
44
−
44
View file @
65e5c1a5
...
...
@@ -489,24 +489,24 @@ class TestMuCumboClassifier(unittest.TestCase):
# assert_array_equal(clf.views_ind_, expected_views_ind)
# #
#
def test_class_variation(self):
#
# Check that classes labels can be integers or strings and can be stored
#
# into any kind of sequence
#
X = np.array([[1., 1., 1.], [-1., -1., -1.]])
#
views_ind = np.array([0, 1, 3])
#
y = np.array([3, 1])
#
clf = MuCumboClassifier()
#
clf.fit(X, y, views_ind)
#
np.testing.assert_almost_equal(clf.predict(X), y)
#
#
y = np.array(["class_1", "class_2"])
#
clf = MuCumboClassifier()
#
clf.fit(X, y)
#
np.testing.assert_equal(clf.predict(X), y)
#
# Check that misformed or inconsistent inputs raise expections
#
X = np.zeros((5, 4, 2))
#
y = np.array([0, 1])
#
self.assertRaises(ValueError, clf.fit, X, y, views_ind)
def
test_class_variation
(
self
):
# Check that classes labels can be integers or strings and can be stored
# into any kind of sequence
X
=
np
.
array
([[
1.
,
1.
,
1.
],
[
-
1.
,
-
1.
,
-
1.
]])
views_ind
=
np
.
array
([
0
,
1
,
3
])
y
=
np
.
array
([
3
,
1
])
clf
=
MuCumboClassifier
()
clf
.
fit
(
X
,
y
,
views_ind
)
np
.
testing
.
assert_almost_equal
(
clf
.
predict
(
X
),
y
)
y
=
np
.
array
([
"
class_1
"
,
"
class_2
"
])
clf
=
MuCumboClassifier
()
clf
.
fit
(
X
,
y
)
np
.
testing
.
assert_equal
(
clf
.
predict
(
X
),
y
)
# Check that misformed or inconsistent inputs raise expections
X
=
np
.
zeros
((
5
,
4
,
2
))
y
=
np
.
array
([
0
,
1
])
self
.
assertRaises
(
ValueError
,
clf
.
fit
,
X
,
y
,
views_ind
)
# assert_raises(ValueError, clf.fit, X, y, views_ind)
...
...
@@ -634,30 +634,30 @@ class TestMuCumboClassifier(unittest.TestCase):
# assert_array_equal(clf.predict(np.array([[-1., 0., 1.]])), np.array([1]))
#
def test_simple_predict(self):
#
#np.random.seed(seed)
#
#
# Simple example with 2 classes and 1 view
#
X = np.array(
#
[[1.1, 2.1],
#
[2.1, 0.2],
#
[0.7, 1.2],
#
[-0.9, -1.8],
#
[-1.1, -2.2],
#
[-0.3, -1.3]])
#
y = np.array([0, 0, 0, 1, 1, 1])
#
views_ind = np.array([0, 2])
#
clf = MuCumboClassifier()
#
clf.fit(X, y, views_ind)
#
#assert_array_equal(clf.predict(X), y)
#
#assert_array_equal(clf.predict(np.array([[1., 1.], [-1., -1.]])),
#
# np.array([0, 1]))
#
#assert_equal(clf.decision_function(X).shape, y.shape)
#
#
views_ind = np.array([[1, 0]])
#
clf = MuCumboClassifier()
#
clf.fit(X, y, views_ind)
#
np.testing.assert_almost_equal(clf.predict(X), y)
def
test_simple_predict
(
self
):
#np.random.seed(seed)
# Simple example with 2 classes and 1 view
X
=
np
.
array
(
[[
1.1
,
2.1
],
[
2.1
,
0.2
],
[
0.7
,
1.2
],
[
-
0.9
,
-
1.8
],
[
-
1.1
,
-
2.2
],
[
-
0.3
,
-
1.3
]])
y
=
np
.
array
([
0
,
0
,
0
,
1
,
1
,
1
])
views_ind
=
np
.
array
([
0
,
2
])
clf
=
MuCumboClassifier
()
clf
.
fit
(
X
,
y
,
views_ind
)
#assert_array_equal(clf.predict(X), y)
#assert_array_equal(clf.predict(np.array([[1., 1.], [-1., -1.]])),
# np.array([0, 1]))
#assert_equal(clf.decision_function(X).shape, y.shape)
views_ind
=
np
.
array
([[
1
,
0
]])
clf
=
MuCumboClassifier
()
clf
.
fit
(
X
,
y
,
views_ind
)
np
.
testing
.
assert_almost_equal
(
clf
.
predict
(
X
),
y
)
...
...
@@ -835,8 +835,8 @@ class TestMuCumboClassifier(unittest.TestCase):
# assert_equal(clf.score(X, y), 1.)
#
#
def test_classifier(self):
#
return check_estimator(MuCumboClassifier)
def
test_classifier
(
self
):
return
check_estimator
(
MuCumboClassifier
)
#
#
# def test_iris():
...
...
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