DiSMEC++
dismec::ConstantWeighting Class Reference

Simple weighting scheme that assigns the same weighting to all label_ids. More...

#include <weighting.h>

Inheritance diagram for dismec::ConstantWeighting:
dismec::WeightingScheme

Public Member Functions

 ConstantWeighting (double positive_cost, double negative_cost)
 
double get_positive_weight (label_id_t label_id) const override
 Gets the weight to use for all examples where the label label_id is present. More...
 
double get_negative_weight (label_id_t label_id) const override
 Gets the weight to use for all examples where the label label_id is absent. More...
 
- Public Member Functions inherited from dismec::WeightingScheme
virtual ~WeightingScheme ()=default
 

Private Attributes

double m_PositiveCost
 Cost to use if the label is present, independent of the label_id. More...
 
double m_NegativeCost
 Cost to use if the label is absent, independent of the label_id. More...
 

Detailed Description

Simple weighting scheme that assigns the same weighting to all label_ids.

This realization of a WeightingScheme only returns two different values, one if the label is there and another if it is not.

Definition at line 46 of file weighting.h.

Constructor & Destructor Documentation

◆ ConstantWeighting()

ConstantWeighting::ConstantWeighting ( double  positive_cost,
double  negative_cost 
)

Definition at line 37 of file weighting.cpp.

Member Function Documentation

◆ get_negative_weight()

double ConstantWeighting::get_negative_weight ( label_id_t  label_id) const
overridevirtual

Gets the weight to use for all examples where the label label_id is absent.

Implements dismec::WeightingScheme.

Definition at line 33 of file weighting.cpp.

References m_NegativeCost.

Referenced by TEST_CASE().

◆ get_positive_weight()

double ConstantWeighting::get_positive_weight ( label_id_t  label_id) const
overridevirtual

Gets the weight to use for all examples where the label label_id is present.

Implements dismec::WeightingScheme.

Definition at line 29 of file weighting.cpp.

References m_PositiveCost.

Referenced by TEST_CASE().

Member Data Documentation

◆ m_NegativeCost

double dismec::ConstantWeighting::m_NegativeCost
private

Cost to use if the label is absent, independent of the label_id.

Definition at line 53 of file weighting.h.

Referenced by get_negative_weight().

◆ m_PositiveCost

double dismec::ConstantWeighting::m_PositiveCost
private

Cost to use if the label is present, independent of the label_id.

Definition at line 52 of file weighting.h.

Referenced by get_positive_weight().


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