美文网首页
[转载]python一行搞定Z-score标准化

[转载]python一行搞定Z-score标准化

作者: AeroZ | 来源:发表于2020-08-29 16:41 被阅读0次

    python一行搞定Z-score标准化

    https://blog.csdn.net/weixin_43886356/article/details/106160802

    https://www.pythonheidong.com/blog/article/377292/

    from sklearn import preprocessing
    data = preprocessing.scale(values) #注意,这里的values是array
    

    Z-Score数据标准化处理(python代码)

    (https://www.cnblogs.com/ryuham/p/4776268.html

    #/usr/bin/python
     
    def Z_Score(data):
        lenth = len(data)
        total = sum(data)
        ave = float(total)/lenth
        tempsum = sum([pow(data[i] - ave,2) for i in range(lenth)])
        tempsum = pow(float(tempsum)/lenth,0.5)
        for i in range(lenth):
            data[i] = (data[i] - ave)/tempsum
        return data
     
    print Z_Score([2,2,3,4,5,6,7,8])
    print Z_Score([10,20,30,40,50,60,70,80])
    print Z_Score([20,20,30,40,50,60,70,80])
    

    https://www.cnblogs.com/52why/p/13182372.html

    image

    相关文章

      网友评论

          本文标题:[转载]python一行搞定Z-score标准化

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