LoginSignup
1
2

More than 5 years have passed since last update.

Accord.NETによる線形回帰の実装

Posted at

線形回帰

  • 予測式はy=ax+bの形
  • 一つの説明変数と一つの目的変数の関係を予測する。
  • 式の形の通り、説明変数と目的変数の間に一次関数の関係があると仮定して予測を行う

Accord.NETによる実装

double[] inputs = {80, 60, 10, 20, 30};
double[] outputs = {20, 40, 30, 50, 60};
var regression = new SimpleLinearRegression();
regression.Regress(inputs, outputs);
var y = regression.Compute(85);
var a = regression.Slope;
var b = regression.Intercept;

実行結果

image

1
2
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2