57 lines
1.4 KiB
C++
57 lines
1.4 KiB
C++
#ifndef ARFF_HPP
|
|
#define ARFF_HPP
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
#include <map>
|
|
|
|
namespace ARFF {
|
|
void ParseArguments(int argc, char* argv[]);
|
|
std::string GetDataFilename(void);
|
|
|
|
struct AttributeType {
|
|
public:
|
|
std::string attribute;
|
|
std::vector<std::string> values;
|
|
AttributeType(std::string attribute);
|
|
void AddValue(std::string value);
|
|
};
|
|
|
|
struct Instance {
|
|
public:
|
|
Instance(const int id, const int size);
|
|
unsigned int id;
|
|
std::vector<std::string> values;
|
|
};
|
|
|
|
struct AttributeEvaluation {
|
|
AttributeEvaluation() = default;
|
|
AttributeEvaluation(AttributeType *attribute);
|
|
AttributeType *currentAttribute;
|
|
std::map<std::string, std::string> rules;
|
|
float totalErrorRate = 0.0f;
|
|
int totalError = 0;
|
|
};
|
|
|
|
class Arff {
|
|
public:
|
|
Arff() = default;
|
|
void Read(std::string filename);
|
|
void PrintOverview(void);
|
|
void PrintData(void);
|
|
void OneR(void);
|
|
private:
|
|
std::string relation;
|
|
std::vector<AttributeType> attributeList;
|
|
std::vector<Instance> database;
|
|
void AddAttribute(std::string line);
|
|
void AddData(std::string line);
|
|
void TestIntegrity(void);
|
|
AttributeEvaluation _OneR(void);
|
|
AttributeEvaluation EvaluateAttribute(AttributeType *attribute, const int attributePos);
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|