/usr/include/shogun/labels/FactorGraphLabels.h is in libshogun-dev 3.2.0-7.3build4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | /*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* Written (W) 2013 Shell Hu
* Copyright (C) 2013 Shell Hu
*/
#ifndef __FACTORGRAPH_LABELS_H__
#define __FACTORGRAPH_LABELS_H__
#include <shogun/labels/StructuredLabels.h>
#include <shogun/lib/SGVector.h>
#include <shogun/lib/StructuredData.h>
#include <shogun/lib/StructuredDataTypes.h>
namespace shogun
{
class CFactorGraphLabels;
/** @brief Class CFactorGraphObservation is used as
* the structured output */
class CFactorGraphObservation : public CStructuredData
{
public:
/** data type */
STRUCTURED_DATA_TYPE(SDT_FACTOR_GRAPH);
/** default constructor */
CFactorGraphObservation() : CStructuredData() { }
/** constructor discrete labeling observation
*
* @param observed_state Discrete labeling of a set of variables.
* @param loss_weights weighted loss for each variable
*/
CFactorGraphObservation(SGVector<int32_t> observed_state,
SGVector<float64_t> loss_weights);
~CFactorGraphObservation() { }
/** helper method used to specialize a base class instance
*
* @param base_data its dynamic type must be CFactorGraphObservation
*/
static CFactorGraphObservation* obtain_from_generic(CStructuredData* base_data)
{
if ( base_data->get_structured_data_type() == SDT_FACTOR_GRAPH )
return (CFactorGraphObservation*) base_data;
else
SG_SERROR("base_data must be of dynamic type CFactorGraphObservation\n")
return NULL;
}
/** @return name of SGSerializable */
virtual const char* get_name() const { return "FactorGraphObservation"; }
/** @return data */
SGVector<int32_t> get_data() const;
/** @return loss weights */
SGVector<float64_t> get_loss_weights() const;
/** set loss weights
*
* @param loss_weights weights for weighted hamming loss
*/
void set_loss_weights(SGVector<float64_t> loss_weights);
protected:
/** loss weights, usually for weighted hamming loss */
SGVector<float64_t> m_loss_weights;
/** ground truth states */
SGVector<int32_t> m_observed_state;
};
/** @brief Class FactorGraphLabels used e.g. in the application of Structured Output
* (SO) learning with the FactorGraphModel. Each of the labels is represented by a
* graph. Each label is of type CFactorGraphObservation and all of them are stored in
* a CDynamicObjectArray. */
class CFactorGraphLabels : public CStructuredLabels
{
public:
/** default constructor */
CFactorGraphLabels();
/** standard constructor
*
* @param num_labels number of labels
*/
CFactorGraphLabels(int32_t num_labels);
/** destructor */
virtual ~CFactorGraphLabels();
/** @return object name */
virtual const char* get_name() const { return "FactorGraphLabels"; }
private:
/** internal initialization */
void init();
}; /* CFactorGraphLabels */
} /* namespace shogun */
#endif /* __FACTORGRAPH_LABELS_H__ */
|