Linear Regression Health cost calculator error

Project Link: Google Colaboratory

When i am trying to divide the dataset into training and testing it returnes an error:

I AM NOT ABLE TO PROCEED FURTHER. I HAVE DONE THE REMAINING PROJECT

Welcome to the forums @veerdosi. Glad you posted a link to your notebook, as it’s always better to have that or the error message than an image of an error message.

It looks to me from the tf docs that you need to have a dataset with labels before you use tdfs.load() to split it. I believe your code would actually try to split the data labelled train by the first 80% and the last 20%, but you have a pandas dataframe without labels.

The example in the docs that’s most similar to yours is

# The first 10% of train split.
train_10pct_ds = tfds.load('mnist', split='train[:10%]')

which appears to be using the part of mnist labelled train and returning the first 10%.

There are many other ways to split a data set for testing and training and I believe those would be easier than adding labels to the current dataset.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.