| DiSMEC++
    | 
#include <reg_sq_hinge.h>
 
  
| Public Member Functions | |
| Regularized_SquaredHingeSVC (std::shared_ptr< const GenericFeatureMatrix > X, std::unique_ptr< Objective > regularizer) | |
| const features_t & | features () const | 
| void | gradient_imp (const HashVector &location, Eigen::Ref< DenseRealVector > target) | 
| void | gradient_at_zero_imp (Eigen::Ref< DenseRealVector > target) | 
| void | hessian_times_direction_imp (const HashVector &location, const DenseRealVector &direction, Eigen::Ref< DenseRealVector > target) | 
| void | diag_preconditioner_imp (const HashVector &location, Eigen::Ref< DenseRealVector > target) | 
| void | gradient_and_pre_conditioner_imp (const HashVector &location, Eigen::Ref< DenseRealVector > gradient, Eigen::Ref< DenseRealVector > pre) | 
|  Public Member Functions inherited from dismec::objective::LinearClassifierImpBase< Regularized_SquaredHingeSVC > | |
| LinearClassifierImpBase (std::shared_ptr< const GenericFeatureMatrix > X, std::unique_ptr< Objective > regularizer) | |
|  Public Member Functions inherited from dismec::objective::LinearClassifierBase | |
| LinearClassifierBase (std::shared_ptr< const GenericFeatureMatrix > X) | |
| long | num_instances () const noexcept | 
| long | num_variables () const noexcept override | 
| BinaryLabelVector & | get_label_ref () | 
| void | update_costs (real_t positive, real_t negative) | 
|  Public Member Functions inherited from dismec::objective::Objective | |
| Objective () | |
| virtual | ~Objective () noexcept=default | 
| real_t | value (const HashVector &location) | 
| Evaluate the objective at the given location.  More... | |
| void | diag_preconditioner (const HashVector &location, Eigen::Ref< DenseRealVector > target) | 
| Get precondition to be used in CG optimization.  More... | |
| void | project_to_line (const HashVector &location, const DenseRealVector &direction) | 
| creates a function g such that g(a) = objective(location + a * direction)Uselookup_on_line()to evaluateg.  More... | |
| void | gradient_at_zero (Eigen::Ref< DenseRealVector > target) | 
| Gets the gradient for location zero.  More... | |
| void | gradient (const HashVector &location, Eigen::Ref< DenseRealVector > target) | 
| Evaluate the gradient at location.  More... | |
| void | hessian_times_direction (const HashVector &location, const DenseRealVector &direction, Eigen::Ref< DenseRealVector > target) | 
| Calculates the product of the Hessian matrix at locationwithdirection.  More... | |
| void | gradient_and_pre_conditioner (const HashVector &location, Eigen::Ref< DenseRealVector > gradient, Eigen::Ref< DenseRealVector > pre) | 
| Combines the calculation of gradient and pre-conditioner, which may be more efficient in some cases.  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... | |
| Static Public Member Functions | |
| template<typename OtherDerived > | |
| static real_t | value_from_xTw (const DenseRealVector &cost, const BinaryLabelVector &labels, const Eigen::DenseBase< OtherDerived > &xTw) | 
| Private Types | |
| using | features_t = SparseFeatures | 
| Private Member Functions | |
| void | invalidate_labels () override | 
| void | margin_error (const HashVector &w) | 
| template<class T , class U > | |
| void | gradient_and_pre_conditioner_tpl (const HashVector &location, T &&gradient, U &&pre) | 
| Private Attributes | |
| VectorHash | m_Last_MV | 
| std::vector< int > | m_MVPos | 
| std::vector< real_t > | m_MVVal | 
| Additional Inherited Members | |
|  Protected Member Functions inherited from dismec::objective::LinearClassifierImpBase< Regularized_SquaredHingeSVC > | |
| const Regularized_SquaredHingeSVC & | derived () const | 
| Regularized_SquaredHingeSVC & | derived () | 
| real_t | value_unchecked (const HashVector &location) override | 
| real_t | lookup_on_line (real_t position) override | 
| Looks up the value of the objective on the line defined by the last call to project_to_line().  More... | |
| void | project_to_line_unchecked (const HashVector &location, const DenseRealVector &direction) override | 
| void | gradient_unchecked (const HashVector &location, Eigen::Ref< DenseRealVector > target) override | 
| void | gradient_at_zero_unchecked (Eigen::Ref< DenseRealVector > target) override | 
| void | hessian_times_direction_unchecked (const HashVector &location, const DenseRealVector &direction, Eigen::Ref< DenseRealVector > target) override | 
| void | diag_preconditioner_unchecked (const HashVector &location, Eigen::Ref< DenseRealVector > target) override | 
| void | gradient_and_pre_conditioner_unchecked (const HashVector &location, Eigen::Ref< DenseRealVector > gradient, Eigen::Ref< DenseRealVector > pre) override | 
|  Protected Member Functions inherited from dismec::objective::LinearClassifierBase | |
| const DenseRealVector & | x_times_w (const HashVector &w) | 
| Calculates the vector of feature matrix times weights wMore... | |
| template<class Derived > | |
| void | update_xtw_cache (const HashVector &new_weight, const Eigen::MatrixBase< Derived > &new_result) | 
| Updates the cached value for x_times_w.  More... | |
| void | project_linear_to_line (const HashVector &location, const DenseRealVector &direction) | 
| Prepares the cache variables for line projection.  More... | |
| auto | line_interpolation (real_t t) const | 
| void | declare_vector_on_last_line (const HashVector &location, real_t t) override | 
| State that the given vector corresponds to a certain position on the line of the last line search.  More... | |
| const GenericFeatureMatrix & | generic_features () const | 
| const DenseFeatures & | dense_features () const | 
| const SparseFeatures & | sparse_features () const | 
| const DenseRealVector & | costs () const | 
| const BinaryLabelVector & | labels () const | 
|  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 ScopeTimerusingstats::record_scope_time.  More... | |
Objective for regularized Support Vector classification with Squared Hinge loss. This is for binary labels, multilabel problems can be generated trivially by having l independent Regularized_SquaredHingeSVC objectives. 
Definition at line 21 of file reg_sq_hinge.h.
Definition at line 22 of file reg_sq_hinge.h.
| 
 | explicit | 
