SHOGUN
v1.1.0
Main Page
Related Pages
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
shogun
ui
GUILabels.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
* Written (W) 1999-2008 Soeren Sonnenburg
8
* Copyright (C) 1999-2008 Fraunhofer Institute FIRST and Max-Planck-Society
9
*/
10
11
#include <
shogun/ui/GUILabels.h
>
12
#include <
shogun/ui/SGInterface.h
>
13
14
#include <
shogun/lib/config.h
>
15
#include <
shogun/io/SGIO.h
>
16
#include <
shogun/io/AsciiFile.h
>
17
#include <
shogun/features/Labels.h
>
18
19
#include <string.h>
20
21
using namespace
shogun;
22
23
CGUILabels::CGUILabels
(CSGInterface* ui_)
24
:
CSGObject
(), ui(ui_), train_labels(NULL), test_labels(NULL)
25
{
26
}
27
28
CGUILabels::~CGUILabels
()
29
{
30
SG_UNREF
(
train_labels
);
31
SG_UNREF
(
test_labels
);
32
}
33
34
bool
CGUILabels::load
(
char
* filename,
char
* target)
35
{
36
CLabels
* labels=NULL;
37
38
if
(strncmp(target,
"TEST"
, 4)==0)
39
labels=
test_labels
;
40
else
if
(strncmp(target,
"TRAIN"
, 5)==0)
41
labels=
train_labels
;
42
else
43
SG_ERROR
(
"Invalid target %s.\n"
, target);
44
45
if
(labels)
46
{
47
SG_UNREF
(labels);
48
CAsciiFile
* file=
new
CAsciiFile
(filename);
49
labels=
new
CLabels
(file);
50
51
if
(labels)
52
{
53
if
(strncmp(target,
"TEST"
, 4)==0)
54
set_test_labels
(labels);
55
else
56
set_train_labels
(labels);
57
58
return
true
;
59
}
60
else
61
SG_ERROR
(
"Loading labels failed.\n"
);
62
63
SG_UNREF
(file);
64
}
65
66
return
false
;
67
}
68
69
bool
CGUILabels::save
(
char
* param)
70
{
71
bool
result=
false
;
72
return
result;
73
}
SHOGUN
Machine Learning Toolbox - Documentation