mixmod  3.2.0
Mixture models for clustering and classification
 All Classes Namespaces Files Functions Variables Enumerations Friends
Label.h
1 /***************************************************************************
2  SRC/mixmod/Kernel/IO/Label.h description
3  copyright : (C) MIXMOD Team - 2001-2016
4  email : contact@mixmod.org
5  ***************************************************************************/
6 
7 /***************************************************************************
8  This file is part of MIXMOD
9 
10  MIXMOD is free software: you can redistribute it and/or modify
11  it under the terms of the GNU General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  MIXMOD is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with MIXMOD. If not, see <http://www.gnu.org/licenses/>.
22 
23  All informations available on : http://www.mixmod.org
24 ***************************************************************************/
25 #ifndef XEMLabel_H
26 #define XEMLabel_H
27 
32 #include <iostream>
33 #include <vector>
34 #include <stdint.h>
35 
36 namespace XEM {
37 
38 // pre-declaration
39 class Model;
40 class LabelDescription;
41 
48 class Label {
49 
50 public:
51 
53  Label();
54 
56  Label(int64_t nbSample);
57 
59  Label(Model * model);
60 
61  Label(const Label & iLabel);
62 
64  virtual ~Label();
65 
67  bool operator ==(const Label & label) const;
68 
70  void edit(std::ostream & stream) const;
71 
73  int64_t * getTabLabel() const;
74 
76  std::vector<int64_t> const & getLabel() const;
77 
79  void setLabel(int64_t * label, int64_t nbSample);
80  void setLabel(std::vector<int64_t> label, int64_t nbSample);
81 
83  int64_t getNbSample() const;
84 
85  // get Error Rate
86  const double getErrorRate(std::vector<int64_t> const & label) const;
87 
88  // get getClassificationTab
89  int64_t** getClassificationTab(std::vector<int64_t> const & label, int64_t nbCluster) const;
90 
92  void input(std::ifstream & flux, int64_t nbCluster);
93  void input(const LabelDescription & labelDescription);
94 
95 private:
96 
98  int64_t _nbSample;
99 
100  std::vector<int64_t> _label;
101 
102 };
103 
104 inline std::vector<int64_t> const & Label::getLabel() const {
105  return _label;
106 }
107 
108 inline int64_t Label::getNbSample() const {
109  return _nbSample;
110 }
111 
112 inline void Label::setLabel(std::vector<int64_t> label, int64_t nbSample) {
113  _nbSample = nbSample;
114  _label = label;
115 }
116 
117 }
118 
119 #endif
void input(std::ifstream &flux, int64_t nbCluster)
input stream
Definition: Label.cpp:213
virtual ~Label()
Destructor.
Definition: Label.cpp:134
Definition: LabelDescription.h:43
bool operator==(const Label &label) const
Comparison operator.
Definition: Label.cpp:140
std::vector< int64_t > const & getLabel() const
get label
Definition: Label.h:104
int64_t * getTabLabel() const
get label
Definition: Label.cpp:161
Definition: Label.h:48
void edit(std::ostream &stream) const
edit labels
Definition: Label.cpp:151
Definition: Model.h:50
void setLabel(int64_t *label, int64_t nbSample)
set Label
Label()
Default constructor.
Definition: Label.cpp:38
int64_t getNbSample() const
Selector.
Definition: Label.h:108