SkorchMixin#
- class skactiveml.base.SkorchMixin[source]#
Bases:
ABCMinimal mixin to build and train a skorch.NeuralNet.
Subclasses must implement the abstract methods to provide the module, criterion, validation kwargs, and training data. This mixin always rebuilds and initializes self.neural_net_ on initialize and fits only on training data in _fit.
Methods
initialize([X, y, enforce_check_X_y])Initialize the wrapper and (optionally) validate inputs.
- initialize(X=None, y=None, enforce_check_X_y=False)[source]#
Initialize the wrapper and (optionally) validate inputs.
If any data is provided or enforce_check_X_y is True, inputs are validated via _validate_data. A new skorch.NeuralNet is then created and assigned to self.neural_net_.
- Parameters:
- Xarray-like of shape (n_samples, …), default=None
Input samples for optional validation.
- yarray-like of shape (n_samples, …), default=None
Target values for optional validation.
- enforce_check_X_ybool, default=False
Whether to validate even if both X and y are None.
- Returns:
- selfSkorchMixin
Returned when no input data was supplied (both X and y are None).
- X_out, y_outtuple of nd.array, optional
Validated X and y as a tuple, returned when enforce_check_X_y=True.