初心者です。
tensor flow をjupyter notebookで使っているんですがtensor boardが使えません。
下記のプログラムをjupyter notebook上で打ち込んでtensorboad --logdir=/path/to/log
をターミナルで打ち込みましたがうまくいきません。
教えてもらえると有難いです。
import tensorflow as tf
import numpy as np
import os
LOG_DIR = os.path.join(os.path.dirname("file"), 'log')
if os.path.exists(LOG_DIR) is False:
os.mkdir(LOG_DIR)
w = tf.Variable(tf.zeros([2, 1]))
b = tf.Variable(tf.zeros([1]))
x = tf.placeholder(tf.float32, shape=[None, 2])
t = tf.placeholder(tf.float32, shape=[None, 1])
y = tf.nn.sigmoid(tf.matmul(x, w)+b)
cross_entropy = - tf.reduce_sum(t*tf.log(y)+(1-t)*tf.log(1-y))
train_step = tf.train.GradientDescentOptimizer(0.1).minimize(cross_entropy)
correct_prediction = tf.equal(tf.to_float(tf.greater(y, 0.5)), t)
accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32))
init = tf.initialize_all_variables()
sess = tf.Session()
tf.train.SummaryWriter(LOG_DIR, sess.graph)
sess.run(init)
import tensorflow as tf
import numpy as np
import os
LOG_DIR = os.path.join(os.path.dirname("__file__"), 'log')
if os.path.exists(LOG_DIR) is False:
os.mkdir(LOG_DIR)
w = tf.Variable(tf.zeros([2, 1]))
b = tf.Variable(tf.zeros([1]))
x = tf.placeholder(tf.float32, shape=[None, 2])
t = tf.placeholder(tf.float32, shape=[None, 1])
y = tf.nn.sigmoid(tf.matmul(x, w)+b)
cross_entropy = - tf.reduce_sum(t*tf.log(y)+(1-t)*tf.log(1-y))
train_step = tf.train.GradientDescentOptimizer(0.1).minimize(cross_entropy)
correct_prediction = tf.equal(tf.to_float(tf.greater(y, 0.5)), t)
accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32))
init = tf.initialize_all_variables()
sess = tf.Session()
tf.train.SummaryWriter(LOG_DIR, sess.graph)
sess.run(init)