My Project
Public Member Functions | Protected Attributes | List of all members
cpu_mlp::StochasticMinimizer< V, M > Class Template Reference

Base class for Stochastic Minimizers. More...

#include <stochastic_minimizer.hpp>

Inheritance diagram for cpu_mlp::StochasticMinimizer< V, M >:
Inheritance graph
[legend]
Collaboration diagram for cpu_mlp::StochasticMinimizer< V, M >:
Collaboration graph
[legend]

Public Member Functions

virtual ~StochasticMinimizer ()=default
 
void setMaxIterations (int max_iters)
 Sets the maximum number of iterations. More...
 
void setStepSize (double s)
 Sets the step size (learning rate). More...
 
void setTolerance (double tol)
 Sets the tolerance for convergence (full gradient norm). More...
 
void setRecorder (::IterationRecorder< CpuBackend > *recorder)
 Attach a recorder for loss/grad history. More...
 

Protected Attributes

unsigned int _max_iters = 1000
 
unsigned int _iters = 0
 
double _tol = 1e-4
 
double step_size = 0.01
 
::IterationRecorder< CpuBackend > * recorder_ = nullptr
 Optional recorder for diagnostics. More...
 

Detailed Description

template<typename V, typename M>
class cpu_mlp::StochasticMinimizer< V, M >

Base class for Stochastic Minimizers.

Provides common storage for stochastic optimization parameters like step size and iteration limits.

Constructor & Destructor Documentation

◆ ~StochasticMinimizer()

template<typename V , typename M >
virtual cpu_mlp::StochasticMinimizer< V, M >::~StochasticMinimizer ( )
virtualdefault

Member Function Documentation

◆ setMaxIterations()

template<typename V , typename M >
void cpu_mlp::StochasticMinimizer< V, M >::setMaxIterations ( int  max_iters)
inline

Sets the maximum number of iterations.

Parameters
max_itersLimit on iterations.

◆ setRecorder()

template<typename V , typename M >
void cpu_mlp::StochasticMinimizer< V, M >::setRecorder ( ::IterationRecorder< CpuBackend > *  recorder)
inline

Attach a recorder for loss/grad history.

Parameters
recorderRecorder instance (may be null).

◆ setStepSize()

template<typename V , typename M >
void cpu_mlp::StochasticMinimizer< V, M >::setStepSize ( double  s)
inline

Sets the step size (learning rate).

Parameters
sStep size.

◆ setTolerance()

template<typename V , typename M >
void cpu_mlp::StochasticMinimizer< V, M >::setTolerance ( double  tol)
inline

Sets the tolerance for convergence (full gradient norm).

Parameters
tolTolerance value.

Member Data Documentation

◆ _iters

template<typename V , typename M >
unsigned int cpu_mlp::StochasticMinimizer< V, M >::_iters = 0
protected

◆ _max_iters

template<typename V , typename M >
unsigned int cpu_mlp::StochasticMinimizer< V, M >::_max_iters = 1000
protected

◆ _tol

template<typename V , typename M >
double cpu_mlp::StochasticMinimizer< V, M >::_tol = 1e-4
protected

◆ recorder_

template<typename V , typename M >
::IterationRecorder<CpuBackend>* cpu_mlp::StochasticMinimizer< V, M >::recorder_ = nullptr
protected

Optional recorder for diagnostics.

◆ step_size

template<typename V , typename M >
double cpu_mlp::StochasticMinimizer< V, M >::step_size = 0.01
protected

The documentation for this class was generated from the following file: