matroid / dlwithtf Goto Github PK
View Code? Open in Web Editor NEWTensorFlow for Deep Learning Book
Home Page: http://shop.oreilly.com/product/0636920065869.do
TensorFlow for Deep Learning Book
Home Page: http://shop.oreilly.com/product/0636920065869.do
The TensorFlow for Deep Learning book uses DeepChem (https://deepchem.io/) for examples in Chapters 4, 5, and 8. While DeepChem installations work fine for most users, there are some users for whom DeepChem causes issues. If you're running into these issues, here are some steps we suggest:
We are working on putting together example code which doesn't rely on DeepChem for these chapters. We sincerely apologize if you've been facing difficulties and hope to help you find a quick resolution.
We will use this issue to track progress.
In ch5/hidden_grid_search.py
and possibly elsewhere:
File "hidden_grid_search.py", line 25, in <module>
for params, param_scores in scores.iteritems():
AttributeError: 'dict' object has no attribute 'iteritems'
Cure for python3: find . -type f -exec sed -i 's/iteritems()/items()/' {} +
.
Hi,
I am new to Deep Learning, TF, and tools. I am trying out the examples using Google Colab. One thing I am noticing with the Ch. 3 examples is that I am getting a "placeholder not set" kind of error after I have run the notebook once:
InvalidArgumentError: You must feed a value for placeholder tensor
One workaround is to select Runtime > Restart Runtime... from the menu which is a bit cumbersome and time consuming if you want to experiment with the example and run it many times.
A better approach would be to call tf.reset_default_graph()
in the beginning of the program or right before the placeholders are created. I think this would make things easier for people relying on the Google Colab or similar environments.
Thank you,
Andrey
Hi,
Thanks for the awesome repo. I am trying to run chapter 07 code and getting error at this line. The error message is as follows:
ValueError: Index out of range using input dim 2; input has only 2 dims for 'strided_slice_1' (op: 'StridedSlice') with input shapes: [20,20], [3], [3], [3] and with computed input tensors: input[3] = <1 1 1>.
I have noticed that input data is two dim while in this example you are slicing in three dims. Can you please propose a fix / work-around to this?
I have uploaded my code to this notebook!
Thanks!
A type error is thrown when using '/' to calculate matrix sizes. Explicitly using the integer division operator ('//') seems to fix it. Very weird since N is being declared as an integer in the step before it.
Traceback (most recent call last): File "/home/ninja/Documents/github/dlwithtf/ch3/logistic_regression_tf.py", line 13, in <module> mean=np.array((-1, -1)), cov=.1*np.eye(2), size=(N/2,)) File "mtrand.pyx", line 4508, in mtrand.RandomState.multivariate_normal File "mtrand.pyx", line 1550, in mtrand.RandomState.standard_normal File "mtrand.pyx", line 167, in mtrand.cont0_array TypeError: 'float' object cannot be interpreted as an integer
I've also created a PR for this issue if you want to take a look.
Hi,
When I run this code, I get this error:
InvalidArgumentError: You must feed a value for placeholder tensor 'placeholders_6/Placeholder' with dtype float and shape [100,1]
at this line:
_, summary, loss = sess.run([train_op, merged, l], feed_dict=feed_dict)
My hunch is that it's because this line:
x_np = np.random.rand(N, 1)
creates integers rather than floats.
I'm using Python 2.7.6 and tensorflow 2.0.0 but I import TensorFlow like this:
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
python3 ch5/tox21_rf.py
outputs:
About to fit model on train set.
Traceback (most recent call last):
File "tox21_rf.py", line 25, in <module>
sklearn_model.fit(train_X, train_y)
File "/home/alexander/env/tf/lib/python3.8/site-packages/sklearn/ensemble/_forest.py", line 330, in fit
y, expanded_class_weight = self._validate_y_class_weight(y)
File "/home/alexander/env/tf/lib/python3.8/site-packages/sklearn/ensemble/_forest.py", line 558, in _validate_y_class_weight
check_classification_targets(y)
File "/home/alexander/env/tf/lib/python3.8/site-packages/sklearn/utils/multiclass.py", line 172, in check_classification_targets
raise ValueError("Unknown label type: %r" % y_type)
ValueError: Unknown label type: 'unknown'
It helps to replace line 14:
train_y = train_y[:, 0]
with
train_y = train_y[:, 0].astype('int')
Hi.
Thanks for this great deep learning examples!
There appears a bug in ch3 example linear_regression_tf.py
At line 42, y becomes shape(100,) but I think it should be (100,1) because y-y_pred becomes (100,100) given y_pred is (100,1). So the loss function is very largely overestimated.
Simply changing the 42 line as following makes the training converge to global minimum. (W=5, b=2)
y = tf.placeholder(tf.float32, (N,)) --> tf.placeholder(tf.float32, (N,1))
Of course, np.reshape should be removed from line 28 and some additional code change is necessary to make the script runnable.
So I don't think this example is a proper proof of gradient descent not converging to global minimum.
But I still deeply appreciate the great examples of tensorflow and it helps me with studying deep learning so much.
Thanks,
Some of the code for the book is broken now due to changes in the latest version of TF. Please post breakages you've observed in this thread and we will coordinate a fix. PRs with fixes are welcome too!
Hello,
I'm learning a lot from the book, and am beginning to write my own code now. I have a question about a statement in the section "Hyperparameter Optimization Algorithms" - in the box titled "CAN’T HYPERPARAMETER OPTIMIZATION BE AUTOMATED?" you mention that
"In recent years, there has been a surge of work focused on improving the algorithmic foundations of model tuning. Gaussian processes, evolutionary algorithms, and reinforcement learning have all been used to learn model hyperparameters and architectures with very limited human input"
Could you point me to some papers/references that use Gaussian processes or evolutionary algorithms to automate the tuning process?
Thank you,
Traceback (most recent call last):
File "fcnet_classification_tf.py", line 17, in <module>
y_zeros = np.zeros((N/2,))
TypeError: 'float' object cannot be interpreted as an integer
and in other lines. To correct, sed -i 's|N/2|N//2|g' ch4/fcnet_classification_tf.py
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.