Turi Create
4.0
|
#include <ml/optimization/optimization_interface.hpp>
Public Member Functions | |
virtual | ~first_order_opt_interface () |
virtual size_t | num_examples () const =0 |
virtual size_t | num_variables () const =0 |
virtual void | compute_first_order_statistics (const DenseVector &point, DenseVector &gradient, double &function_value, const size_t mbStart=0, const size_t mbSize=-1)=0 |
virtual double | compute_function_value (const DenseVector &point, const size_t mbStart=0, const size_t mbSize=-1) |
virtual void | compute_gradient (const DenseVector &point, DenseVector &gradient, const size_t mbStart=0, const size_t mbSize=-1) |
virtual void | reset (int seed) |
virtual std::vector< std::pair< std::string, size_t > > | get_status_header (const std::vector< std::string > &stats) |
virtual std::vector< std::string > | get_status (const DenseVector &coefs, const std::vector< std::string > &stats) |
The interface to inherit from to describe a first order optimization model.
This model must implement methods to compute mini-batch gradient, and function value.
Definition at line 141 of file optimization_interface.hpp.
|
virtual |
Default desctuctor.
|
pure virtual |
Compute first order statistics at the given point. (Gradient & Function value)
[in] | point | Point at which we are computing the stats. |
[out] | gradient | Dense gradient |
[out] | function_value | Function value |
[in] | mbStart | Minibatch start index |
[in] | mbSize | Minibatch size (-1 implies all) |
Implemented in turi::supervised::linear_svm_scaled_logistic_opt_interface, turi::supervised::logistic_regression_opt_interface, and turi::supervised::linear_regression_opt_interface.
|
virtual |
Compute the function value at a given point.
[in] | point | Point at which we are computing the gradient. |
[in] | mbStart | Minibatch start index |
[in] | mbSize | Minibatch size (-1 implies all) |
|
virtual |
Compute a gradient at the given point.
[in] | point | Point at which we are computing the gradient. |
[out] | gradient | Dense gradient |
[in] | mbStart | Minibatch start index |
[in] | mbSize | Minibatch size (-1 implies all) |
|
virtual |
Get strings needed to print a row of the progress table.
[in] | a | vector of model coefficients. |
[in] | a | vector of stats to print at the beginning of each row |
Reimplemented in turi::supervised::logistic_regression_opt_interface, turi::supervised::linear_svm_scaled_logistic_opt_interface, and turi::supervised::linear_regression_opt_interface.
|
virtual |
Get strings needed to print the header for the progress table.
[in] | a | vector of strings to print at the beginning of the header. |
Reimplemented in turi::supervised::logistic_regression_opt_interface, turi::supervised::linear_svm_scaled_logistic_opt_interface, and turi::supervised::linear_regression_opt_interface.
|
pure virtual |
Get the number of examples in the dataset (Required for SGD).
Implemented in turi::supervised::linear_svm_scaled_logistic_opt_interface, turi::supervised::logistic_regression_opt_interface, and turi::supervised::linear_regression_opt_interface.
|
pure virtual |
Get the number of variables in the optimization problem.
Implemented in turi::supervised::linear_svm_scaled_logistic_opt_interface, turi::supervised::logistic_regression_opt_interface, and turi::supervised::linear_regression_opt_interface.
|
virtual |
Reset the state of the model's "randomness" source.
[in] | seed | Seed that is the source of randomness. |