32 std::list<std::vector<double>> xValues;
33 std::list<std::vector<double>> yValues;
34 std::vector<double> yPredictions;
42 this->yPredictions = {};
45 std::array<long, 2> size = { this->nX, this->nY };
49 void addDataPoints(std::vector<double> xValues, std::vector<double> yValues) {
50 if (!(this->nX == xValues.size() && this->nY == yValues.size()))
52 cout <<
"data size doesn't match\t:[" << nX <<
", " << nY <<
"] != [" << xValues.size() <<
", " << yValues.size() <<
"]\n";
56 this->xValues.push_back(xValues);
57 this->yValues.push_back(yValues);
67 return this->yPredictions;
71 std::cout <<
"\nprinting dataset\n";
72 std::cout <<
"---------------------------------------------------------------\n";
75 std::list<std::vector<double>>::iterator it = this->yValues.begin();
76 for (
const std::vector<double> & row : this->xValues)
78 for (
int j{}; j < row.size(); j++) {
79 std::cout << row.at(j) <<
"\t";
83 const std::vector<double> yrow = *it;
84 for (
int j{}; j < yrow.size(); j++) {
85 std::cout << yrow.at(j) <<
"\t";
87 it = std::next(it, 1);
88 std::cout << std::endl;
92 std::cout <<
"---------------------------------------------------------------\n";
96 cout <<
"\n\nprinting x values...\n";
98 for (
const std::vector<double> & row : this->xValues)
101 for (
int j{}; j < row.size(); j++) {
102 cout << row.at(j) <<
"\t";
110 static std::string
toString(std::vector<double> data) {
111 std::string ret =
"";
113 for (
const double& val : data)
115 ret.append(std::to_string(val)).append(
"\t");
121 static std::string
toString(std::list<std::vector<double>> data) {
122 std::string ret =
"";
124 std::list<std::vector<double>>::iterator it = data.begin();
125 for (
const std::vector<double> & row : data)
127 for (
int j{}; j < row.size(); j++) {
128 double val = row.at(j);
129 ret.append(std::to_string(val)).append(
"\t");
138 template <
typename T,
size_t n>
141 std::cout <<
sizeof(T) * n << endl;
145 cout <<
"generating dataset ...\n";
146 const int ROW_SIZE = 10;
147 const int COL_SIZE = 10;
148 const int Y_COL_SIZE = 1;
153 for (
unsigned int i = 0; i < ROW_SIZE; i++) {
155 std::vector<double> xValue;
156 for (
unsigned int j = 0; j < COL_SIZE; j++) {
157 double v = i * ROW_SIZE + j;
161 std::vector<double> yValue;
162 for (
unsigned int j = 0; j < Y_COL_SIZE; j++) {
163 double v = (j + 1) * 10 + i + 0.1 * j;
void findSize(T(&arr)[n])
Definition Dataset.h:139
void setDataSize(long nX, long nY)
Definition Dataset.h:37
static std::string toString(std::vector< double > data)
Definition Dataset.h:110
void printxValues()
Definition Dataset.h:95
std::list< std::vector< double > > getyDataPoints()
Definition Dataset.h:63
std::list< std::vector< double > > getxDataPoints()
Definition Dataset.h:60
std::array< long, 2 > getDataSize()
Definition Dataset.h:44
static std::string toString(std::list< std::vector< double > > data)
Definition Dataset.h:121
void printDataSet()
Definition Dataset.h:70
void addDataPoints(std::vector< double > xValues, std::vector< double > yValues)
Definition Dataset.h:49
static DataSet prepareDataset()
Definition Dataset.h:144
std::vector< double > getyPredictionPoints()
Definition Dataset.h:66