mixmod  3.2.0
Mixture models for clustering and classification
 All Classes Namespaces Files Functions Variables Enumerations Friends
Input.h
1 /***************************************************************************
2  SRC/mixmod/Kernel/IO/Input.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 XEMINPUT_H
26 #define XEMINPUT_H
27 
28 #include "mixmod/Utilities/Util.h"
29 #include "mixmod/Kernel/IO/DataDescription.h"
30 
31 namespace XEM {
32 
33 // pre-declaration
34 class LabelDescription;
35 class Partition;
36 
44 class Input {
45 
46 public:
47 
49  Input();
50 
52  Input(const Input & input);
53 
55  Input(const std::vector<int64_t> & iNbCluster, const DataDescription & iDataDescription);
56 
58  void cloneInitialisation(const std::vector<int64_t> & iNbCluster, const DataDescription & iDataDescription);
59 
60  // Constructor used in DCV context
61  Input(Input * originalInput, CVBlock & learningBlock);
62 
64  virtual ~Input();
65 
66 
67  //----------------------------
68  // Modifiers
69  //----------------------------
70 
71 
72  //------ Sample ----//
74  int64_t getNbSample() const;
75 
76 
77  //------ Dimension ----//
79  int64_t getPbDimension() const;
80 
81 
82  //------ nbCluster ----//
84  std::vector<int64_t> getNbCluster() const;
85 
87  int64_t getNbCluster(int64_t index) const;
88 
90  int64_t getNbClusterSize() const;
91 
92 
93  //------ Criterion ----//
95  std::vector <CriterionName> const & getCriterionName() const;
96 
98  int64_t getNbCriterion() const;
99 
101  CriterionName getCriterionName(unsigned int index) const;
102 
104  virtual void setCriterion(std::vector<CriterionName> const & criterionName) = 0;
105 
107  virtual void setCriterion(const CriterionName criterion, unsigned int index) = 0;
108 
110  virtual void insertCriterion(const CriterionName criterion, unsigned int index) = 0;
111 
112  // add new criterion
113  virtual void addCriterion(const CriterionName criterion) = 0;
114 
116  void removeCriterion(unsigned int index);
117 
118 
119  // ----- ModelType ----//
121  std::vector<ModelType*> getModelType() const;
122 
124  /*virtual*/ void setModelType(const ModelType * modelType, unsigned int index);
125 
127  /*virtual*/ void insertModelType(const ModelType * modelType, unsigned int index);
128 
130  /*virtual*/ void addModelType(const ModelType * modelType);
131 
133  void removeModelType(unsigned int index);
134 
136  /*virtual*/ void addModel(ModelName const modelName);
137 
139  /*virtual*/ void setModel(std::vector<ModelName> const & modelName);
140 
141 
143  // void setSubDimensionEqual(int64_t modelTypePosition, int64_t subDimensionValue);
144 
146  // void setSubDimensionFree(int64_t modelTypePosition, int64_t subDimensionValue, int64_t dimensionPosition);
147 
149  void setWeight(std::string weightFileName);
150 
152  void setWeight(double* weight);
153 
155  void removeWeight();
156 
158  void insertWeight(std::string weightFileName);
159 
161  //void removeWeight();
162 
163 
164  // ----- KnownPartition ----//
166  Partition * getKnownPartition() const;
167 
169  void setKnownPartition(std::string iFileName);
170 
172  void insertKnownPartition(std::string iFileName);
173 
175  void removeKnownPartition();
176 
177 
178  //------- KnownLabel -----------//
181 
183  void setKnownLabelDescription(LabelDescription & labeldescription);
184 
187 
189  const DataType getDataType() const;
190 
191  // finalize
192  void finalize();
193 
195  const DataDescription & getDataDescription() const;
196 
198  Data * getData() const;
199 
200  bool isFinalized() const;
201 
202  // print input
203  virtual void edit(std::ostream & out) const;
204 
205 protected:
206 
207  //---------
209  virtual bool verif();
210 
211  // Criterion
212  std::vector <CriterionName> _criterionName;
213 
214  // ModelType
215  std::vector <ModelType*> _modelType;
216 
219  bool _finalized;
220 
221 private:
222 
224  DataDescription _dataDescription;
225 
226  // Known Partition
227  Partition * _knownPartition;
228  LabelDescription * _knownLabelDescription;
229 
230  // Number of samples (no reduced data)
231  int64_t _nbSample;
232 
233  // Problem dimension
234  int64_t _pbDimension;
235 
236  // nbCluster
237  std::vector<int64_t> _nbCluster;
238 };
239 
240 inline int64_t Input::getNbSample() const {
241  return _nbSample;
242 }
243 
244 inline int64_t Input::getPbDimension() const {
245  return _pbDimension;
246 }
247 
248 inline std::vector<int64_t> Input::getNbCluster() const {
249  return _nbCluster;
250 }
251 
252 inline int64_t Input::getNbCluster(int64_t index) const {
253  return _nbCluster[index];
254 }
255 
256 inline int64_t Input::getNbClusterSize() const {
257  return _nbCluster.size();
258 }
259 
260 inline int64_t Input::getNbCriterion() const {
261  return _criterionName.size();
262 }
263 
264 inline std::vector<ModelType*> Input::getModelType() const {
265  return _modelType;
266 }
267 
269  return _knownPartition;
270 }
271 
273  return _knownLabelDescription;
274 }
275 
276 inline const DataType Input::getDataType() const {
277  return _dataDescription.getDataType();
278 }
279 
280 inline bool Input::isFinalized() const {
281  return _finalized;
282 }
283 
285  return _dataDescription;
286 }
287 
288 inline Data * Input::getData() const {
289  return _dataDescription.getData();
290 }
291 
292 inline std::vector<CriterionName> const & Input::getCriterionName() const {
293  return _criterionName;
294 }
295 
296 }
297 
298 #endif
const DataType getDataType() const
isBinaryData
Definition: Input.h:276
std::vector< ModelType * > getModelType() const
get ModelType vector
Definition: Input.h:264
std::vector< CriterionName > const & getCriterionName() const
get All Criterion Name
Definition: Input.h:292
virtual ~Input()
Destructor.
Definition: Input.cpp:136
void insertModelType(const ModelType *modelType, unsigned int index)
insertModelType
Definition: Input.cpp:211
Definition: LabelDescription.h:43
int64_t getNbCriterion() const
getNbCriterionName
Definition: Input.h:260
Base class for ModelType(s)
Definition: ModelType.h:37
virtual void setCriterion(std::vector< CriterionName > const &criterionName)=0
setCriterionName
void setKnownLabelDescription(LabelDescription &labeldescription)
setKnownLabelDescription
Definition: Input.cpp:353
ModelName
Enumeration of model name.
Definition: Util.h:403
const DataDescription & getDataDescription() const
get Data Description
Definition: Input.h:284
virtual void insertCriterion(const CriterionName criterion, unsigned int index)=0
insertCriterionName[i]
void setKnownPartition(std::string iFileName)
setKnownPartition
Definition: Input.cpp:308
void addModelType(const ModelType *modelType)
add new model type (at the end)
Definition: Input.cpp:223
XEMCVBlock.
Definition: Util.h:393
void setModelType(const ModelType *modelType, unsigned int index)
setModelType
Definition: Input.cpp:198
void setWeight(std::string weightFileName)
setSubDimensionEqual
Definition: Input.cpp:279
std::vector< int64_t > getNbCluster() const
get all NbCluster
Definition: Input.h:248
Base class for Partition(s)
Definition: Partition.h:39
CriterionName
Enumeration of Criterion type.
Definition: Util.h:303
void removeModelType(unsigned int index)
removeModelType
Definition: Input.cpp:262
int64_t getNbSample() const
getNbSample
Definition: Input.h:240
const Sample ** getData() const
getMatrix
Definition: Data.h:165
int64_t getPbDimension() const
getPbDimension
Definition: Input.h:244
void removeWeight()
removeWeight();
Definition: Input.cpp:298
Constants definitions, various utilities to describe models, and others...
void setModel(std::vector< ModelName > const &modelName)
setModel (modelName -> modelType)
Definition: Input.cpp:186
Data * getData() const
get Data
Definition: Input.h:288
virtual bool verif()
verification of inputs validity
Definition: Input.cpp:378
int64_t getNbClusterSize() const
get NbCluster size
Definition: Input.h:256
void removeKnownPartition()
removeKnownPartition
Definition: Input.cpp:346
Input()
Default Constructor.
Definition: Input.cpp:37
Base class for Data.
Definition: Data.h:43
Definition: Input.h:44
void removeKnownLabelDescription()
removeLabel
Definition: Input.cpp:359
Partition * getKnownPartition() const
removeWeight();
Definition: Input.h:268
void insertWeight(std::string weightFileName)
insertWeight();
Definition: Input.cpp:292
const LabelDescription * getKnownLabelDescription() const
getKnownLabelDescription
Definition: Input.h:272
void addModel(ModelName const modelName)
add new model (modelName -> modelType)
Definition: Input.cpp:242
void insertKnownPartition(std::string iFileName)
insertKnownPartition
Definition: Input.cpp:327
void removeCriterion(unsigned int index)
removeCriterionName
Definition: Input.cpp:172
void cloneInitialisation(const std::vector< int64_t > &iNbCluster, const DataDescription &iDataDescription)
clone initialisation
Definition: Input.cpp:88
Definition: DataDescription.h:45