feat: read data from arff files #1

Merged
Trianta merged 8 commits from arff into main 2024-03-18 19:59:45 -05:00
3 changed files with 27 additions and 0 deletions
Showing only changes of commit e32a65a660 - Show all commits

View File

@ -81,6 +81,31 @@ namespace ARFF {
TestIntegrity();
}
void Arff::Print(void) {
std::cout << attributeList.size() << " attributes\n";
std::cout << database.size() << " examples\n";
std::cout << std::endl;
std::cout << "Attribute (#): values\n";
for (AttributeType type : attributeList) {
std::cout << type.attribute << " (" << type.values.size() << "):";
for (std::string value : type.values) {
std::cout << " " << value;
}
std::cout << '\n';
}
std::cout << std::endl;
std::cout << relation << '\n';
for (Instance instance: database) {
for (std::string value : instance.values) {
std::cout << '\t' << value;
}
std::cout << '\n';
}
std::cout << std::endl;
}
// Add the attribute to the list
void Arff::AddAttribute(std::string line) {
std::stringstream parser(line);

View File

@ -29,6 +29,7 @@ namespace ARFF {
public:
Arff() = default;
void Read(std::string filename);
void Print(void);
private:
std::string relation;
std::vector<AttributeType> attributeList;

View File

@ -9,4 +9,5 @@ int main(int argc, char* argv[]) {
ARFF::ParseArguments(argc, argv);
ARFF::Arff data;
data.Read(ARFF::GetDataFilename());
data.Print();
}