2023-06-29 20:00:41 +00:00
|
|
|
#ifndef ARFFFILES_H
|
|
|
|
#define ARFFFILES_H
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
class ArffFiles {
|
|
|
|
public:
|
2024-04-29 22:52:09 +00:00
|
|
|
ArffFiles() = default;
|
2023-11-08 17:45:35 +00:00
|
|
|
void load(const std::string&, bool = true);
|
|
|
|
void load(const std::string&, const std::string&);
|
|
|
|
std::vector<std::string> getLines() const;
|
2023-06-29 20:00:41 +00:00
|
|
|
unsigned long int getSize() const;
|
2023-11-08 17:45:35 +00:00
|
|
|
std::string getClassName() const;
|
|
|
|
std::string getClassType() const;
|
|
|
|
static std::string trim(const std::string&);
|
|
|
|
std::vector<std::vector<float>>& getX();
|
|
|
|
std::vector<int>& getY();
|
|
|
|
std::vector<std::pair<std::string, std::string>> getAttributes() const;
|
|
|
|
static std::vector<int> factorize(const std::vector<std::string>& labels_t);
|
2024-04-29 22:52:09 +00:00
|
|
|
protected:
|
|
|
|
std::vector<std::string> lines;
|
|
|
|
std::vector<std::pair<std::string, std::string>> attributes;
|
|
|
|
std::string className;
|
|
|
|
std::string classType;
|
|
|
|
std::vector<std::vector<float>> X;
|
|
|
|
std::vector<int> y;
|
|
|
|
int maxLines = 0;
|
|
|
|
void generateDataset(int);
|
|
|
|
void loadCommon(const std::string&);
|
2023-06-29 20:00:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|