SHOGUN
v2.0.0
Main Page
Related Pages
Modules
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
src
shogun
transfer
multitask
MultitaskCompositeMachine.h
Go to the documentation of this file.
1
/*
2
* This program is free software; you can redistribute it and/or modify
3
* it under the terms of the GNU General Public License as published by
4
* the Free Software Foundation; either version 3 of the License, or
5
* (at your option) any later version.
6
*
7
* Copyright (C) 2012 Sergey Lisitsyn
8
*/
9
10
#ifndef MULTITASKCOMPOSITEMACHINE_H_
11
#define MULTITASKCOMPOSITEMACHINE_H_
12
13
#include <
shogun/lib/config.h
>
14
#include <
shogun/machine/Machine.h
>
15
#include <
shogun/features/DotFeatures.h
>
16
#include <
shogun/transfer/multitask/TaskRelation.h
>
17
#include <
shogun/transfer/multitask/TaskGroup.h
>
18
#include <
shogun/transfer/multitask/TaskTree.h
>
19
#include <
shogun/transfer/multitask/Task.h
>
20
21
#include <vector>
22
#include <set>
23
24
using namespace
std;
25
26
namespace
shogun
27
{
32
class
CMultitaskCompositeMachine
:
public
CMachine
33
{
34
35
public
:
36
MACHINE_PROBLEM_TYPE
(
PT_BINARY
)
37
38
39
CMultitaskCompositeMachine
();
40
48
CMultitaskCompositeMachine
(
49
CMachine
* machine,
CFeatures
* training_data,
50
CLabels
* training_labels,
CTaskGroup
* task_group);
51
53
virtual
~
CMultitaskCompositeMachine
();
54
56
virtual
const
char
* get_name()
const
57
{
58
return
"MultitaskCompositeMachine"
;
59
}
60
64
int32_t get_current_task()
const
;
65
69
void
set_current_task(int32_t task);
70
74
CTaskGroup
* get_task_group()
const
;
75
79
void
set_task_group(
CTaskGroup
* task_group);
80
82
virtual
bool
supports_locking
()
const
{
return
true
; }
83
85
virtual
void
post_lock(
CLabels
* labels,
CFeatures
* features);
86
88
virtual
bool
train_locked(
SGVector<index_t>
indices);
89
91
virtual
CBinaryLabels
* apply_locked_binary(
SGVector<index_t>
indices);
92
97
virtual
inline
void
set_features(
CFeatures
* features)
98
{
99
SG_REF
(features);
100
SG_UNREF
(m_features);
101
m_features = features;
102
}
103
108
virtual
CFeatures
* get_features()
const
109
{
110
SG_REF
(m_features);
111
return
m_features;
112
}
113
118
virtual
void
set_machine(
CMachine
* machine)
119
{
120
SG_REF
(machine);
121
SG_UNREF
(m_machine);
122
m_machine = machine;
123
}
124
129
virtual
CMachine
* get_machine()
const
130
{
131
SG_REF
(m_machine);
132
return
m_machine;
133
}
134
136
virtual
float64_t
apply_one(int32_t vec_idx);
137
138
protected
:
139
141
virtual
bool
train_machine(
CFeatures
* data=NULL);
142
143
private
:
144
146
void
register_parameters();
147
148
protected
:
149
151
CMachine
*
m_machine
;
152
154
CFeatures
*
m_features
;
155
157
int32_t
m_current_task
;
158
160
CTaskGroup
*
m_task_group
;
161
163
CDynamicObjectArray
*
m_task_machines
;
164
166
vector< set<index_t> >
m_tasks_indices
;
167
168
};
169
}
170
#endif
SHOGUN
Machine Learning Toolbox - Documentation