Regressor¶
In this module regressor_obj class is presented, which is related to machine learning regression. This class doesn’t have an implementation of any supervised learning regression algorithm, but is an interface between a regressor object implemented elsewhere and ESCAPE model and data objects. In other words this class allows one to use any 3rd party or self-implemented regressor class.
One of those well-known 3rd party regressors is a Multilayer Perceptor Regressor from scikit-learn package [1].
Machine learning regressors after training can predict a solution for a model for a given experimental dataset. This solution can be optimized further using any optimizer from ESCAPE.
Regressors can be quite useful for predictions of solutions for large number of experimental data, so-called batch processing, giving quite close to actual initial solutions for further optimization.
- escape.core.regressor.regressor(name, stack, nsamples=1000, ntests=100, impl=None, norm_method=None, noisify_method=None, fit_method=None, score_method=None, predict_method=None, stop_method=None)¶
Given an instance of a regressor class implemented in python impl returns regressor_obj object. Regressor represents a supervised leaerning regression algorithm which training can predict model parameters for a given experimental data.
- Parameters:
- stack: modelstack_obj, list of models or model_obj
Models to be optimized.
- nsamples: positive integer
Number of training datasets to be generated.
- ntests: non-negative integer value
Number of tests to use for calculation of optimization error.
- impl: object
Instance of regressor implementation.
- norm_method: callable
Normalization method applied to generated training data. If None nor normalization occured.
- noisify_method: callable
Method to noisify generated training data. If None nor normalization occured.
- fit_method: callable
Custom fit method of regressor. If None uses ‘fit’ method of implementation.
- score_method: callable
Custom score method of regressor. If None uses ‘score’ method of implementation.
- predict_method: callable
Custom predict method of regressor. If None uses ‘predict’ method of implementation.
- stop_method: callable
Custom stop method of regressor. If None uses ‘stop’ method of implementation.
- Returns:
instance of regressor_obj
- class escape.core.regressor.regressor_obj¶
Wrapper class for regressor
- fit_method¶
- Returns:
Fit method of regressor instance
- load_parameters(self, fn)¶
Load parameters from ASCII file with name ‘fn’.
- modelstack¶
- Returns:
Modestack used to generate training data
- name¶
- Returns:
Name of regressor object
- next_test(self)¶
Predicts parameter values for the next test set and calls model for the found solution.
- noisify_method¶
- Returns:
Noisify method for generated training data
- norm_method¶
- Returns:
Normalization method, applied to generated training data.
- nsamples¶
- Returns:
Number of training samples
- ntests¶
- Returns:
Number of tests
- num_of_params¶
- Returns:
Number of parameters.
- parameter(self, size_t i)¶
- predict_method¶
- Returns:
Predict method
- prev_test(self)¶
Predicts parameter values for the previous test set and calls model for the found solution.
- regressor_impl¶
- Returns:
Regressor instance
- reset(self)¶
Resets parameters values.
- save_parameters(self, fn)¶
Saves parameters to ASCII file with name ‘fn’.
- score_method¶
- Returns:
Score method of regressor instance
- shake(self)¶
Sets parameter values randomly.
- stop(self)¶
Stops training process.
- stop_method¶
- Returns:
Stop method for stopping training process
- train(self, bool reset_data)¶
Trains regressor.
- Parameters:
- reset_data: bool
If True resets previously generated training set