Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dev
MAGE Multiview Artificial Generation Engine
Commits
033e04fd
Commit
033e04fd
authored
Apr 28, 2020
by
Baptiste Bauvin
Browse files
pytest
parent
cd2509fb
Changes
4
Hide whitespace changes
Inline
Side-by-side
docs/source/conf.py
View file @
033e04fd
...
...
@@ -63,7 +63,7 @@ exclude_patterns = ['_build', '**.ipynb_checkpoints']
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme
=
'
groundwork
'
html_theme
=
'
nature
'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
...
...
multiview_generator/multiple_sub_problems.py
View file @
033e04fd
...
...
@@ -2,15 +2,16 @@ import os
import
h5py
import
numpy
as
np
import
yaml
from
sklearn.datasets
import
make_classification
,
make_gaussian_quantiles
from
tabulate
import
tabulate
import
pandas
as
pd
import
inspect
from
datetime
import
datetime
from
multiview_generator
.utils
import
format_array
,
get_config_from_file
,
\
from
.utils
import
format_array
,
get_config_from_file
,
\
init_random_state
,
init_error_matrix
,
init_list
from
multiview_generator
.base_strs
import
*
from
.base_strs
import
*
class
MultiViewSubProblemsGenerator
:
...
...
@@ -217,13 +218,12 @@ class MultiViewSubProblemsGenerator:
def
gen_view_report
(
self
,
view_index
):
view_string
=
"
\n\n
### View "
+
str
(
view_index
+
1
)
view_string
+=
"
\n\n
This view is generated with {}, with the following configuration :
\n
```yaml
\n
"
.
format
(
self
.
_get_generator
(
view_index
))
import
yaml
view_string
+=
"
\n\n
This view is generated with {}, with the following configuration :
\n
```yaml
\n
"
.
format
(
self
.
_get_generator_report
(
view_index
))
view_string
+=
yaml
.
dump
(
self
.
sub_problem_configurations
[
view_index
],
line_break
=
"
\n
"
,
default_flow_style
=
False
)
view_string
+=
"```"
return
view_string
def
_get_generator
(
self
,
view_index
,
doc_type
=
".md"
):
def
_get_generator
_report
(
self
,
view_index
,
doc_type
=
".md"
):
if
self
.
sub_problem_types
[
view_index
]
in
[
"make_classification"
,
"base"
]:
return
"[`make_classification`](https://scikit-learn.org/stable/modules/generated/sklearn.datasets.make_classification.html)"
elif
self
.
sub_problem_types
[
view_index
]
in
[
"gaussian"
,
"make_gaussian_quantiles"
]:
...
...
multiview_generator/tests/test_multiple_sub_problems.py
View file @
033e04fd
import
unittest
import
numpy
as
np
from
.
.multiple_sub_problems
import
MultiViewSubProblemsGenerator
from
multiview_generator
.multiple_sub_problems
import
MultiViewSubProblemsGenerator
class
Test_MultiVieSubProblemsGenerator
():
class
Test_MultiVie
w
SubProblemsGenerator
(
unittest
.
TestCase
):
def
__init__
(
self
):
self
.
conf
=
np
.
array
([
np
.
array
([
0.0
,
0.1
,
0.1
,
0.9
]),
np
.
array
([
0.0
,
0.2
,
0.1
,
0.0
]),
np
.
array
([
0.0
,
0.3
,
0.1
,
0.0
]),
np
.
array
([
0.0
,
0.4
,
0.2
,
0.0
]),
np
.
array
([
0.0
,
0.5
,
0.2
,
0.0
]),
np
.
array
([
0.0
,
0.6
,
0.2
,
0.0
]),
np
.
array
([
0.0
,
0.7
,
0.2
,
0.0
]),
np
.
array
([
0.0
,
0.8
,
0.1
,
0.
]),
])
self
.
n_views
=
4
self
.
n_folds
=
10
self
.
n_classes
=
8
self
.
n_samples
=
2000
self
.
class_sep
=
1.5
self
.
class_weights
=
[
0.125
,
0.1
,
0.15
,
0.125
,
0.01
,
0.2
,
0.125
,
0.125
,
]
@
classmethod
def
setUpClass
(
cls
):
pass
@
classmethod
def
tearDownClass
(
cls
):
pass
def
test_simple
(
self
):
gene
=
MultiViewSubProblemsGenerator
()
setup.py
View file @
033e04fd
...
...
@@ -16,7 +16,7 @@ def setup_package():
here
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
__file__
))
with
open
(
os
.
path
.
join
(
here
,
'README.md'
),
encoding
=
'utf-8'
)
as
readme
:
long_description
=
readme
.
read
()
group
=
'
baptiste.bauvin
'
group
=
'
dev
'
url
=
'https://gitlab.lis-lab.fr/{}/{}'
.
format
(
group
,
name
)
project_urls
=
{
'Documentation'
:
'http://{}.pages.lis-lab.fr/{}'
.
format
(
group
,
name
),
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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