Laurence, thank you so much for taking the time to put out such concise, intuitive walkthroughs. You manage to make everything going on behind the curtain really accessible and unintimidating!
In traditional programming, we infer answers after rules act on data, but in ML, we infer rules after answers act on data. Got that really straight.❤️❤️❤️❤️
Was just waiting for this from Lawrence. I m learning machine learning daily and time to take this to next level. Thanks Lawrence and Google and tensor flow
@@javiersuarez8415 Haha -- I haven't gotten around to filming a second season yet, but as they look like they're going to be popular, I should get moving on that... :)
Amazing video. Though I do feel the need to say that playing scissors with the thumb out is sketchy and looks like you are trying to straddle the line between scissors and paper.
my procrastination has transcended to new levels I am watching this instead of studying for my 2 finals or working on my 4 remaining projects with less than 2 weeks left to finish all of those things lol
You know those videos that you start watching and then get glued to them... :D Well done Laurence, in the first few seconds I wouldn't have bet on watching it
Subscribed after watching this. Love the way you explain. You explain the concept very clearly and also you add a little bit of the code which gives me a great preparation for the coding application. Keep up the good work Lawrence
Hello, Laurence Moroney, Astounding presentation. How quickly and how brilliantly you put such a huge task look so simple. I must admire your ability. Keep up the good work, thumbs up here.
Great video Laurence! For me the code you used failed "ValueError: Unrecognized data type: x=[10.0]". After changing the last line (print model predict) to this it worked: print(model.predict(tf.convert_to_tensor([10.0])))
Great video. You mention the small error is due to uncertainty due to the low sample size, is it not possible that the model simply descended to a not quite accurate relationship? Granted the cause would still be low sampling but the main question is if the error is explicitly programmed to reflect uncertainty because the input could still be 19 and be labeled uncertain.
This is awesome mike the best explanations i have ever made on Machine Learning and i got a feel and beauty of nerual network when i heard your class , great job , keep posting like these cheers
@@LaurenceMoroney I didn't notice it was actually you sir. This function cannot recognise polynomials like square equations or cubic. I provided it with xs as 1.0, 2.0... and ys as their square, but it never got any better than a loss of 6.2222, and if I entered 10, it gave me a value of 36.67... ???
Im really glad tensorflow by itself is doing tutorial right now. Because i have this research project that implements machine learning and it helps me to learn and understand each lesson about it.
The code is wrong. Not a good sign when the Hello World code from the official channel doesnt work. print(model.predict([10.0])) throws an error, you need to use something like print(model.predict(x=np.array([10.0])))
I love these tutorials and videos that Tensorflow puts out. Super informative. Thank you Laurence, what a great video! You bet I'll keep watching these series! Have a fantastic day everyone!😁👍
Laurence Moroney what a service to humanity that google is releasing tensorflow to the public domain. The benefit that will come out of this -and i don’t mean financial - is immeasurable. It’s like IBM releasing the paper on FFTs in the 60s !!
here's the code needed from the video, if anyone wants to try it out import tensorflow as tf from tensorflow import keras import numpy as np model=keras.Sequential([keras.layers.Dense(units=1, input_shape=[1])]) model.compile(optimizer="sgd", loss="mean_squared_error") xs=np.array([-1.0, 0.0, 1.0, 2.0, 3.0, 4.0], dtype=float) ys=np.array([-3.0, -1.0, 1.0, 3.0, 5.0, 7.0], dtype=float) model.fit(xs, ys, epochs=1100) print(model.predict([10.0])) I am an absolute beginner and wanted to run the code, but could only get errors at first. In case anyone needs this broken down, I added the first 3 lines that are necessary to run the tensorflow and keras libraries, installed previously via terminal.
Wow , I’ve been waiting for such an opportunity to learn machine learning from an expert . Thank so much and keep it up , we need it for our big project GOD’s willing .
Ok, you show some code that builds and trains the model before making a prediction. I found that on subsequent runs the accuracy increases, I realize that for some applications this can result in 'overfitting'. So once I am happy with the level of accuracy ,how can I apply the trained model without running the training (how/where is the model saved?)? Really love this course my head is working overtime in thinking of ways I want to try and apply it!
I didn't understood what exactly is input shape and why it is 1? Because is accepts our input array by only 1 value at the time or there is other reason? Also I can't understand how and why NN with just 1 neuron produces 18.99 instead 19 because 1 neuron means that it can predict only exact value and any deviation is inposible?
Input shape is 1, because we just want to predict the result for 1 value input (i.e. 10). Neuron won't get *exact* value because it deals in probabilities, not certainties, so the prediction is a very high probability that the answer is 19, but when evaluating that as a number you get something close to 19
I have a question on something I don't understand: Dr. Moroney said that prediction is not perfect because the computer is trained for 6 values that form a straight line, but outside those 6 may be not straight (although it is highly probable that they are straight). I don't get this point: since it is a NN with only one neuron, so it has to be a straight line the prediction (it should be like a linear regression). Am I correct? Or did I interpret something wrong?
Hi Lawrence, I am trying to implement same code with two inputs X1 and x2. I am finding difficulty in 1) how to specify x value like how the matrix of the two input should be. 2)what must be the input shape specified here. Could you please help with this.
In the math example we get a NAN when typing in other x values in the array like 100. Do you know why? from __future__ import absolute_import, division, print_function, unicode_literals import tensorflow as tf import numpy as np x = [-1.0, 2.0,4.0,6.0,7.0, 100.0] y = [] x_test = [10] for i in x: y.append(i*2 +5) model = tf.keras.models.Sequential([ tf.keras.layers.Dense(units=1, input_shape=[1]) ]) optim='sgd' model.compile(optimizer=optim, loss='mean_squared_error') xs = np.array(x, dtype=float) ys = np.array(y, dtype=float) model.fit(xs, ys, epochs=500) print(model.predict(x_test))
Data should really be normalized when fed in for training, or the optimizer/loss won't work. We get away with it when we use small values, but that gets exposed at larger values. To do this you should normalize the training/test data and then retrain.
Sir is it important to study complete process of all machine learning algorithms or it's just enough to know the application of each algorithm . please tell
Running that code, I got an error: `ValueError: Unrecognized data type: x=[10.0] (of type )` -- fixed when I changed the predict() arg to `np.array([10.0])`
stupid question: where do i tell the thing that the relation between x and y is a math problem? how does it know that it has to calculate something and not come up with something else?
i have typical use case such as to predict the value of y for a given x but the logic for calculating the value of y ( ie in this case y=2x-1) is changing on daily basis. can tensor flow can predict this kind of data
Here's the working code: from tensorflow import keras from keras.models import Sequential from keras.layers import Dense import numpy as np model = keras.Sequential([keras.layers.Dense(units=1, input_shape=[1])]) model.compile(optimizer='sgd', loss='mean_squared_error') x=np.array([-1.0,0.0,1.0,2.0,3.0,4.0], dtype=float) y=np.array([-3.0,-1.0,1.0,3.0,5.0,7.0], dtype=float) model.fit(xs,ys,epochs=500) x1=np.array([10.0], dtype=float) print(model.predict([x1]))
It has seen those, and it calculates loss using those. The model will measure its performance against the known values, and calculate which ones it got 'right' and which ones it got 'wrong', with the loss function reporting loss on these.
I tried to feed the values for "y = x² + 5" but the algorithm failed to predict the result. I guess this setting is only good for "y = mx + n" kind of equations. I wish I'd understand the reason though.
I did the same and I guess since there is only one neuron it can only find one weight i.e factor and a bias i.e offset. So you will need more neuron i.e a bigger nn to be able to handle x^2 polynomials.
Great intro, however how often are you planning to release new chapters? There are tons of materials to learn ml on the internet and even if it's coming from you, directly from tensorflow devs, waiting for a 6 minute new episode for 4 days isn't particularly good I guess.
Excelente explicación. Muchas gracias pero Dónde están los demás videos? Podría gentilmente compartirlos intente buscar el curso en coursera pero no lo encuentro a usted y seria bueno que comparte este curso en coursera.
Thanks for explanation, if I feed x and y with more values like xs = 2000.0 and ys = 3999.0 (2x-1), my loss becoming infinite. Why that is happening? Great if you share more details on it.
Data being fed into the neural network should really be normalized. I.e. made to be between 0 and 1. We get away with not doing that with the smaller values here, but if we don't d that, they we'll usually end up breaking the loss function / optimizer and getting infinite loss etc. So if your range of Xs were from 0 to 2000, and your range of training Ys were (2x-1), you should divide all Xs by 2000, divide all Ys by 2000, train on that, and when you do a prediction, divide the input by 2000, and multiply the output by 2000 etc.
@@BilalAhmed-ib3yw I appreciate your close-mindedness and inability to think abstractly but this is like telling someone that you know every possible iteration of objects in all existence and then later realizing that this might be how computers can create art and new alternate realities based on formulas, rules and answers based in our reality.