This file is indexed.

/usr/include/shogun/machine/MulticlassMachine.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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
/*
 * 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) 1999-2011 Soeren Sonnenburg
 * Written (W) 2012 Fernando José Iglesias García and Sergey Lisitsyn
 * Written (W) 2013 Shell Hu and Heiko Strathmann
 * Copyright (C) 2012 Sergey Lisitsyn, Fernando José Iglesias Garcia
 */

#ifndef _MULTICLASSMACHINE_H___
#define _MULTICLASSMACHINE_H___

#include <shogun/machine/BaseMulticlassMachine.h>
#include <shogun/lib/DynamicObjectArray.h>
#include <shogun/multiclass/MulticlassStrategy.h>
#include <shogun/labels/MulticlassLabels.h>
#include <shogun/labels/MulticlassMultipleOutputLabels.h>

namespace shogun
{

class CFeatures;
class CLabels;

/** @brief experimental abstract generic multiclass machine class */
class CMulticlassMachine : public CBaseMulticlassMachine
{
	public:
		/** default constructor  */
		CMulticlassMachine();

		/** standard constructor
		 * @param strategy multiclass strategy
		 * @param machine machine
		 * @param labels labels
		 */
		CMulticlassMachine(CMulticlassStrategy* strategy, CMachine* machine, CLabels* labels);

		/** destructor */
		virtual ~CMulticlassMachine();

		/** set labels
		 *
		 * @param lab labels
		 */
		virtual void set_labels(CLabels* lab);

		/** set machine
		 *
		 * @param num index of machine
		 * @param machine machine to set
		 * @return if setting was successful
		 */
		inline bool set_machine(int32_t num, CMachine* machine)
		{
			ASSERT(num<m_machines->get_num_elements() && num>=0)
			if (machine != NULL && !is_acceptable_machine(machine))
				SG_ERROR("Machine %s is not acceptable by %s", machine->get_name(), this->get_name())

			m_machines->set_element(machine, num);
			return true;
		}

		/** get machine
		 *
		 * @param num index of machine to get
		 * @return SVM at number num
		 */
		inline CMachine* get_machine(int32_t num) const
		{
			return (CMachine*) m_machines->get_element_safe(num);
		}

		/** get outputs of i-th submachine
		 * @param i number of submachine
		 * @return outputs
		 */
		virtual CBinaryLabels* get_submachine_outputs(int32_t i);

		/** get output of i-th submachine for num-th vector
		 * @param i number of submachine
		 * @param num number of feature vector
		 * @return output
		 */
		virtual float64_t get_submachine_output(int32_t i, int32_t num);

		/** classify all examples
		 *
		 * @return resulting labels
		 */
		virtual CMulticlassLabels* apply_multiclass(CFeatures* data=NULL);

		/** classify all examples with multiple output
		 *
		 * @return resulting labels
		 */
		virtual CMulticlassMultipleOutputLabels* apply_multiclass_multiple_output(CFeatures* data=NULL, int32_t n_outputs=5);

		/** classify one example
		 * @param vec_idx
		 * @return label
		 */
		virtual float64_t apply_one(int32_t vec_idx);

		/** get the type of multiclass'ness
		 *
		 * @return multiclass type one vs one etc
		 */
		inline CMulticlassStrategy* get_multiclass_strategy() const
		{
			SG_REF(m_multiclass_strategy);
			return m_multiclass_strategy;
		}

		/** returns rejection strategy
		 *
		 * @return rejection strategy
		 */
		inline CRejectionStrategy* get_rejection_strategy() const
		{
			return m_multiclass_strategy->get_rejection_strategy();
		}

		/** sets rejection strategy
		 *
		 * @param rejection_strategy rejection strategy to be set
		 */
		inline void set_rejection_strategy(CRejectionStrategy* rejection_strategy)
		{
			m_multiclass_strategy->set_rejection_strategy(rejection_strategy);
		}

		/** get name */
		virtual const char* get_name() const
		{
			return "MulticlassMachine";
		}

		/** get prob output heuristic of multiclass strategy */
		inline EProbHeuristicType get_prob_heuris()
		{
			return m_multiclass_strategy->get_prob_heuris_type();
		}

		/** set prob output heuristic of multiclass strategy
		 * @param prob_heuris type of probability heuristic
		 */
		inline void set_prob_heuris(EProbHeuristicType prob_heuris)
		{
			m_multiclass_strategy->set_prob_heuris_type(prob_heuris);
		}

	protected:
		/** init strategy */
		void init_strategy();

		/** clear machines */
		void clear_machines();

		/** train machine */
		virtual bool train_machine(CFeatures* data = NULL);

		/** abstract init machine for training method */
		virtual bool init_machine_for_train(CFeatures* data) = 0;

		/** abstract init machines for applying method */
		virtual bool init_machines_for_apply(CFeatures* data) = 0;

		/** check whether machine is ready */
		virtual bool is_ready() = 0;

		/** obtain machine from trained one */
		virtual CMachine* get_machine_from_trained(CMachine* machine) = 0;

		/** get num rhs vectors */
		virtual int32_t get_num_rhs_vectors() = 0;

		/** set subset to the features of the machine, deletes old one
		 *
		 * @param subset subset indices to set
		 */
		virtual void add_machine_subset(SGVector<index_t> subset) = 0;

		/** deletes any subset set to the features of the machine */
		virtual void remove_machine_subset() = 0;

		/** whether the machine is acceptable in set_machine */
		virtual bool is_acceptable_machine(CMachine *machine)
		{
			return true;
		}

	private:

		/** register parameters */
		void register_parameters();

	protected:
		/** type of multiclass strategy */
		CMulticlassStrategy *m_multiclass_strategy;

		/** machine */
		CMachine* m_machine;
};
}
#endif