1
$\begingroup$

Why the dataset need to use X as attributes and y as label? WHy not use a X to have it all?

Fruit dataset

$\endgroup$

2 Answers 2

0
$\begingroup$

You could indeed use an X to have it all. However your downstream models expect the features and labels (I.e. Xs and ys) to be referenced via different object pointers in order to train and evaluate the model.

E.g

model.fit(X,y)

$\endgroup$
0
$\begingroup$

X is what your model uses to make a prediction, y is the right answer you want it to give. If you include y in X, then you are giving the model the right answer as input. It's really easy to make a prediction that way, because it will pass the y from the input straight to the output. If you did this and you looked at feature importance, you would see that the only "feature" that matters is the one that directly contains the answer.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.