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

Refactored

parent 84042eec
No related branches found
No related tags found
No related merge requests found
Showing
with 396 additions and 291 deletions
...@@ -18,7 +18,7 @@ And the following python modules : ...@@ -18,7 +18,7 @@ And the following python modules :
* [matplotlib](http://matplotlib.org/) - Used to plot results * [matplotlib](http://matplotlib.org/) - Used to plot results
* [sklearn](http://scikit-learn.org/stable/) - Used for the monoview classifiers * [sklearn](http://scikit-learn.org/stable/) - Used for the monoview classifiers
* [joblib](https://pypi.python.org/pypi/joblib) - Used to compute on multiple threads * [joblib](https://pypi.python.org/pypi/joblib) - Used to compute on multiple threads
* [h5py](www.h5py.org) - Used to generate HDF5 datasets on hard drive and use them to spare RAM * [h5py](https://www.h5py.org) - Used to generate HDF5 datasets on hard drive and use them to spare RAM
* [pickle](https://docs.python.org/3/library/pickle.html) - Used to store some results * [pickle](https://docs.python.org/3/library/pickle.html) - Used to store some results
* ([graphviz](https://pypi.python.org/pypi/graphviz) - Used for decision tree interpretation) * ([graphviz](https://pypi.python.org/pypi/graphviz) - Used for decision tree interpretation)
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from recommonmark.parser import CommonMarkParser
from recommonmark.transform import AutoStructify
# import os, sys # import os, sys
# #
# MultiviewPlatform documentation build configuration file, created by # MultiviewPlatform documentation build configuration file, created by
...@@ -50,7 +49,6 @@ extensions = ['sphinx.ext.autodoc', ...@@ -50,7 +49,6 @@ extensions = ['sphinx.ext.autodoc',
'sphinx.ext.napoleon', 'sphinx.ext.napoleon',
'recommonmark'] 'recommonmark']
# Add any paths that contain templates here, relative to this directory. # Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates'] templates_path = ['_templates']
...@@ -100,7 +98,6 @@ pygments_style = 'sphinx' ...@@ -100,7 +98,6 @@ pygments_style = 'sphinx'
# If true, `todo` and `todoList` produce output, else they produce nothing. # If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True todo_include_todos = True
# -- Options for HTML output ---------------------------------------------- # -- Options for HTML output ----------------------------------------------
# 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
...@@ -119,13 +116,11 @@ html_theme = 'sphinx_rtd_theme' ...@@ -119,13 +116,11 @@ html_theme = 'sphinx_rtd_theme'
# so a file named "default.css" will overwrite the builtin "default.css". # so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = [] html_static_path = []
# -- Options for HTMLHelp output ------------------------------------------ # -- Options for HTMLHelp output ------------------------------------------
# Output file base name for HTML help builder. # Output file base name for HTML help builder.
htmlhelp_basename = 'MultiviewPlatformdoc' htmlhelp_basename = 'MultiviewPlatformdoc'
# -- Options for LaTeX output --------------------------------------------- # -- Options for LaTeX output ---------------------------------------------
latex_elements = { latex_elements = {
...@@ -154,7 +149,6 @@ latex_documents = [ ...@@ -154,7 +149,6 @@ latex_documents = [
u'Baptiste BAUVIN', 'manual'), u'Baptiste BAUVIN', 'manual'),
] ]
# -- Options for manual page output --------------------------------------- # -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples # One entry per manual page. List of tuples
...@@ -164,7 +158,6 @@ man_pages = [ ...@@ -164,7 +158,6 @@ man_pages = [
[author], 1) [author], 1)
] ]
# -- Options for Texinfo output ------------------------------------------- # -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples # Grouping the document tree into Texinfo files. List of tuples
...@@ -176,9 +169,6 @@ texinfo_documents = [ ...@@ -176,9 +169,6 @@ texinfo_documents = [
'Miscellaneous'), 'Miscellaneous'),
] ]
# Example configuration for intersphinx: refer to the Python standard library. # Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'https://docs.python.org/': None} intersphinx_mapping = {'https://docs.python.org/': None}
......
from recommonmark.transform import AutoStructify from recommonmark.transform import AutoStructify
def setup(app): def setup(app):
app.add_transform(AutoStructify) app.add_transform(AutoStructify)
This diff is collapsed.
...@@ -24,6 +24,7 @@ Define a getConfig function ...@@ -24,6 +24,7 @@ Define a getConfig function
""" """
import os import os
for module in os.listdir(os.path.dirname(os.path.realpath(__file__))): for module in os.listdir(os.path.dirname(os.path.realpath(__file__))):
if module in ['__init__.py'] or module[-3:] != '.py': if module in ['__init__.py'] or module[-3:] != '.py':
continue continue
......
...@@ -14,7 +14,7 @@ __status__ = "Prototype" # Production, Development, Prototype ...@@ -14,7 +14,7 @@ __status__ = "Prototype" # Production, Development, Prototype
def score(y_true, y_pred, multiclass=False, **kwargs): def score(y_true, y_pred, multiclass=False, **kwargs):
"""Arguments: """Arguments:
y_true: real labels y_true: real labels
y_pred predicted labels y_pred: predicted labels
Keyword Arguments: Keyword Arguments:
"0": weights to compute accuracy "0": weights to compute accuracy
...@@ -39,7 +39,8 @@ def get_scorer(**kwargs): ...@@ -39,7 +39,8 @@ def get_scorer(**kwargs):
sample_weight = kwargs["0"] sample_weight = kwargs["0"]
except: except:
sample_weight = None sample_weight = None
return make_scorer(metric, greater_is_better=True, sample_weight=sample_weight) return make_scorer(metric, greater_is_better=True,
sample_weight=sample_weight)
def getConfig(**kwargs): def getConfig(**kwargs):
...@@ -47,5 +48,6 @@ def getConfig(**kwargs): ...@@ -47,5 +48,6 @@ def getConfig(**kwargs):
sample_weight = kwargs["0"] sample_weight = kwargs["0"]
except: except:
sample_weight = None sample_weight = None
configString = "Accuracy score using " + str(sample_weight) + " as sample_weights (higher is better)" configString = "Accuracy score using " + str(
sample_weight) + " as sample_weights (higher is better)"
return configString return configString
...@@ -32,7 +32,8 @@ def score(y_true, y_pred, multiclass=False, **kwargs): ...@@ -32,7 +32,8 @@ def score(y_true, y_pred, multiclass=False, **kwargs):
else: else:
average = "binary" average = "binary"
score = metric(y_true, y_pred, sample_weight=sample_weight, labels=labels, pos_label=pos_label, average=average) score = metric(y_true, y_pred, sample_weight=sample_weight, labels=labels,
pos_label=pos_label, average=average)
return score return score
...@@ -54,7 +55,8 @@ def get_scorer(**kwargs): ...@@ -54,7 +55,8 @@ def get_scorer(**kwargs):
average = kwargs["3"] average = kwargs["3"]
except: except:
average = "binary" average = "binary"
return make_scorer(metric, greater_is_better=True, sample_weight=sample_weight, labels=labels, return make_scorer(metric, greater_is_better=True,
sample_weight=sample_weight, labels=labels,
pos_label=pos_label, average=average) pos_label=pos_label, average=average)
...@@ -75,7 +77,9 @@ def getConfig(**kwargs): ...@@ -75,7 +77,9 @@ def getConfig(**kwargs):
average = kwargs["3"] average = kwargs["3"]
except: except:
average = "binary" average = "binary"
configString = "F1 score using " + str(sample_weight) + " as sample_weights, " + str(labels) + " as labels, " + str( configString = "F1 score using " + str(
sample_weight) + " as sample_weights, " + str(
labels) + " as labels, " + str(
pos_label) \ pos_label) \
+ " as pos_label, " + average + " as average (higher is better)" + " as pos_label, " + average + " as average (higher is better)"
return configString return configString
...@@ -30,7 +30,8 @@ def score(y_true, y_pred, multiclass=False, **kwargs): ...@@ -30,7 +30,8 @@ def score(y_true, y_pred, multiclass=False, **kwargs):
average = "micro" average = "micro"
else: else:
average = "binary" average = "binary"
score = metric(y_true, y_pred, beta, sample_weight=sample_weight, labels=labels, pos_label=pos_label, score = metric(y_true, y_pred, beta, sample_weight=sample_weight,
labels=labels, pos_label=pos_label,
average=average) average=average)
return score return score
...@@ -56,7 +57,8 @@ def get_scorer(**kwargs): ...@@ -56,7 +57,8 @@ def get_scorer(**kwargs):
average = kwargs["4"] average = kwargs["4"]
except: except:
average = "binary" average = "binary"
return make_scorer(metric, greater_is_better=True, beta=beta, sample_weight=sample_weight, labels=labels, return make_scorer(metric, greater_is_better=True, beta=beta,
sample_weight=sample_weight, labels=labels,
pos_label=pos_label, average=average) pos_label=pos_label, average=average)
...@@ -81,7 +83,9 @@ def getConfig(**kwargs): ...@@ -81,7 +83,9 @@ def getConfig(**kwargs):
average = kwargs["3"] average = kwargs["3"]
except: except:
average = "binary" average = "binary"
configString = "F-beta score using " + str(sample_weight) + " as sample_weights, " + str( configString = "F-beta score using " + str(
sample_weight) + " as sample_weights, " + str(
labels) + " as labels, " + str(pos_label) \ labels) + " as labels, " + str(pos_label) \
+ " as pos_label, " + average + " as average, " + str(beta) + " as beta (higher is better)" + " as pos_label, " + average + " as average, " + str(
beta) + " as beta (higher is better)"
return configString return configString
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment