机器学习之Friedman检验

具体介绍见西瓜书

#include 
#include 
using namespace std;

//数据集个数 N
//算法个数 k
//第i个算法的平均序数值   ri
double calcTX2(int N,int k,double ri[])
{
    double partone=(12.0*N)/(double)(k*(k+1.0));
    double parttwo=0.0;
    for(int i=0;i1)*(k+1)/4;
    double res=partone*parttwo;
    return res;
}

double TF(double TX2,int N,int k)
{
    double res=(double)((N-1)*TX2)/(double)(N*(k-1)-TX2);
    return res;
}

double calcCD(double qAlpha,int k,int N)
{
    return qAlpha*sqrt((k*(k+1.0))/(6.0*N));
}

int main()
{
    double ri[4]={3.75,3.25,1.75,1.25};
    //double ri[3]={1,2.125,2.875};
    int N=4;
    int k=4;

    cout<<"res=  "<cout<<"CD=   "<2.344,k,N)<return 0;
}

你可能感兴趣的:(机器学习)