shark::SteepestDescent< SearchPointType > Class Template Reference

Standard steepest descent. More...

#include <shark/Algorithms/GradientDescent/SteepestDescent.h>

+ Inheritance diagram for shark::SteepestDescent< SearchPointType >:

Public Types

typedef AbstractObjectiveFunction< SearchPointType, double > ObjectiveFunctionType
 
- Public Types inherited from shark::AbstractSingleObjectiveOptimizer< PointType >
typedef base_type::SearchPointType SearchPointType
 
typedef base_type::SolutionType SolutionType
 
typedef base_type::ResultType ResultType
 
typedef base_type::ObjectiveFunctionType ObjectiveFunctionType
 
- Public Types inherited from shark::AbstractOptimizer< PointType, double, SingleObjectiveResultSet< PointType > >
enum  Feature
 Models features that the optimizer requires from the objective function. More...
 
typedef PointType SearchPointType
 
typedef double ResultType
 
typedef SingleObjectiveResultSet< PointType > SolutionType
 
typedef AbstractObjectiveFunction< PointType, ResultTypeObjectiveFunctionType
 
typedef TypedFlags< FeatureFeatures
 
typedef TypedFeatureNotAvailableException< FeatureFeatureNotAvailableException
 

Public Member Functions

 SteepestDescent ()
 
std::string name () const
 From INameable: return the class name.
 
void init (ObjectiveFunctionType const &objectiveFunction, SearchPointType const &startingPoint)
 
double learningRate () const
 get learning rate
 
void setLearningRate (double learningRate)
 set learning rate
 
double momentum () const
 get momentum parameter
 
void setMomentum (double momentum)
 set momentum parameter
 
void step (ObjectiveFunctionType const &objectiveFunction)
 updates searchdirection and then does simple gradient descent
 
virtual void read (InArchive &archive)
 Read the component from the supplied archive.
 
virtual void write (OutArchive &archive) const
 Write the component to the supplied archive.
 
- Public Member Functions inherited from shark::AbstractSingleObjectiveOptimizer< PointType >
std::size_t numInitPoints () const
 By default most single objective optimizers only require a single point.
 
virtual void init (ObjectiveFunctionType const &function, std::vector< SearchPointType > const &initPoints)
 Initialize the optimizer for the supplied objective function using a set of initialisation points.
 
virtual void init (ObjectiveFunctionType const &function, SearchPointType const &startingPoint)=0
 initializes the optimizer using a predefined starting point
 
virtual const SolutionTypesolution () const
 returns the current solution of the optimizer
 
- Public Member Functions inherited from shark::AbstractOptimizer< PointType, double, SingleObjectiveResultSet< PointType > >
const Featuresfeatures () const
 
virtual void updateFeatures ()
 
bool requiresValue () const
 
bool requiresFirstDerivative () const
 
bool requiresSecondDerivative () const
 
bool canSolveConstrained () const
 
bool requiresClosestFeasible () const
 
virtual ~AbstractOptimizer ()
 
virtual void init (ObjectiveFunctionType const &function)
 Initialize the optimizer for the supplied objective function.
 
virtual void step (ObjectiveFunctionType const &function)=0
 Carry out one step of the optimizer for the supplied objective function.
 
- Public Member Functions inherited from shark::INameable
virtual ~INameable ()
 
- Public Member Functions inherited from shark::ISerializable
virtual ~ISerializable ()
 Virtual d'tor.
 
void load (InArchive &archive, unsigned int version)
 Versioned loading of components, calls read(...).
 
void save (OutArchive &archive, unsigned int version) const
 Versioned storing of components, calls write(...).
 
 BOOST_SERIALIZATION_SPLIT_MEMBER ()
 

Additional Inherited Members

- Protected Member Functions inherited from shark::AbstractOptimizer< PointType, double, SingleObjectiveResultSet< PointType > >
void checkFeatures (ObjectiveFunctionType const &objectiveFunction)
 Convenience function that checks whether the features of the supplied objective function match with the required features of the optimizer.
 
- Protected Attributes inherited from shark::AbstractSingleObjectiveOptimizer< PointType >
SolutionType m_best
 Current solution of the optimizer.
 
- Protected Attributes inherited from shark::AbstractOptimizer< PointType, double, SingleObjectiveResultSet< PointType > >
Features m_features
 

Detailed Description

template<class SearchPointType = RealVector>
class shark::SteepestDescent< SearchPointType >

Standard steepest descent.

Definition at line 44 of file SteepestDescent.h.

Member Typedef Documentation

◆ ObjectiveFunctionType

template<class SearchPointType = RealVector>
typedef AbstractObjectiveFunction<SearchPointType,double> shark::SteepestDescent< SearchPointType >::ObjectiveFunctionType

Definition at line 47 of file SteepestDescent.h.

Constructor & Destructor Documentation

◆ SteepestDescent()

Member Function Documentation

◆ init()

◆ learningRate()

template<class SearchPointType = RealVector>
double shark::SteepestDescent< SearchPointType >::learningRate ( ) const
inline

get learning rate

Definition at line 73 of file SteepestDescent.h.

Referenced by shark::SteepestDescent< SearchPointType >::setLearningRate().

◆ momentum()

template<class SearchPointType = RealVector>
double shark::SteepestDescent< SearchPointType >::momentum ( ) const
inline

get momentum parameter

Definition at line 87 of file SteepestDescent.h.

Referenced by shark::SteepestDescent< SearchPointType >::setMomentum().

◆ name()

template<class SearchPointType = RealVector>
std::string shark::SteepestDescent< SearchPointType >::name ( ) const
inlinevirtual

From INameable: return the class name.

Reimplemented from shark::INameable.

Definition at line 56 of file SteepestDescent.h.

◆ read()

template<class SearchPointType = RealVector>
virtual void shark::SteepestDescent< SearchPointType >::read ( InArchive archive)
inlinevirtual

Read the component from the supplied archive.

Parameters
[in,out]archiveThe archive to read from.

Reimplemented from shark::ISerializable.

Definition at line 105 of file SteepestDescent.h.

◆ setLearningRate()

template<class SearchPointType = RealVector>
void shark::SteepestDescent< SearchPointType >::setLearningRate ( double  learningRate)
inline

set learning rate

Definition at line 80 of file SteepestDescent.h.

References shark::SteepestDescent< SearchPointType >::learningRate().

Referenced by main(), and trainRBM().

◆ setMomentum()

template<class SearchPointType = RealVector>
void shark::SteepestDescent< SearchPointType >::setMomentum ( double  momentum)
inline

set momentum parameter

Definition at line 94 of file SteepestDescent.h.

References shark::SteepestDescent< SearchPointType >::momentum().

Referenced by main().

◆ step()

◆ write()

template<class SearchPointType = RealVector>
virtual void shark::SteepestDescent< SearchPointType >::write ( OutArchive archive) const
inlinevirtual

Write the component to the supplied archive.

Parameters
[in,out]archiveThe archive to write to.

Reimplemented from shark::ISerializable.

Definition at line 112 of file SteepestDescent.h.


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