DiSMEC++
|
Optimizer that does not change the initial vector. More...
#include <null.h>
Public Member Functions | |
NullOptimizer (bool calc) | |
Constructor, specifies whether to run any calculations at all. More... | |
Public Member Functions inherited from dismec::solvers::Minimizer | |
Minimizer (std::shared_ptr< spdlog::logger > logger={}) | |
~Minimizer () override | |
MinimizationResult | minimize (objective::Objective &objective, Eigen::Ref< DenseRealVector > init) |
void | set_logger (std::shared_ptr< spdlog::logger > logger) |
sets the logger object that is used for progress tracking. More... | |
Public Member Functions inherited from dismec::HyperParameterBase | |
HyperParameterBase ()=default | |
virtual | ~HyperParameterBase ()=default |
HyperParameterBase (const HyperParameterBase &)=default | |
HyperParameterBase (HyperParameterBase &&)=default | |
HyperParameterBase & | operator= (HyperParameterBase &&)=default |
HyperParameterBase & | operator= (const HyperParameterBase &)=default |
void | set_hyper_parameter (const std::string &name, long value) |
void | set_hyper_parameter (const std::string &name, double value) |
hyper_param_t | get_hyper_parameter (const std::string &name) const |
std::vector< std::string > | get_hyper_parameter_names () const |
Returns a vector that lists all hyper parameter names. More... | |
Public Member Functions inherited from dismec::stats::Tracked | |
Tracked () | |
Default constructor, creates the internal stats::StatisticsCollection . More... | |
void | register_stat (const std::string &name, std::unique_ptr< Statistics > stat) |
Registers a tracker for the statistics name . More... | |
std::shared_ptr< StatisticsCollection > | get_stats () const |
Gets an ownership-sharing reference to the StatisticsCollection . More... | |
Private Member Functions | |
MinimizationResult | run (objective::Objective &objective, Eigen::Ref< DenseRealVector > init) override |
Private Attributes | |
DenseRealVector | m_Gradient |
HashVector | m_Weights |
bool | m_CalcLoss |
Additional Inherited Members | |
Public Types inherited from dismec::HyperParameterBase | |
using | hyper_param_t = std::variant< long, double > |
Protected Member Functions inherited from dismec::HyperParameterBase | |
template<class U , class S > | |
void | declare_hyper_parameter (std::string name, U S::*pointer) |
template<class U , class S > | |
void | declare_hyper_parameter (std::string name, U(S::*getter)() const, void(S::*setter)(U)) |
Declares an constrained hyper-parameter with explicit getter and setter function. More... | |
template<class T , class S > | |
void | declare_sub_object (const std::string &name, T S::*object) |
Declares a sub-object that also contains hyper-parameters. More... | |
Protected Member Functions inherited from dismec::stats::Tracked | |
~Tracked () | |
Non-virtual destructor. Declared protected, so we don't accidentally try to do a polymorphic delete. More... | |
template<class T > | |
void | record (stat_id_t stat, T &&value) |
Record statistics. This function just forwards all its arguments to the internal StatisticsCollection . More... | |
void | declare_stat (stat_id_t index, StatisticMetaData meta) |
Declares a new statistics. This function just forwards all its arguments to the internal StatisticsCollection . More... | |
void | declare_tag (tag_id_t index, std::string name) |
Declares a new tag. This function just forwards all its arguments to the internal StatisticsCollection . More... | |
template<class... Args> | |
void | set_tag (tag_id_t tag, long value) |
Set value of tag. This function just forwards all its arguments to the internal StatisticsCollection . More... | |
template<class... Args> | |
auto | make_timer (stat_id_t id, Args... args) |
Creates a new ScopeTimer using stats::record_scope_time . More... | |
Protected Attributes inherited from dismec::solvers::Minimizer | |
std::shared_ptr< spdlog::logger > | m_Logger |
Optimizer that does not change the initial vector.
This class is provided for testing purposes, e.g. to save the model consisting only of the weights given by some initialization strategy. Depending on the setting, this optimizer can either calculate the loss and gradient at the initial point (and thus return a bad, yet sensible MinimizationResult
), or skip the calculation entirely.
NullOptimizer::NullOptimizer | ( | bool | calc | ) |
Constructor, specifies whether to run any calculations at all.
calc | If this is true, then the minimizer calculates the value and gradient of the loss function at the initial point and returns a meaningful MinimizationResult , otherwise these are just set to zero and the minimization is essentially a no-op. |
Definition at line 50 of file null.cpp.
References dismec::stats::Tracked::declare_tag(), and anonymous_namespace{null.cpp}::TAG_ITERATION.
|
overrideprivatevirtual |
Implements dismec::solvers::Minimizer.
Definition at line 26 of file null.cpp.
References dismec::solvers::FAILED, m_CalcLoss, m_Gradient, m_Weights, dismec::stats::Tracked::set_tag(), dismec::solvers::SUCCESS, and anonymous_namespace{null.cpp}::TAG_ITERATION.
|
private |
|
private |
|
private |