pytorch-deep-learning
pytorch-deep-learning copied to clipboard
02_pytorch_classificatio_video odd make_circles behavior
OK sorry. I went on working and had reason to rerun the whole thing and then the X_train was an array. I still don't know why the below did that, but it does not once I rerun everything. Maybe this is a reasonable thing to do now and then anyway. Just run all, especially when something doesn't make sense.
In the video (at about 9:12) you create the data using make_circles and it returns a numpy array for X and y. Later this is converted to tensors. But what I see is make_circles is returning a tensor. I don't know if something in the make_circles is changed. But the documentation still says it returns a numpy array. Below is code and output.
torch.version '2.0.0'
from sklearn.datasets import make_circles n_samples = 1000
X, y = make_circles(n_samples, noise=0.03, random_state=12) len(X), len(y)
X, y (tensor([[ 0.7629, 0.2129], [-0.0135, -0.7828], [-0.6789, -0.4260], ..., [ 0.2143, -0.9870], [-0.4084, 0.7029], [-0.3432, -0.7142]]), tensor([1., 1., 1., 0., 0., 1., 1., 1., 1., 0., 1., 0., 1., 1., 0., 1., 0., 1.,
Could you format the above text in a better way, please highlight what are the code lines. Makes it easy to interpret, I'll try my best to reproduce!
I tried your above mentioned code on a Google Colab instance. I got data type for X and y as <class 'numpy.ndarray'> for both the variables. Maybe there is an inconsistency in your environment.
Refer notebook
I commented the output lines . What was happening was that I called make_circles. Then I output X, y to see them. And they were already tensors. I still do not know why that happened, but once I re-ran the whole program from the start, I did not see this happen again. Now any time I see an unexpected result I first re-run everything to see if that clears it. My environment is probably different. I use jupyter notebook, And the versions of sklearn and pytorch are newer than what is in the course. I don't know what versions Colab has now. Mine is: pytorch - 2.0.0 sklearn - 1.2.1
Hi @RayWagner ,
You're likely see an example of Jupyter Notebook state.
For example, when you run a particular cell, the notebook will often keep the "state" of that cell for as long as possible.
This includes when running new cells above/below the original cell.
To remove the state, you can either:
- Restart the notebook (like you have)
- Override the state by running a similar cell/the same original cell with changed information
Hi Daniel,
Yes, I have seen that and usually I go back and run all the cells. Now and then I also restart it and clear everything.
What I have seen recently is the model seems to keep its state when run more times as I change parameters. So I see the loss curve start where it is already pretty low.
Great video. I have really enjoyed working on pytorch.
I am trying to work on a stock predicting model now and all the examples I found for LSTM and GRU were in tensorflow. I have had to try my best to work with it. Same theories, but the syntax for the model is very different. But it has been fun. Being retired allows me to just have a good time with it.
My new strategy I have been preparing will go back to pytorch because I want to use the stock chart data more as a visual image. I think I can use some of the things you presented in the video. I am thinking of using dense, and CNN and see how that works.
I just have to prepare the data. That is time consuming. I will also use the idea from the video of the files being in a directory that is the label name. That was cool, and I can use that.
Well, I would have a million things to chat about but I understand this is not the way to do that.
Best wished and thanks so much for such a great video tutorial.
Best Regards,
Ray
From: Daniel Bourke @.> Sent: Thursday, June 1, 2023 9:13 PM To: mrdbourke/pytorch-deep-learning @.> Cc: RayWagner @.>; Mention @.> Subject: Re: [mrdbourke/pytorch-deep-learning] 02_pytorch_classificatio_video odd make_circles behavior (Issue #401)
Hi @RayWagner https://github.com/RayWagner ,
You're likely see an example of Jupyter Notebook state.
For example, when you run a particular cell, the notebook will often keep the "state" of that cell for as long as possible.
This includes when running new cells above/below the original cell.
To remove the state, you can either:
- Restart the notebook (like you have)
- Override the state by running a similar cell/the same original cell with changed information
— Reply to this email directly, view it on GitHub https://github.com/mrdbourke/pytorch-deep-learning/issues/401#issuecomment-1572985106 , or unsubscribe https://github.com/notifications/unsubscribe-auth/A7FWYCMHEPE4JZRVJF2LCN3XJE4YZANCNFSM6AAAAAAW6QCO6A . You are receiving this because you were mentioned. https://github.com/notifications/beacon/A7FWYCNUSEA7D2XOAATI62LXJE4YZA5CNFSM6AAAAAAW6QCO6CWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTS5YHMRE.gif Message ID: @.*** @.***> >