zoukankan      html  css  js  c++  java
  • 学习进度笔记7

    观看Tensorflow案例实战视频课程07 逻辑回归框架

    import numpy as np
    import tensorflow as tf
    import matplotlib.pyplot as plt
    import input_data
    
    mnist=input_data.read_data_sets('data/',one_hot=True)
    trainimg=mnist.train.images
    trainlabel=mnist.train.lables
    testimg=mnist.test.images
    testlabel=mnist.test.labels
    print("MNIST loaded")
    
    print(trainimg.shape)
    print(trainlabel.shape)
    print(testimg.shape)
    print(testlabel.shape)
    #print(trainimg)
    print(trainlabel[0])
    
    x=tf.placeholder("float",[None,784])
    y=tf.placeHolder("float",[None,10])#None is for infinite
    W=tf.Variable(tf.zeros([784,10]))
    b=tf.Variable(tf.zeros[10])
    #LOGISTIC REGRESSION MODEL
    actv=tf.nn.softmax(tf.matmul(x,W)+b)
    #COST FUNCTION
    cost=tf.reduce_mean(-tf.reduce_sum(y*tf.log(actv),reduction_indices=1))
    #OPTIMIZER
    learning_rate=0.01
    optm=tf.train.GradientDescentOptimizer(learning_rate).minimize(cost)
  • 相关阅读:
    Apache 虚拟主机 VirtualHost 配置
    ajax无线级刷新
    Apache中 RewriteRule 规则参数介绍
    用户注册
    用户登录
    Android 侧滑菜单
    PhontoShop CS6 视频
    ArcGis地图
    Android 汉子转换成拼音
    UTF-8 转 GBK
  • 原文地址:https://www.cnblogs.com/zql-42/p/14587651.html
Copyright © 2011-2022 走看看