【发布时间】:2020-07-27 23:28:32
【问题描述】:
我正在使用 Accord.NET 在 C# 中使用多重线性回归,我按照示例进行操作,该方法需要 2 个参数输入,即二维数组,输出是一维数组,这两个数组必须相同长度。
public static double[] RegressionLineaire(double[][]input,double[]output)
{
double[] coeff = new double[40];
var ols = new OrdinaryLeastSquares();
{
ols.UseIntercept = true;
};
Console.WriteLine("inputs length = " + input.Length + " outputs
length = " + output.Length);
MultipleLinearRegression regression = ols.Learn(input, output);
coeff = regression.Weights;
return coeff;
}
输入和输出的长度相同,但出现此异常
System.InvalidOperationException:'矩阵排名不足。'
【问题讨论】:
-
检查你的输入是否满足条件HERE.
标签: c# linear-regression accord.net