TensorFlow Basics: Logistic Regression

Insert image description here
Reference: https://blog.csdn.net/weixin_39445556/article/details/83930186

Data import and handling of X are consistent with linear regression

# ---------------------逻辑回归---------------------

# 与线性回归对比,X轴一样,Y轴需要根据阈值转换数据
# 阈值设置
K = 200

# 创建一个和Y一样结构的矩阵
NY = np.zeros([L,1])
YY = np.array(CsvFile['PM25']).reshape([L,1])


# 将矩阵中大于阈值的等于1,小于等于阈值的等于0
for i in range(len(YY)):
    if YY[i,0]>K:
        NY[i,] = 1
    else

Guess you like

Origin blog.csdn.net/Super_RD/article/details/123311387