Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xu Jitao
testjenkins
Commits
bb6c5524
Commit
bb6c5524
authored
Feb 14, 2018
by
Tiphagne Thomas
Browse files
reglage conflit
parents
e4e75dc0
5100b04c
Pipeline
#76
failed with stage
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
hello_world.py
View file @
bb6c5524
print
(
"hello world"
)
...
...
@@ -29,3 +30,56 @@ print(aml.leaderboard)
print
(
aml
.
leader
)
print
(
aml
.
predict
(
test
))
import
numpy
as
np
def
generate_checkers
(
nb_app
,
nb_test
,
cov
=
[[
0.25
,
0
],[
0
,
0.25
]]):
print
(
cov
)
xapp
=
np
.
ndarray
((
nb_app
*
16
,
2
))
yapp
=
np
.
ndarray
(
nb_app
*
16
)
xtest
=
np
.
ndarray
((
nb_test
*
16
,
2
))
ytest
=
np
.
ndarray
(
nb_test
*
16
)
y
=
1
index_app
=
0
index_test
=
0
for
i
in
range
(
0
,
4
):
for
j
in
range
(
0
,
4
):
center
=
[
i
,
j
]
y
=
1
if
(
i
+
j
)
%
2
else
-
1
xapp
[
index_app
:
index_app
+
nb_app
]
=
np
.
random
.
multivariate_normal
(
center
,
cov
,
nb_app
)
yapp
[
index_app
:
index_app
+
nb_app
]
=
np
.
ones
(
nb_app
)
*
y
xtest
[
index_test
:
index_test
+
nb_test
]
=
np
.
random
.
multivariate_normal
(
center
,
cov
,
nb_test
)
ytest
[
index_test
:
index_test
+
nb_test
]
=
np
.
ones
(
nb_test
)
*
y
index_test
+=
nb_test
index_app
+=
nb_app
return
xapp
,
yapp
,
xtest
,
ytest
def
generate_linear_separable_case
(
nb_app
,
nb_test
):
from
sklearn.datasets
import
make_blobs
x
,
y
=
make_blobs
(
n_samples
=
nb_app
+
nb_test
,
centers
=
2
,
n_features
=
2
)
x_app
=
x
[
0
:
nb_app
,:]
y_app
=
y
[
0
:
nb_app
].
astype
(
np
.
int64
)
x_test
=
x
[
nb_app
:,:]
y_test
=
y
[
nb_app
:]
y_app
[
y_app
==
0
]
=
-
1
y_test
[
y_test
==
0
]
=
-
1
return
x_app
,
y_app
,
x_test
,
y_test
def
generate_xor
(
nb_app
,
nb_test
):
np
.
random
.
seed
(
0
)
x_app
=
np
.
random
.
randn
(
nb_app
,
2
)
y_app
=
np
.
logical_xor
(
x_app
[:,
0
]
>
0
,
x_app
[:,
1
]
>
0
).
astype
(
int
)
y_app
[
y_app
==
0
]
=
-
1
np
.
random
.
seed
(
0
)
x_test
=
np
.
random
.
randn
(
nb_test
,
2
)
y_test
=
np
.
logical_xor
(
x_test
[:,
0
]
>
0
,
x_test
[:,
1
]
>
0
).
astype
(
int
)
y_test
[
y_test
==
0
]
=
-
1
return
x_app
,
y_app
,
x_test
,
y_test
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment