gemseo / mlearning / regression

regression module

Regression model

The regression module implements regression algorithms, where the goal is to find relationships between continuous input and output variables. After being fitted to a learning set, Regression algorithms can predict output values of new input data.

A regression algorithm consists of identifying a function \(f: \mathbb{R}^{n_{\textrm{inputs}}} \to \mathbb{R}^{n_{\textrm{outputs}}}\). Given an input point \(x \in \mathbb{R}^{n_{\textrm{inputs}}}\), the predict method of the regression algorithm will return the output point \(y = f(x) \in \mathbb{R}^{n_{\textrm{outputs}}}\). See supervised for more information.

Wherever possible, regression algorithms should also be able to compute the Jacobian matrix of the function it has learned to represent. Given an input point \(x \in \mathbb{R}^{n_{\textrm{inputs}}}\), the Jacobian predict method of the regression algorithm should thus return the matrix

\[\begin{split}J_f(x) = \frac{\partial f}{\partial x} = \begin{pmatrix} \frac{\partial f_1}{\partial x_1} & \cdots & \frac{\partial f_1} {\partial x_{n_{\textrm{inputs}}}}\\ \vdots & \ddots & \vdots\\ \frac{\partial f_{n_{\textrm{outputs}}}}{\partial x_1} & \cdots & \frac{\partial f_{n_{\textrm{outputs}}}} {\partial x_{n_{\textrm{inputs}}}} \end{pmatrix} \in \mathbb{R}^{n_{\textrm{outputs}}\times n_{\textrm{inputs}}}.\end{split}\]

This concept is implemented through the MLRegressionAlgo class which inherits from the MLSupervisedAlgo class.

class gemseo.mlearning.regression.regression.MLRegressionAlgo(data, transformer=None, input_names=None, output_names=None, **parameters)[source]

Bases: gemseo.mlearning.core.supervised.MLSupervisedAlgo

Machine Learning Regression Model Algorithm.

Inheriting classes should implement the MLSupervisedAlgo._fit() and MLSupervisedAlgo._predict() methods, and MLRegressionAlgo._predict_jacobian() method if possible.


  • data (Dataset) – learning dataset.

  • transformer (dict(str)) – transformation strategy for data groups. If None, do not scale data. Default: None.

  • input_names (list(str)) – names of the input variables.

  • output_names (list(str)) – names of the output variables.

  • parameters – algorithm parameters.

class DataFormatters[source]

Bases: gemseo.mlearning.core.supervised.MLSupervisedAlgo.DataFormatters

Machine learning regression model decorators.

classmethod format_dict_jacobian(predict)[source]

If input_data is passed as a dictionary, then convert it to ndarray, and convert output_data to dictionary. Else, do nothing.


predict – Method whose input_data and output_data are to be formatted.

classmethod transform_jacobian(predict_jac)[source]

Apply transform to inputs, and inverse transform to outputs.


predict – Method whose input_data and output_data are to be formatted.

predict_jacobian(input_data, *args, **kwargs)[source]

Predict output data from input data, assuming both are 2D.


input_data (ndarray) – input data (n_samples, n_inputs).


output data (n_samples, n_outputs).

Return type