• kNN#约会网站预测数据


     1 #约会网站预测数据
     2 def classifyPersion():
     3     resultList = ['not at all','in small doses','in large doses']
     4     #input()函数允许用户输入文本行命令并返回用户所输入的命令
     5     percentTats = float(input("percentage of time spent playing video games?"))
     6     ffMiles = float(input("frequent year?"))
     7     iceCream = float(input("liters years?"))
     8     datingDataMat,datingLabels = file2matrix('datingTestSet2.txt')
     9     normMat, ranges, minVals = autoNorm(datingDataMat)
    10     inArr = array([ffMiles,percentTats, iceCream])
    11     classifierResult = classify0((inArr-minVals)/ranges,normMat,datingLabels,3)
    12     print("you like person:",resultList[classifierResult - 1])
  • 相关阅读:
    3-2 案例准备工作
    3-1 Git下载与安装
    3-1 案例环境初始化
    1-2+并发编程初体验
    Linux
    HTTP
    Linux
    HTML
    Linux 命令
    MySQL
  • 原文地址:https://www.cnblogs.com/fd-682012/p/11579301.html
Copyright © 2020-2023  润新知