-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathregression.cpp
More file actions
36 lines (36 loc) · 793 Bytes
/
Copy pathregression.cpp
File metadata and controls
36 lines (36 loc) · 793 Bytes
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
#include "stdafx.h"
#include "regression.h"
#include <iostream>
Regression::Regression()
{}
Regression::~Regression()
{}
void Regression::sendMsg(char* msg)
{
std::cout << msg << std::endl;
}
bool Regression::isDataMatch(Eigen::MatrixXd &xData, Eigen::MatrixXd &yData)
{
if (xData.cols() == yData.cols())
return true;
return false;
}
bool Regression::learn()
{
/*学习参数初始化*/
/*Wieght:d*1矩阵*/
/*Bias:1*1矩阵*/
Weight = Eigen::MatrixXd::Random(TrainningDataX.rows(), 1);
Bias = Eigen::MatrixXd::Random(1, 1);
return true;
}
Eigen::MatrixXd Regression::recognize(Eigen::MatrixXd input)
{
/*input:d*m矩阵*/
/*output:1*m矩阵*/
/*Weight:d*1*/
MLMODEL_ASSERT(input.rows() == Weight.rows());
Eigen::MatrixXd output;
output = (Weight.transpose())*input + Bias;
return output;
}