【问题标题】:Matrix is rank deficient, Multiple Linear Regression Accord.NET矩阵秩不足,多元线性回归 Accord.NET
【发布时间】: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


【解决方案1】:

我刚刚找到了问题的解决方案,这不是输入形状问题,而且我不知道矩阵的原因是秩不足异常,但我通过添加这一行来管理 de 使其工作.

var ols = new OrdinaryLeastSquares();
    {
        ols.UseIntercept = true;
        ols.IsRobust = true;
    };

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-11-08
    • 2019-05-16
    • 2018-07-12
    • 2020-09-16
    • 1970-01-01
    • 2010-11-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多