Main Page · Modules · All Classes · Class Hierarchy
MAClassifierSamples.hpp
1 /*
2  * This file is part of the AiBO+ project
3  *
4  * Copyright (C) 2005-2016 Csaba Kertész (csaba.kertesz@gmail.com)
5  *
6  * AiBO+ is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * AiBO+ is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
19  *
20  */
21 
22 #pragma once
23 
24 #include "core/MACoreTypes.hpp"
25 
26 #include <MCDefs.hpp>
27 
28 #include <boost/shared_ptr.hpp>
29 
31 class MCBinaryData;
32 
38 namespace MA
39 {
41 typedef boost::shared_ptr<MAClassifierSamples> ClassifierSamplesSPtr;
42 }
43 
48 {
49 public:
52 
60  const MC::FloatTable& GetFeatureVectors() const;
61 
69  const MC::FloatList& GetLabels() const;
70 
79  void AddSample(const MC::FloatList& feature_vector, float label);
80 
89  void AddSamples(const MC::FloatTable& feature_vectors, const MC::FloatList& labels);
90 
98  void RemoveSample(unsigned int index);
99 
107  MCBinaryData* Encode() const;
108 
118  static MAClassifierSamples* Decode(const MCBinaryData& data);
119 
129  static MAClassifierSamples* LoadFromFile(const std::string& file_name);
130 
140  bool SaveToFile(const std::string& file_name) const;
141 
142 protected:
144  MC::FloatTable FeatureVectors;
146  MC::FloatList Labels;
147 };
148 
Binary data class.
Indexer< T > index(T &t)
Iterator magic for for loops to get the index while iterating through.
Definition: MCDefs.hpp:146
Collected data with portable storage functions.
MC::FloatList Labels
Labels.
MC::FloatTable FeatureVectors
Feature vectors.