feature_selection.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:Default-Credit-Card-Prediction 作者: AlexPnt 项目源码 文件源码
def kolmogorov_smirnov_normality_test(X,y):
    """
    Performs the one sample Kolmogorov-Smirnov test, testing wheter the feature values of each class are drawn from a normal distribution

    Keyword arguments:
    X -- The feature vectors
    y -- The target vector
    """

    kolmogorov_smirnov={}
    # print kolmogorov_smirnov
    for feature_col in xrange(len(X[0])):
        kolmogorov_smirnov[feature_col]=values=[]
        for class_index in xrange(2):
            values.append(stats.kstest(X[y==class_index,feature_col], 'norm'))


    #debug
    for f in xrange(23):
            print kolmogorov_smirnov[f]

    return kolmogorov_smirnov
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号