IRegularization<T, TInput, TOutput>

Interfaces · AiDotNet.Interfaces

Defines methods for applying regularization techniques to machine learning models.

Known implementations: RegularizationBase<T, TInput, TOutput>

How It Works

Regularization helps prevent overfitting by adding constraints to the model, typically by penalizing large coefficient values.

For Beginners: Regularization is like adding training wheels to your AI model.

Imagine you’re teaching a child to recognize dogs. If you only show them pictures of German Shepherds, they might think only German Shepherds are dogs (this is “overfitting”). Regularization helps your model focus on the most important patterns and ignore “noise” in the training data, making it better at generalizing to new examples.

Common regularization methods include:

  • L1 (Lasso): Can zero out less important features completely
  • L2 (Ridge): Keeps all features but makes their impact smaller
  • Elastic Net: A combination of L1 and L2

Without regularization, models often perform well on training data but poorly on new data.

Methods

Method Summary
Matrix<T> Regularize(Matrix<T> data) Applies regularization to output data or model coefficients.
RegularizationOptions GetOptions() Retrieves the current regularization options.
TOutput Regularize(TOutput gradient, TOutput coefficients) Applies regularization to the gradient during optimization.
Vector<T> Regularize(Vector<T> data) Applies regularization to output data or model coefficients.