Hi, can you explain Question 2, why the data and target are 2 dimensional and 1 dimensional respectively?
data with two rows and a single column, i.e. two samples and a single feature
data = [[1], [2]]
target = [1, 2]
Hi, can you explain Question 2, why the data and target are 2 dimensional and 1 dimensional respectively?
data with two rows and a single column, i.e. two samples and a single feature
data = [[1], [2]]
target = [1, 2]
In scikit-learn, the convention is that X
(or data
) is always a 2-D arrays of shape (n_samples, n_features)
and y
is either a 1-D array of shape (n_samples,)
or if you are modeling several target, it will be a 2-D array of shape (n_samples, n_output)
.