Dear Patrick your lectures are awesome! What a great way to get a first grip on the subject without reading through difficult manuals or reading a big book. Fab!
I've been binge watching your vids, and they have been helpful for me. I'm trying to get a software developer job, and I want to put pytorch on my belt. So, thanks for these vids again. Your information is straight to the point, accurate and easy to follow.
Zuerst vielen Dank für deine ausgezeichneten Tutorials. Jedoch macht es didaktisch viel Sinn, die Zwischenergebnisse zu zeigen, um dem Zuseher ein tieferes Verständnis zu vermitteln.
Question: At 100th epoch, the loss is 567. Without looking at the plot, how do I know that this loss is good enough? Because in the previous examples, the losses were near zero.
Hello, I'm not sure if the original person who posted the question will read this, but it may be useful for others: The expected loss is proportional to your number of samples and your noise. Here, the data is scattered around your trendline, so the loss (which is proportional to average of the distance between the line and the data points) is never going to be zero. If you have enough data points, your loss will be on the order of magnitude of~noise^2. In Patrick's example, it's still a bit too high (you can kinda see that the slope of his line doesn't really match the data). If he had set his n_samples to millions and the epochs to 200 or 300, he'd fallen within the noise^2 range and the line would cross the data points right in the middle The size of the loss will depend on your problem, the amount of data points you have and the noise that data has.There's probably a statistics lesson to be had here, but I'm too lazy to look for it in Wikipedia, it probably has something to do with Bayesian statisticshas
Thank You for the excellent tutorial series I am new to PyTorch and I am a little confused at 6:07 here MSELoss is a class so criterion will be an object but you said it as a callable function and used this object as a function to compute the loss. how is it possible to use the object of a class as a function? can u please explain or point out to some resources Thank You
Every object in Python can be made callable (such that it behaves like a function) by implementing the __call__() method: __docs.python.org/3/reference/datamodel.html#object.__call___
Because our loss function (MSELoss) expects the y in a certain shape with one column. The shape of X is not fixed, it can vary dependent on the number of samples and the number of features
thank you so much for giving a complex concept in an easy way I am learning pytorch from your tutorial. please extend to seq2seq model and also make example of language translation in RNN module thank you again
okay so a quick question. when i use pytorch. i get very high accuracy in my new data. but when i use sklearn, though i get very high accuracy too, but i takes less time why does that happen? isn't sklearn doing the same thing we did ? 🤔
detach stops a tensor from tracking history. during training we still want this, because we have to apply backpropagation. (so in line 34 we want the gradient). after training in line 50 we don't need this anymore, and can call detach.
Hi Bro, I couldn't stop thanking you again and again...It was such an amazing explanation. can we connect in linked-In or in any other platforms aswell?
well... I guess maybe it's due to the fact the we already know the data is proportional... so the plot is enough to see that the model is actually correct: it shows a linear equation with the correct slope
another great video! My plot doesn't show a blue line, but rather every red dot is connected by a blue line. What am I doing wrong? #plot # detach X keeps the gradients of x from being updated predicted = model(X).detach().numpy() plt.plot(x_numpy,y_numpy,"ro") plt.plot(x_numpy,y_numpy,"b") plt.show()
hello, why in the for loop, model input is the X, which has a 100*1 shape, didn't we just define that the model = nn.Linear(1,1), which means input is 1 dim and output is 1 too ?
Hello. I just have a question and forgive me as I am still a beginner in ML, what if I have a dataset that contains x, y1, y2. where x is the independent variable and y1 and y2 are the actual values. so basically, the graph shows two plots of (x,y1) and (x,y2). Also, the graph shows a nonlinear trend (goes up and down). Can I still apply this method? Or is there a builtin nonlinear model in torch?
Samples are the items or observations we can use for the training. For example in the iris dataset, we have 150 samples. For each sample, we have a vector of different features that describe the sample. Here we have the 4 features: sepal width / sepal length / petal width / petal length.
Thank you very much for making this series. I have one doubt though: Why is the value of output_size equal to 1 here? In your previous video, it was set to be equal to n_features...wasn't that example also based on Linear Regression? How do I determine the value the output_size while designing my own models?
output_size is the number of different classes/labels you want to predict. For normal linear regression this is always 1. In the previous tutorial n_features=1 because of the toy dataset I used.
Otherwise you get this Runtime "Error RuntimeError: Expected object of scalar type Float but got scalar type Double". At least with the pytorch version I was using at the time of the video. I guess the linear layer needs the tensors to be Float
Thank you for this excellent series. I am a bit confused about converting Model(X) at line 50, shouldn't we convert y_predicted instead which contains the predicted labels? and does calling model(X) there result in an extra forward pass? why not just use y_predicted.detach().numpy()? Thanks.
Yes that’s an extra forward pass which we do with our final model after the training. I could have also named this last variable y_predicted to be consistent...
Dear Patrick
your lectures are awesome! What a great way to get a first grip on the subject without reading through difficult manuals or reading a big book. Fab!
I've been binge watching your vids, and they have been helpful for me. I'm trying to get a software developer job, and I want to put pytorch on my belt. So, thanks for these vids again. Your information is straight to the point, accurate and easy to follow.
I love your strong German accent. I study at a German university and you remind me of my professor. Thank you very much
Haha thanks :D Which university is it?
@@patloeber same!
@@patloeber yeah actually it's much clear than some British people
'tensoah' 'optimizah'
12:00 and ja. Danke für die Tutorials und dein Englisch ist auch sehr gut.
Zuerst vielen Dank für deine ausgezeichneten Tutorials. Jedoch macht es didaktisch viel Sinn, die Zwischenergebnisse zu zeigen, um dem Zuseher ein tieferes Verständnis zu vermitteln.
All your series are great! Thanks a lot!
Glad you like it!
All his lectures are so good. I really liked his work
Thanks :)
@@patloeber Thanks to you sir. i found it very easy because of you otherwise i always thought of pytorch to be very difficult.
@@naveedmazhar7260 I'm glad to hear that!
Great job, man!
Glad you liked it!
Thank you very much.
I love your gernan accent, and your tutorial helped me learn pytorch.
Great Job sir! Thank you so much for your informative sessions
Question: At 100th epoch, the loss is 567. Without looking at the plot, how do I know that this loss is good enough? Because in the previous examples, the losses were near zero.
Hello,
I'm not sure if the original person who posted the question will read this, but it may be useful for others:
The expected loss is proportional to your number of samples and your noise.
Here, the data is scattered around your trendline, so the loss (which is proportional to average of the distance between the line and the data points) is never going to be zero. If you have enough data points, your loss will be on the order of magnitude of~noise^2.
In Patrick's example, it's still a bit too high (you can kinda see that the slope of his line doesn't really match the data). If he had set his n_samples to millions and the epochs to 200 or 300, he'd fallen within the noise^2 range and the line would cross the data points right in the middle
The size of the loss will depend on your problem, the amount of data points you have and the noise that data has.There's probably a statistics lesson to be had here, but I'm too lazy to look for it in Wikipedia, it probably has something to do with Bayesian statisticshas
It aint clear what is the use of sklearn dataset, what does that function do, and all the parameters of the function do? can you please explain?
thank you so much, so detailed lecture, appreciated
Thank you!
Very good programming demo.
Thank You for the excellent tutorial series
I am new to PyTorch and I am a little confused at 6:07 here MSELoss is a class so criterion will be an object but you said it as a callable function and used this object as a function to compute the loss. how is it possible to use the object of a class as a function? can u please explain or point out to some resources
Thank You
Every object in Python can be made callable (such that it behaves like a function) by implementing the __call__() method: __docs.python.org/3/reference/datamodel.html#object.__call___
@@patloeber Thank You so much
thank you so musch, but i can't import datasets. could you help me?
Can someone explain why we do loss.item() here instead of simply loss, as done in previous tutorials?
Why do we have to reshape the y (line 18) but not the X also?
Because our loss function (MSELoss) expects the y in a certain shape with one column. The shape of X is not fixed, it can vary dependent on the number of samples and the number of features
@@patloeber thank you sir
thank you so much for giving a complex concept in an easy way I am learning pytorch from your tutorial. please extend to seq2seq model and also make example of language translation in RNN module thank you again
glad you like it!
okay so a quick question.
when i use pytorch. i get very high accuracy in my new data.
but when i use sklearn, though i get very high accuracy too, but i takes less time
why does that happen? isn't sklearn doing the same thing we did ? 🤔
10:53 why do you need to call detach() at line #50 but not at line #34
detach stops a tensor from tracking history. during training we still want this, because we have to apply backpropagation. (so in line 34 we want the gradient). after training in line 50 we don't need this anymore, and can call detach.
Hi Bro,
I couldn't stop thanking you again and again...It was such an amazing explanation.
can we connect in linked-In or in any other platforms aswell?
you are correct. this was just for demo purpose. in later tutorials i use training and testing datasets
you can connect on twitter :) link is in the description below the video
Python Engineer Done lets connect at Twitter thanks a lot
Thank you!
Im confused about why there is no train test split ? How do we test the data ?
the model*
well... I guess maybe it's due to the fact the we already know the data is proportional... so the plot is enough to see that the model is actually correct: it shows a linear equation with the correct slope
Please answer me that why the output_size is 1.
Hello! Why don't we iterate over n_samples in training loop?
it was useful, thank you
another great video!
My plot doesn't show a blue line, but rather every red dot is connected by a blue line. What am I doing wrong?
#plot # detach X keeps the gradients of x from being updated
predicted = model(X).detach().numpy()
plt.plot(x_numpy,y_numpy,"ro")
plt.plot(x_numpy,y_numpy,"b")
plt.show()
Hi, how can I get this interface? Please reply with details
hello, why in the for loop, model input is the X, which has a 100*1 shape, didn't we just define that the model = nn.Linear(1,1), which means input is 1 dim and output is 1 too ?
we have 100 samples and each samples has input_dim= [1]. We only need to define this in our Linear layer.
@@patloeber thank u !
Hello. I just have a question and forgive me as I am still a beginner in ML, what if I have a dataset that contains x, y1, y2. where x is the independent variable and y1 and y2 are the actual values. so basically, the graph shows two plots of (x,y1) and (x,y2). Also, the graph shows a nonlinear trend (goes up and down). Can I still apply this method? Or is there a builtin nonlinear model in torch?
AMAZING,THANK U
Glad you like it!
what is numpy useful for
super cool :D
Thank you man !
Best course (Y)
Thanks for watching!
Can you explain what does it mean:features and samples?
Samples are the items or observations we can use for the training. For example in the iris dataset, we have 150 samples. For each sample, we have a vector of different features that describe the sample. Here we have the 4 features: sepal width / sepal length / petal width / petal length.
@@patloeber thank you!!!
thanks a lot u helped me a lot
Glad to hear that
how come there isnt a def foward function in the model
Please go to his previous video of this series for your answer
Thank you very much for making this series.
I have one doubt though: Why is the value of output_size equal to 1 here? In your previous video, it was set to be equal to n_features...wasn't that example also based on Linear Regression? How do I determine the value the output_size while designing my own models?
output_size is the number of different classes/labels you want to predict. For normal linear regression this is always 1. In the previous tutorial n_features=1 because of the toy dataset I used.
Got you. Thanks a bunch :-)
why does using float32 prevent problems?
Otherwise you get this Runtime "Error RuntimeError: Expected object of scalar type Float but got scalar type Double". At least with the pytorch version I was using at the time of the video. I guess the linear layer needs the tensors to be Float
Thank you for this excellent series.
I am a bit confused about converting Model(X) at line 50, shouldn't we convert y_predicted instead which contains the predicted labels? and does calling model(X) there result in an extra forward pass? why not just use y_predicted.detach().numpy()? Thanks.
Yes that’s an extra forward pass which we do with our final model after the training. I could have also named this last variable y_predicted to be consistent...