Skip to content
Snippets Groups Projects
Commit 033e04fd authored by Baptiste Bauvin's avatar Baptiste Bauvin
Browse files

pytest

parent cd2509fb
No related branches found
No related tags found
No related merge requests found
...@@ -63,7 +63,7 @@ exclude_patterns = ['_build', '**.ipynb_checkpoints'] ...@@ -63,7 +63,7 @@ exclude_patterns = ['_build', '**.ipynb_checkpoints']
# The theme to use for HTML and HTML Help pages. See the documentation for # The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes. # a list of builtin themes.
# #
html_theme = 'groundwork' html_theme = 'nature'
# Add any paths that contain custom static files (such as style sheets) here, # 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, # relative to this directory. They are copied after the builtin static files,
......
...@@ -2,15 +2,16 @@ import os ...@@ -2,15 +2,16 @@ import os
import h5py import h5py
import numpy as np import numpy as np
import yaml
from sklearn.datasets import make_classification, make_gaussian_quantiles from sklearn.datasets import make_classification, make_gaussian_quantiles
from tabulate import tabulate from tabulate import tabulate
import pandas as pd import pandas as pd
import inspect import inspect
from datetime import datetime 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 init_random_state, init_error_matrix, init_list
from multiview_generator.base_strs import * from .base_strs import *
class MultiViewSubProblemsGenerator: class MultiViewSubProblemsGenerator:
...@@ -217,13 +218,12 @@ class MultiViewSubProblemsGenerator: ...@@ -217,13 +218,12 @@ class MultiViewSubProblemsGenerator:
def gen_view_report(self, view_index): def gen_view_report(self, view_index):
view_string = "\n\n### View "+str(view_index+1) view_string = "\n\n### View "+str(view_index+1)
view_string+="\n\nThis view is generated with {}, with the following configuration : \n```yaml\n".format(self._get_generator(view_index)) view_string+="\n\nThis view is generated with {}, with the following configuration : \n```yaml\n".format(self._get_generator_report(view_index))
import yaml
view_string += yaml.dump(self.sub_problem_configurations[view_index], line_break="\n",default_flow_style=False) view_string += yaml.dump(self.sub_problem_configurations[view_index], line_break="\n",default_flow_style=False)
view_string+="```" view_string+="```"
return 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"]: 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)" 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"]: elif self.sub_problem_types[view_index]in ["gaussian", "make_gaussian_quantiles"]:
......
import unittest import unittest
import numpy as np import numpy as np
from ..multiple_sub_problems import MultiViewSubProblemsGenerator from multiview_generator.multiple_sub_problems import MultiViewSubProblemsGenerator
class Test_MultiVieSubProblemsGenerator(): class Test_MultiViewSubProblemsGenerator(unittest.TestCase):
def __init__(self): @classmethod
self.conf = np.array([ def setUpClass(cls):
np.array([0.0, 0.1, 0.1, 0.9]), pass
np.array([0.0, 0.2, 0.1, 0.0]),
np.array([0.0, 0.3, 0.1, 0.0]), @classmethod
np.array([0.0, 0.4, 0.2, 0.0]), def tearDownClass(cls):
np.array([0.0, 0.5, 0.2, 0.0]), pass
np.array([0.0, 0.6, 0.2, 0.0]),
np.array([0.0, 0.7, 0.2, 0.0]), def test_simple(self):
np.array([0.0, 0.8, 0.1, 0.]), gene = MultiViewSubProblemsGenerator()
])
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, ]
...@@ -16,7 +16,7 @@ def setup_package(): ...@@ -16,7 +16,7 @@ def setup_package():
here = os.path.abspath(os.path.dirname(__file__)) here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.md'), encoding='utf-8') as readme: with open(os.path.join(here, 'README.md'), encoding='utf-8') as readme:
long_description = readme.read() long_description = readme.read()
group = 'baptiste.bauvin' group = 'dev'
url = 'https://gitlab.lis-lab.fr/{}/{}'.format(group, name) url = 'https://gitlab.lis-lab.fr/{}/{}'.format(group, name)
project_urls = { project_urls = {
'Documentation': 'http://{}.pages.lis-lab.fr/{}'.format(group, name), 'Documentation': 'http://{}.pages.lis-lab.fr/{}'.format(group, name),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment