热力图

作者: 曦宝 | 来源:发表于2018-08-08 15:12 被阅读42次

    根据热力图也可以看出数据表里多个特征的两两相似程度。


    image.png

    import numpy as np
    import matplotlib.pyplot as plt
    import seaborn as sns

    tps = read_csv('E:\workfile\data\trade\tps.csv', header=0)
    label = np.array(tps)[:, 0]
    feature = np.array(tps)[:, 1:]

    下面是画热力图的方法

    def relitu():
    dfData = tps.corr()
    plt.subplots(figsize=(9, 9)) # 设置画面大小
    sns.heatmap(dfData, annot=True, vmax=1, square=True, cmap="Blues")
    plt.savefig('./BluesStateRelation.png')
    plt.show()

    image.png
    这是上述代码画出来的热力图,可以看出,颜色越深相关性越强。
    因为不是主要研究的部分,想知道更多:
    https://blog.csdn.net/weixin_39541558/article/details/79813936

    相关文章

      网友评论

        本文标题:热力图

        本文链接:https://www.haomeiwen.com/subject/erqxbftx.html