Live data from Hacker News

Simple example of machine learning in TensorFlow

github.com

31–40 of 49 posts

Re: Simple example of machine learning in TensorFlow

#31

So I'm still wrapping my head around some of the math (I haven't had a math class in a handful of years)... I get the output of the model (y_model = m*xs[i]+b), it's the y = mx + b where we know x (from the dataset) and have y be a variable. The error is where I start to lose it, so I get the idea of the first part (ys[i]-y_model). It's basically the difference between the actual y value (from the dataset). I get tha…

>What I don't get is the squaring of the difference.

The following answer is about standard deviation but the desired properties from squaring is also relevant to your question:

http://stats.stackexchange.com/questions/118/why-square-the-...

Re: Simple example of machine learning in TensorFlow

#32
post #25
post #2

I like these kind of "Hello, world!" examples for TensorFlow. As a TensorFlow beginner, I need all the references I can get. Here is what I need right now: "Hello, we meet again!". I can build a neural net model, and train (albeit, often badly) a model, but saving and restoring the trained weights so that I can run the model again is giving me fits. I am clearly missing something fundamental about how to restore a Te…

> As a TensorFlow beginner, I need all the references I can get. I think that having to use a duck typed language makes it so much harder than it has to be. The API is huge, and you get really no help from the IDE. If I could do tf.train.GradientDescentOptimizer as in the example, and then get autocomplete to what I can do next with that object it would really help. Or list functions that takes that kind of object as…

This sounds like a problem with your IDE than with the language. Vim doesn't have this problem. See https://www.youtube.com/watch?v=TNMjbaimk9g and I could probably find older systems that predate the plugins mentioned in the video.

Re: Simple example of machine learning in TensorFlow

#33

So I'm still wrapping my head around some of the math (I haven't had a math class in a handful of years)... I get the output of the model (y_model = m*xs[i]+b), it's the y = mx + b where we know x (from the dataset) and have y be a variable. The error is where I start to lose it, so I get the idea of the first part (ys[i]-y_model). It's basically the difference between the actual y value (from the dataset). I get tha…

a) it ensures that they're positive so they don't just cancel each other out and b) like you mentioned, it penalizes huge errors more heavily.

There are also historical reasons for using squared error. The square function is smooth and differentiable to you can analytically solve for the gradient. Before fast computers this was crucial for solving regression problems as a closed for makes everything easier.

Re: Simple example of machine learning in TensorFlow

#34

So I'm still wrapping my head around some of the math (I haven't had a math class in a handful of years)... I get the output of the model (y_model = m*xs[i]+b), it's the y = mx + b where we know x (from the dataset) and have y be a variable. The error is where I start to lose it, so I get the idea of the first part (ys[i]-y_model). It's basically the difference between the actual y value (from the dataset). I get tha…

Squaring gets you guaranteed positive numbers. Remember, we are adding all the errors together to optimize the model: If we get

sum_errors_A = 4 + -3 + -1

sum_errors_B = 1 + 1 + 1

B is obviously the better model, but it has a higher error than A when comparing. If we squared all the terms and then added, B would be the stronger model.

Re: Simple example of machine learning in TensorFlow

#35
post #17
post #2

I like these kind of "Hello, world!" examples for TensorFlow. As a TensorFlow beginner, I need all the references I can get. Here is what I need right now: "Hello, we meet again!". I can build a neural net model, and train (albeit, often badly) a model, but saving and restoring the trained weights so that I can run the model again is giving me fits. I am clearly missing something fundamental about how to restore a Te…

This save/restore tutorial was shared early by someone who is writing similar TensorFlow primers: https://blog.metaflow.fr/tensorflow-saving-restoring-and-mix...

Great! Thanks, bookmarked.

Re: Simple example of machine learning in TensorFlow

#36

So I'm still wrapping my head around some of the math (I haven't had a math class in a handful of years)... I get the output of the model (y_model = m*xs[i]+b), it's the y = mx + b where we know x (from the dataset) and have y be a variable. The error is where I start to lose it, so I get the idea of the first part (ys[i]-y_model). It's basically the difference between the actual y value (from the dataset). I get tha…

Squaring gets you guaranteed positive numbers. Remember, we are adding all the errors together to optimize the model: If we get sum_errors_A = 4 + -3 + -1 sum_errors_B = 1 + 1 + 1 B is obviously the better model, but it has a higher error than A when comparing. If we squared all the terms and then added, B would be the stronger model.

Ah, gotcha! Makes a lot more sense now.

Re: Simple example of machine learning in TensorFlow

#37
post #10

This is awesome! I currently have a small pet project where I think some simple ML would be cool but I don't know where to start so these things are great. Basically my use case is that I have a bunch of 64x64 images (16 colors) which I manually label as "good", "neutral" or "bad". I want to input this dataset and train the network to categorize new 64x64 images of the same type. The closest I've found is this: https…

https://blog.keras.io/building-powerful-image-classification... is what you want.

Re: Simple example of machine learning in TensorFlow

#38
post #10

This is awesome! I currently have a small pet project where I think some simple ML would be cool but I don't know where to start so these things are great. Basically my use case is that I have a bunch of 64x64 images (16 colors) which I manually label as "good", "neutral" or "bad". I want to input this dataset and train the network to categorize new 64x64 images of the same type. The closest I've found is this: https…

Kiro,

Here's how I solved a similar problem in my deep learning class. Instead of classifying between 10 animals you would just have 3 possible labels.

https://github.com/hermiti/deep_learning_project_2/blob/mast...

Re: Simple example of machine learning in TensorFlow

#39
post #7

I wish there were more TensorFlow examples written in Go. I made the mistake of checking out TensorFlow as my first intro to ML and it flew about 10 miles over my head. Slowly learning now, but most of the documentation and tutorials are written in Python. This blog series was also helpful on a conceptual level: https://medium.com/emergent-future/simple-reinforcement-lear...

tbh you'll be better off just sticking with python for now, until you understand what's going on.

Re: Simple example of machine learning in TensorFlow

#40
post #7

I wish there were more TensorFlow examples written in Go. I made the mistake of checking out TensorFlow as my first intro to ML and it flew about 10 miles over my head. Slowly learning now, but most of the documentation and tutorials are written in Python. This blog series was also helpful on a conceptual level: https://medium.com/emergent-future/simple-reinforcement-lear...

I think it's a really good exercise to take TensorFlow examples and algorithms and reimplement them in another language.
Post reply on HN