from sklearn.compose._target import TransformedTargetRegressor as SKLModel
import lale.helpers
import lale.operators
from numpy import nan, inf
_hyperparams_schema = {
'$schema': 'http://json-schema.org/draft-04/schema#',
'description': 'inherited docstring for TransformedTargetRegressor Meta-estimator to regress on a transformed target.',
'allOf': [{
'type': 'object',
'required': ['regressor', 'transformer', 'func', 'inverse_func', 'check_inverse'],
'relevantToOptimizer': [],
'additionalProperties': False,
'properties': {
'regressor': {
'XXX TODO XXX': 'object, default=LinearRegression()',
'description': 'Regressor object such as derived from ``RegressorMixin``. This',
'enum': [None],
'default': None},
'transformer': {
'anyOf': [{
'type': 'object'}, {
'enum': [None]}],
'default': None,
'description': 'Estimator object such as derived from ``TransformerMixin``. Cannot be'},
'func': {
'XXX TODO XXX': 'function, optional',
'description': 'Function to apply to ``y`` before passing to ``fit``. Cannot be set at',
'enum': [None],
'default': None},
'inverse_func': {
'XXX TODO XXX': 'function, optional',
'description': 'Function to apply to the prediction of the regressor. Cannot be set at',
'enum': [None],
'default': None},
'check_inverse': {
'type': 'boolean',
'default': True,
'description': 'Whether to check that ``transform`` followed by ``inverse_transform``'},
}}],
}
_input_fit_schema = {
'$schema': 'http://json-schema.org/draft-04/schema#',
'description': 'Fit the model according to the given training data.',
'type': 'object',
'properties': {
'X': {
'type': 'array',
'items': {
'type': 'array',
'items': {
'type': 'number'},
},
'description': 'Training vector, where n_samples is the number of samples and'},
'y': {
'type': 'array',
'items': {
'type': 'number'},
'description': 'Target values.'},
'sample_weight': {
'XXX TODO XXX': 'array-like, shape (n_samples,) optional',
'description': 'Array of weights that are assigned to individual samples.'},
},
}
_input_predict_schema = {
'$schema': 'http://json-schema.org/draft-04/schema#',
'description': 'Predict using the base regressor, applying inverse.',
'type': 'object',
'properties': {
'X': {
'type': 'array',
'items': {
'type': 'array',
'items': {
'type': 'number'},
},
'description': 'Samples.'},
},
}
_output_predict_schema = {
'$schema': 'http://json-schema.org/draft-04/schema#',
'description': 'Predicted values.',
'type': 'array',
'items': {
'type': 'number'},
}
_combined_schemas = {
'$schema': 'http://json-schema.org/draft-04/schema#',
'description': 'Combined schema for expected data and hyperparameters.',
'type': 'object',
'tags': {
'pre': [],
'op': ['estimator'],
'post': []},
'properties': {
'hyperparams': _hyperparams_schema,
'input_fit': _input_fit_schema,
'input_predict': _input_predict_schema,
'output_predict': _output_predict_schema},
}
if (__name__ == '__main__'):
lale.helpers.validate_is_schema(_combined_schemas)
TransformedTargetRegressor = lale.operators.make_operator(TransformedTargetRegressorImpl, _combined_schemas)