-
Notifications
You must be signed in to change notification settings - Fork 0
/
DData.h
46 lines (33 loc) · 1.1 KB
/
DData.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#pragma once
#include "DSample.h"
#include <fstream>
#include <sstream>
#include <set>
#include <unordered_map>
#include <functional>
#include <numeric>
#include <algorithm>
#include "random_unique.h"
class DData
{
private:
std::string fileName;
std::vector<std::string> colNames;
std::vector<DSample> samples;
std::vector<unsigned int> featureIndices;
bool isLoaded;
void loadFromCSV(const std::string&, unsigned int);
void enumerateUnordered();
public:
DData(const std::string&, unsigned int);
const std::string& getFileName()const;
const std::vector<DSample>& getSamples()const;
const std::vector<std::string>& getColNames()const;
const std::vector<unsigned int>& getFeatureIndices()const;
int getSampleSize()const;
const DSample& operator[](unsigned int) const;
void addSample(const DSample&);
void saveInside(const std::string&) const;
void generateFeatureIndices(std::vector<unsigned int>&, std::function<unsigned int(unsigned int)>)const;
void generateSampleIndices(std::vector<unsigned int>&, std::vector<double>&, bool)const;
};