feature_selection.py 文件源码

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

项目:Default-Credit-Card-Prediction 作者: AlexPnt 项目源码 文件源码
def pearson_correlation_matrix(X):
    """
    Computes the Pearson Correlation matrix

    Keyword arguments:
    X -- The feature vectors
    """

    n_features=len(X[0])
    correlation_matrix=np.zeros(shape=(n_features,n_features))
    for i in xrange(n_features):
        for j in xrange(n_features):
            pearson_corr=stats.pearsonr(X[:,i],X[:,j])[0]
            correlation_matrix[i][j]=pearson_corr

    return correlation_matrix
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号