Definition at line 23 of file reg_sq_hinge.cpp.
References dismec::stats::Tracked::declare_stat(), features(), and anonymous_namespace{reg_sq_hinge.cpp}::STAT_GRAD_SPARSITY.
| void Regularized_SquaredHingeSVC::diag_preconditioner_imp | ( | const HashVector & | location, | 
| Eigen::Ref< DenseRealVector > | target | ||
| ) | 
Definition at line 46 of file reg_sq_hinge.cpp.
References gradient_and_pre_conditioner_tpl().
| const Regularized_SquaredHingeSVC::features_t & Regularized_SquaredHingeSVC::features | ( | ) | const | 
Definition at line 108 of file reg_sq_hinge.cpp.
References dismec::objective::LinearClassifierBase::sparse_features().
Referenced by gradient_and_pre_conditioner_tpl(), gradient_at_zero_imp(), hessian_times_direction_imp(), and Regularized_SquaredHingeSVC().
| void Regularized_SquaredHingeSVC::gradient_and_pre_conditioner_imp | ( | const HashVector & | location, | 
| Eigen::Ref< DenseRealVector > | gradient, | ||
| Eigen::Ref< DenseRealVector > | pre | ||
| ) | 
Definition at line 51 of file reg_sq_hinge.cpp.
References dismec::objective::Objective::gradient(), and gradient_and_pre_conditioner_tpl().
| 
 | private | 
Definition at line 60 of file reg_sq_hinge.cpp.
References dismec::objective::LinearClassifierBase::costs(), features(), dismec::objective::Objective::gradient(), dismec::objective::LinearClassifierBase::labels(), m_MVPos, m_MVVal, margin_error(), dismec::stats::Tracked::record(), anonymous_namespace{reg_sq_hinge.cpp}::STAT_GRAD_SPARSITY, and dismec::to_long().
Referenced by diag_preconditioner_imp(), gradient_and_pre_conditioner_imp(), and gradient_imp().
| void Regularized_SquaredHingeSVC::gradient_at_zero_imp | ( | Eigen::Ref< DenseRealVector > | target | ) | 
Definition at line 92 of file reg_sq_hinge.cpp.
References dismec::objective::LinearClassifierBase::costs(), features(), and dismec::objective::LinearClassifierBase::labels().
| void Regularized_SquaredHingeSVC::gradient_imp | ( | const HashVector & | location, | 
| Eigen::Ref< DenseRealVector > | target | ||
| ) | 
Definition at line 35 of file reg_sq_hinge.cpp.
References gradient_and_pre_conditioner_tpl().
| void Regularized_SquaredHingeSVC::hessian_times_direction_imp | ( | const HashVector & | location, | 
| const DenseRealVector & | direction, | ||
| Eigen::Ref< DenseRealVector > | target | ||
| ) | 
Definition at line 39 of file reg_sq_hinge.cpp.
References dismec::objective::LinearClassifierBase::costs(), features(), dismec::l2_reg_sq_hinge_detail::htd_sum(), m_MVPos, and margin_error().
| 
 | overrideprivatevirtual | 
This function will be called whenever m_Y changes so that derived classes can invalidate their caches.
Implements dismec::objective::LinearClassifierBase.
Definition at line 112 of file reg_sq_hinge.cpp.
References m_Last_MV.
| 
 | private | 
Definition at line 117 of file reg_sq_hinge.cpp.
References dismec::HashVector::hash(), dismec::objective::LinearClassifierBase::labels(), m_Last_MV, m_MVPos, m_MVVal, and dismec::objective::LinearClassifierBase::x_times_w().
Referenced by gradient_and_pre_conditioner_tpl(), and hessian_times_direction_imp().
| 
 | inlinestatic | 
Definition at line 41 of file reg_sq_hinge.h.
References dismec::objective::LinearClassifierBase::labels().
| 
 | private | 
Definition at line 58 of file reg_sq_hinge.h.
Referenced by invalidate_labels(), and margin_error().
| 
 | private | 
Definition at line 60 of file reg_sq_hinge.h.
Referenced by gradient_and_pre_conditioner_tpl(), hessian_times_direction_imp(), and margin_error().
| 
 | private | 
Definition at line 61 of file reg_sq_hinge.h.
Referenced by gradient_and_pre_conditioner_tpl(), and margin_error().