arff-mining/src/arff/arff.hpp

57 lines
1.4 KiB
C++
Raw Normal View History

#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);
2024-04-17 14:43:47 -05:00
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