google / prettytensor

Pretty Tensor: Fluent Networks in TensorFlow
1.24k stars 151 forks source link

Please improve the documentation #26

Closed Hvass-Labs closed 7 years ago

Hvass-Labs commented 8 years ago

Hello Everyone,

I'm currently in the process of learning how to use TensorFlow (TF) and wanted to use PrettyTensor (PT) to make the graph construction much easier. The idea of PT is great! - but the documentation is short and confusing so it is difficult to learn.

Here's a few comments I have so far. I hope the comments may help you guys understand what new users find confusing so you can improve it. I might add to the list as I get further with PT.

I haven't gotten around to sequence-construction, towers, etc. in PrettyTensor, so I can't really comment on that at this point. However, from having briefly looked at the documentation it seems just as confusing as the rest.

I think it would be well worth the effort to significantly improve the documentation. Perhaps have someone else in Google go over it so it's written with a fresh set of eyes. This may take someone a week or two to complete. But this is a tiny cost compared to the combined time wasted by thousands of new users who are trying to figure out how to do even simple things in TensorFlow and PrettyTensor. If 10.000 new users waste 1 hour each on average, then that's a combined 10.000 hours they could have spent on more productive things - and I think that's a very low estimate of the gain that could be had simply by improving the documentation. That's a pretty big contribution to the community, if you look at it that way.

Also, why isn't PrettyTensor an integrated part of TensorFlow? Why would anyone want to do the low-level coding required by TF and not use something like PT? In PT I can define my graph concisely in a few lines of code and not have to worry about allocating variables of the right shape, etc. The idea of PT is great, it just needs a more polished documentation.

I also looked briefly at Keras. Although its documentation seems to be more elaborate and polished than PrettyTensor, Keras has quite different syntax and semantics. In some cases PT seems to be simpler and better than Keras. So I'm hoping you guys will greatly improve the documentation for PrettyTensor so it's easier to learn for beginners.

I will take a look at TFLearn next. The documentation appears to be more polished than PrettyTensor.

I've seen a video about Microsoft's CNTK. It appears to be much simpler and more polished than TensorFlow + PrettyTensor. It'll be interesting to see when their Python version comes out in a few months.

Anyway, I hope some of these comments were useful.

eiderman commented 8 years ago

Thanks for such a long and well thought out critique. I will spend a bit of time working most of these into the code base.

As part of this, I will deemphasize templates. Their use case is narrow and is usually better served by doing the following pattern:

def my_model_fn(input_, labels, phase):
  ...

with tf.variable_scope('model'):
  train_result = my_model_fn(train_input, train_labels, pt.Phase.train)

with tf.variable_scope('model', reuse=True):
  test_result = my_model_fn(test_input, test_labels, pt.Phase.test)
Hvass-Labs commented 8 years ago

Thanks I'm looking forward to that!

I'm currently studying TFLearn and it suffers from the same lack of documentation. It is rather gruelling to learn and there is high risk of the user misunderstanding the API.

I saw a short and good video from one of the advocates of clean code, explaining why proper API documentation is very important: https://www.youtube.com/watch?v=Y-_oYR7e9cY

TFLearn seems to be more popular than PrettyTensor, but in some ways PrettyTensor appears more elegant, so I think there's room for both. TFLearn mimics scikit-learn in some ways, but it seems rather straight-forward to add similar functionality to PrettyTensor, and perhaps tailor it more to Neural Network learning.

The other day, I made a short video tutorial on PrettyTensor because that's how I initiallity like to learn things myself and none were available: https://www.youtube.com/watch?v=GCUfJQ_dec8