tf.keras.wrappers.scikit_learn.KerasRegressor

Implementation of the scikit-learn regressor API for Keras.

Methods

check_params

View source

Checks for user typos in params.

Arguments
params dictionary; the parameters to be checked

Raises
ValueError if any member of params is not a valid argument.

filter_sk_params

View source

Filters sk_params and returns those in fn's arguments.

Arguments
fn arbitrary function
override dictionary, values to override sk_params

Returns
res dictionary containing variables in both sk_params and fn's arguments.

fit

View source

Constructs a new model with build_fn & fit the model to (x, y).

Arguments
x array-like, shape (n_samples, n_features) Training samples where n_samples is the number of samples and n_features is the number of features.
y array-like, shape (n_samples,) or (n_samples, n_outputs) True labels for x.
**kwargs dictionary arguments Legal arguments are the arguments of Sequential.fit

Returns
history object details about the training history at each epoch.

get_params

View source

Gets parameters for this estimator.

Arguments
**params ignored (exists for API compatibility).

Returns
Dictionary of parameter names mapped to their values.

predict

View source

Returns predictions for the given test data.

Arguments
x array-like, shape (n_samples, n_features) Test samples where n_samples is the number of samples and n_features is the number of features.
**kwargs dictionary arguments Legal arguments are the arguments of Sequential.predict.

Returns
preds array-like, shape (n_samples,) Predictions.

score

View source

Returns the mean loss on the given test data and labels.

Arguments
x array-like, shape (n_samples, n_features) Test samples where n_samples is the number of samples and n_features is the number of features.
y array-like, shape (n_samples,) True labels for x.
**kwargs</