-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom Dataset class on Chapter_1 #6
Comments
Do you know if this was a change in scikit learn recently? |
I don't know, currently, I'm using the newer (1.0.2) during the study of your the book: |
Yup, they changed it. I'll fix this soon - thank you for the catch! |
Changing the getitem function by adding .loc after the dataframe seems to solve the issue. Still working my way past this point but atleast I now got the same output as the book. def getitem(self, index): |
I encountered this today and made a comment in the livebook from manning. I think this solution is better than what i suggested there. If i change self.X = X.to_numpy() does that casuse problems down the road about being able to benefit from pytorch? Great book im really enjoying it. |
I used
|
a little tedious for me about murphyk's solution since it converts X to tensor and then back to numpy again. 'X, y = fetch_openml("mnist_784", version=1, return_X_y=True, as_frame=False)' this solution is very good. thanks, LucianoBatista |
another solution seems good, just fyi X, y = fetch_openml("mnist_784", version=1, return_X_y=True) # no need to change here
class SimpleDataset(Dataset):
def __init__(self, X, y):
super(SimpleDataset, self).__init__()
self.X = X.values # get the numpy data via values
self.y = y.values # get the numpy data via values
dataset = SimpleDataset(X, y)
example, label = dataset[0] |
@LucianoBatista: Thanks for your solution! I ran into the same problem. I created a pull request. |
Hi, I was getting the followed erro when I executing this code:
The same was fixed when I change the code of the fetch_openml to:
The problem was that whithout the as_frame, scikit will import the data as a DataFrame, not as numpy anymore.
The text was updated successfully, but these errors were encountered: