Closed Rahul954 closed 5 years ago
Hi @Rahul954 ,
A quick fix is to comment out the save_fig()
lines, they are only used to save the figures to disk, but I guess nobody needs that expect me (to include these images in the book).
I'm not sure what environment you are running in, because you seem to be running as root, which is usually not a good idea, except perhaps if it's a virtual machine or a docker? The first line of the output is:
runfile('/root/Machine_Learning_Scikit_Tensorflow/Chapter10.py',
wdir='/root/Machine_Learning_Scikit_Tensorflow')
So apparently the working directory is /root/Machine_Learning_Scikit_Tensorflow
. This would mean that the directory it will try to save the image to is located at /root/Machine_Learning_Scikit_Tensorflow/images/ann/
.
If it does not exist, then simply create it.
If it does exists, then I'm guessing this is an access rights issue: perhaps the Jupyter server is running as some user X, and that user does not have access rights to the directory /root/Machine_Learning_Scikit_Tensorflow/images/ann/
.
Hope this helps, Aurélien
Hello Aurélien,
Thanks for your help.
A quick fix is to comment out the save_fig() lines, they are only used to save the figures to disk, but I guess nobody needs that expect me (to include these images in the book).
I will try that out.
I'm not sure what environment you are running in, because you seem to be running as root, which is usually not a good idea, except perhaps if it's a virtual machine or a docker?
I will keep this in mind in future. However, I have already done the whole setup on Spyder. So I will follow your advise religiously once I have finished this book and some other books by uninstalling it.
If it does not exist, then simply create it.
Actually I have tried that.
Last but not the least I want some help regarding suggestion of some book for python. I know other languages and understand python too but sometimes get stuck with syntax. For example:
for epoch in range(n_epochs):
for batch_index in range(n_batches):
X_batch, y_batch = fetch_batch(epoch, batch_index, batch_size)
sess.run(training_op, feed_dict={X: X_batch, y: y_batch})
best_theta = theta.eval()
I am unable to understand meaning of {X: X_batch, y: y_batch}
.
YOUR HELP AND A GREAT ATTITUDE TOWARDS MAKING OTHER PEOPLE LEARN IS A BOON FOR US AND ALLOWING US TO EXPRESS OUR DIFFICULTIES / CHALLENGES HONESTLY.
KEEP UP THE GOOD WORK.
Regards, Rahul Rathore
Hi Rahul,
Thanks for your detailed answer and your encouraging words. :)
I personally learned Python entirely online, I don't have any Python book (actually, I bought one for my children: Python for Kids. I particularly liked the official tutorial, but there are plenty of other online resources. Not sure what book to recommend though, I'm sure there are plenty of excellent ones.
The core data structures in Python include lists (e.g., [1, 2, 3]
), tuples (e.g., (1, 2, 3)
), dictionaries (e.g., {"john": 12, "martha": 43, "robert": 17.5}
) and sets (e.g., {2, 3, 5, 7, 11, 13}
). So {X: X_batch, y: y_batch}
is a dictionary that maps the object X
to the object X_batch
, and the object y
to the object y_batch
. Dictionaries are implemented using hash tables, so the keys (X
and y
) must be hashable, meaning they must implement a __hash__()
method. TensorFlow placeholders are hashable, so you can use them as keys. But you could also use their name instead: {"X:0": X_batch, "y:0": y_batch}
. The name of a tensor is the name of the operation that creates it (in this case, a tf.placeholder()
operation) followed by :0
if it is the first output of the operation, or :1
if it is the second, and so one. Most operations have a single output, so most tensors are named "something:0"
.
Hope this helps.
Hello,
Thanks for the advice. I will try to use online material and try to make most of it.
Regards, Rahul Rathore
Hello,
I am running the code for Chapter 10:
The trace getting generated is like:
Though I have directory /images/ann/ in my working directory. Still I am getting the error. FileNotFoundError: [Errno 2] No such file or directory: './images/ann/perceptron_iris_plot.png'
Regards, Rahul Rathore