View source on GitHub
|
Implementation of the scikit-learn regressor API for Keras.
tf.keras.wrappers.scikit_learn.KerasRegressor(
build_fn=None, **sk_params
)
check_paramscheck_params(
params
)
Checks for user typos in params.
params: dictionary; the parameters to be checkedValueError: if any member of params is not a valid argument.filter_sk_paramsfilter_sk_params(
fn, override=None
)
Filters sk_params and returns those in fn's arguments.
fn: arbitrary functionoverride: dictionary, values to override sk_paramsres: dictionary containing variables
in both sk_params and fn's arguments.fitfit(
x, y, **kwargs
)
Constructs a new model with build_fn & fit the model to (x, y).
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.fithistory: object
details about the training history at each epoch.get_paramsget_params(
**params
)
Gets parameters for this estimator.
**params: ignored (exists for API compatibility).Dictionary of parameter names mapped to their values.
predictpredict(
x, **kwargs
)
Returns predictions for the given test data.
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.preds: array-like, shape (n_samples,)
Predictions.scorescore(
x, y, **kwargs
)
Returns the mean loss on the given test data and labels.
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: dictionary arguments
Legal arguments are the arguments of Sequential.evaluate.score: float
Mean accuracy of predictions on x wrt. y.set_paramsset_params(
**params
)
Sets the parameters of this estimator.
**params: Dictionary of parameter names mapped to their values.self