StochasticGradientDescentOptimizerOptions<T, TInput, TOutput>

Options & Configuration · AiDotNet.Models.Options

Configuration options for Stochastic Gradient Descent (SGD) optimization, a widely used algorithm for training machine learning models with large datasets.

Inheritance: ModelOptions → OptimizationAlgorithmOptions<T, TInput, TOutput> → GradientBasedOptimizerOptions<T, TInput, TOutput> → StochasticGradientDescentOptimizerOptions<T, TInput, TOutput>

For Beginners

Stochastic Gradient Descent is a faster way to train machine learning models with large datasets.

When training machine learning models:

  • We need to find the best parameters that minimize errors
  • Traditional gradient descent uses the entire dataset for each update
  • This becomes very slow with large datasets

Stochastic Gradient Descent solves this by:

  • Using only a small random subset of data (mini-batch) for each update
  • Making many faster, approximate updates instead of fewer exact ones
  • Eventually converging to a good solution, often more quickly

This approach offers several benefits:

  • Much faster iterations, especially with large datasets
  • Can escape local minima due to the noise in updates
  • Often finds good solutions faster in practice
  • Enables training on datasets too large to fit in memory

This class lets you configure the SGD optimization process.

How It Works

Stochastic Gradient Descent (SGD) is a variation of the gradient descent optimization algorithm that updates model parameters using gradients calculated from randomly selected subsets of the training data (mini-batches) rather than the entire dataset. This approach significantly reduces computational cost per iteration, making it suitable for large-scale machine learning problems. SGD introduces randomness into the optimization process, which can help escape local minima and potentially find better solutions. However, this randomness also leads to noisier updates and potentially slower convergence compared to full-batch gradient descent. This class inherits from GradientBasedOptimizerOptions and overrides the MaxIterations property to provide a more appropriate default value for SGD optimization.

Constructors

Constructor Summary
StochasticGradientDescentOptimizerOptions() Initializes a new instance of the StochasticGradientDescentOptimizerOptions class with appropriate defaults.

Properties

Property Summary
int BatchSize { get; set; } Gets or sets the batch size for stochastic gradient descent.