SHOGUN  4.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
TaskGroup.cpp
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 
11 
12 using namespace shogun;
13 
15 {
16  init();
17 }
18 
20 {
22 }
23 
24 void CTaskGroup::init()
25 {
26  m_tasks = new CDynamicObjectArray(true);
27 }
28 
30 {
31  m_tasks->append_element(task);
32 }
33 
35 {
36  return m_tasks->get_num_elements();
37 }
38 
40 {
41  int32_t n_tasks = m_tasks->get_num_elements();
42  SG_DEBUG("Number of tasks = %d\n", n_tasks)
43 
44  SGVector<index_t>* tasks_indices = SG_MALLOC(SGVector<index_t>, n_tasks);
45  for (int32_t i=0; i<n_tasks; i++)
46  {
47  CTask* task = (CTask*)m_tasks->get_element(i);
48  tasks_indices[i] = task->get_indices();
49  SG_UNREF(task);
50  }
51 
52  return tasks_indices;
53 }
class Task used to represent tasks in multitask learning. Essentially it represent a set of feature v...
Definition: Task.h:27
virtual ~CTaskGroup()
Definition: TaskGroup.cpp:19
CDynamicObjectArray * m_tasks
Definition: TaskGroup.h:76
SGVector< index_t > get_indices() const
Definition: Task.h:63
Dynamic array class for CSGObject pointers that creates an array that can be used like a list or an a...
void append_task(CTask *task)
Definition: TaskGroup.cpp:29
#define SG_UNREF(x)
Definition: SGObject.h:52
#define SG_DEBUG(...)
Definition: SGIO.h:107
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
virtual int32_t get_num_tasks() const
Definition: TaskGroup.cpp:34
CSGObject * get_element(int32_t index) const
used to represent tasks in multitask learning
Definition: TaskRelation.h:31
virtual SGVector< index_t > * get_tasks_indices() const
Definition: TaskGroup.cpp:39
bool append_element(CSGObject *e)

SHOGUN Machine Learning Toolbox - Documentation