Minepy |
您所在的位置:网站首页 › python中alpha怎么用 › Minepy |
MIC 即:Maximal Information Coefficient 最大互信息系数。 https://blog.csdn.net/qtlyx/article/details/50780400 MIC可以用来衡量线性或非线性的相互关系。
算法对比
https://zhuanlan.zhihu.com/p/53092905 MIC算法可以通过python的minpy包来实现。 python 安装 minepy 安装命令: pip install minepy安装报错,提示没有C++编译器 https://www.cnblogs.com/xiaoxineryi/p/12405063.html 从Unofficial Windows Binaries for Python Extension Packages(这个网站包含了很多Python扩展包的非官方Windows二进制文件)下载对应的minepy.whl
安装命令 pip install whl路径安装报错, ERROR: minepy-1.2.4-cp38-cp38-win_amd64.whl is not a supported wheel on this platform 需要选择和自己Python版本对应的版本 查询python支持的whl格式 from pip._internal import pep425tags print(pep425tags.get_supported()) #打印支持的whl版本 >>>[('cp37', 'cp37m', 'win_amd64'), ('cp37', 'none', 'win_amd64'), ('py3', 'none', 'win_amd64'), ('cp37', 'none', 'any'), ('cp3', 'none', 'any'), ('py37', 'none', 'any'), ('py3', 'none', 'any'), ('py36', 'none', 'any'), ('py35', 'none', 'any'), ('py34', 'none', 'any'), ('py33', 'none', 'any'), ('py32', 'none', 'any'), ('py31', 'none', 'any'), ('py30', 'none', 'any')]下载适合的whl版本,安装成功 使用minpy https://s0minepy0readthedocs0io.icopy.site/en/1.2.2/python.html import numpy as np import pandas as pd from minepy import MINE inpath = r'D:\Python\input_data\abc.xlsx' outpath = r'D:\Python\output_data\abc-MIC系数.xlsx' data_df = pd.read_excel(inpath) depend_names = ['变量A', '变量B', '变量C'] output_mic = pd.DataFrame(columns=['变量1','变量2','MIC系数']) for var1 in depend_names: for var2 in depend_names: x = data_df[var1] y = data_df[var2] mine = MINE(alpha = 0.6, c = 15) mine.compute_score(x, y) print(mine.mic()) out_dict = {'变量1': var1, '变量2': var2, 'MIC系数': mine.mic(), } output_mic = output_mic.append(out_dict, ignore_index=True) output_mic.to_excel(outpath)
|
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |