3 ms·
I upvoted because I'm quite familiar with ML theory and like to read the latest tweaks, etc. but I've never used a tool like TensorFlow. Papers, blog posts, etc
by chriswarbo 10y ago
I upvoted because I'm quite familiar with ML theory and like to read the latest tweaks, etc. but I've never used a tool like TensorFlow. Papers, blog posts, etc. usually give diagrams and/or fully-fledged code snippets. That's great for the high-level overview, and low-level nitty-gritty, respectively.
Yet minimal code examples like this let me see straight away what TensorFlow programs look like, without having to distinguish between fundamental aspects and snippet-specific ones.
My only remark would be to put a comment at the top something like "Fit a straight line, of the form y=m*x+b".
I guessed that the "m" and "b" variables were referring to these common usages, but was wary of this assumption until line 14.
For all I know, "m" and "b" could be common parameter names for some TensorFlow config or something :)
- dgacmu 10y agoAnother suggestion: 'operation' would be better named 'train_step' -- it's more descriptive and eliminates the need for the comment at the end. Also, it's best practice and common tensorflow idiom to do: init = tf.initialize_all_variables() ... with tf.Session() as session: session.run(init) Not just for style, but because creating new graph nodes after creating the session requires tearing down and then re-setting-up some of the internal session stuff. It's much faster to move the initialize_all_variables() creation outside of the session.