MathNet用到的一些功能

1、计算一元线性函数

Tuple<double, double> myLineTuple = MathNet.Numerics.Fit.Line(myXArray, myYArray);
double myA = myLineTuple.Item1;
double myB = myLineTuple.Item2;

2、常用统计函数

统计最小值、最大值、平均值、分位数等

double myMinimum = MathNet.Numerics.Statistics.Statistics.Minimum(myValueList);
double myMean = MathNet.Numerics.Statistics.Statistics.Mean(myValueList);
double myMaximum = MathNet.Numerics.Statistics.Statistics.Maximum(myValueList);
double myLowerQuartile = MathNet.Numerics.Statistics.Statistics.LowerQuartile(myValueList);
double myMedian = MathNet.Numerics.Statistics.Statistics.Median(myValueList);
double myUpperQuartile = MathNet.Numerics.Statistics.Statistics.UpperQuartile(myValueList);
MathNet.Numerics.Statistics.Statistics.Quantile(this.ValueList,0.2)

3、求两组样品的相关系数

MathNet.Numerics.Statistics.Correlation.Pearson(pValueList1, pValueList2);

4、根据相关性矩阵,求特征值以及特征向量

public void CalEigenValue(double[,] pCorrelationArray)
{
    var myCorrelationMatrix = DenseMatrix.OfArray(pCorrelationArray);
    var myEvd = myCorrelationMatrix.Evd();
    for (int i = 0; i < this.FactorList.Count; i++)
    {
        FactorAnalysisFactor myFactor = this.FactorList[i];
        myFactor.EigenValue = myEvd.D[i, i];
        myFactor.EigenValueArray = myEvd.EigenVectors.Column(i).ToArray();
    }
}

 

posted @ 2022-04-03 10:47  mytudousi  阅读(642)  评论(0编辑  收藏  举报