malss package

API

class malss.malss.MALSS(task, shuffle=True, standardize=True, scoring=None, cv=5, n_jobs=-1, random_state=0, lang='en', verbose=True)[source]
__init__(task, shuffle=True, standardize=True, scoring=None, cv=5, n_jobs=-1, random_state=0, lang='en', verbose=True)[source]

Initialize parameters.

task : string
Specifies the task of the analysis. It must be one of ‘classification’, ‘regression’.
shuffle : boolean, optional (default=True)
Whether to shuffle the data.
standardize : boolean, optional (default=True)
Whether to sdandardize the data.
scoring : string, callable or None, optional, default: None
A string (see scikit-learn’s model evaluation documentation) or a scorer callable object / function with signature scorer(estimator, X, y). mean_squared_error (for regression task) or f1 (for classification task) is used by default.
cv : integer or cross-validation generator.
If an integer is passed, it is the number of folds (default 3). K-fold cv (for regression task) or Stratified k-fold cv (for classification task) is used by default. Specific cross-validation objects can be passed, see sklearn.cross_validation module for the list of possible objects.
n_jobs : integer, optional (default=1)
The number of jobs to run in parallel. If -1, then the number of jobs is set to the number of cores - 1.
random_state : int seed, RandomState instance, or None (default=0)
The seed of the pseudo random number generator
lang : string (default=’en’)
Specifies the language in the report. It must be one of ‘en’ (English), ‘jp’ (Japanese).
verbose : boolean, default: True
Enable verbose output.
__weakref__

list of weak references to the object (if defined)

add_algorithm(estimator, param_grid, name)[source]

Add arbitrary scikit-learn-compatible algorithm.

estimator : object type that implements the “fit” and “predict” methods
A object of that type is instantiated for each grid point.
param_grid : dict or list of dictionaries
Dictionary with parameters names (string) as keys and lists of parameter settings to try as values, or a list of such dictionaries, in which case the grids spanned by each dictionary in the list are explored. This enables searching over any sequence of parameter settings.
name : string
Algorithm name (used for report)
fit(X, y, dname=None, algorithm_selection_only=False)[source]

Tune parameters and search best algorithm

X : {numpy.ndarray, pandas.DataFrame}, shape = [n_samples, n_features]
Training vector, where n_samples in the number of samples and n_features is the number of features.
y : {numpy.ndarray, pandas.Series}, shape = [n_samples]
Target values (class labels in classification, real numbers in regression)
dname : string (default=None)
If not None, make a analysis report in this directory.
algorithm_selection_only : boolean, optional (default=False)
If True, only algorithm selection is executed. This option is needed for (get|add|remove)_algorithm(s) methods.
self : object
Returns self.
generate_module_sample(fname='module_sample.py')[source]

Generate a module sample to be able to add in the model in your system for prediction.

fname : string (default=”module_sample.py”)
A string containing a path to a output file.
get_algorithms()[source]

Get algorithm names and grid parameters.

algorithms : list
List of tupples(name, grid_params).
remove_algorithm(index=-1)[source]

Remove algorithm

index : int (default=-1)
Remove an algorithm from list by index. By default, last algorithm is removed.

Table Of Contents

Previous topic

Welcome to malss’s documentation!

This Page