--

Don’t you have the dependent and independent variables backward?

For example, if the target column is the last one, you can create the matrix of dependent variables by typing:

X = dataset.iloc[:, :-1].values

That first colon (:) means that we want to take all the lines in our dataset. : -1 means that we want to take all of the columns of data except the last one. The .values on the end means that we want all of the values.

To have a vector of independent variables with only the data from the last column, you can type

y = dataset.iloc[:, -1].values

--

--

Robert (Bob) Hoyt MD FACP ABPM-CI FAMIA
Robert (Bob) Hoyt MD FACP ABPM-CI FAMIA

No responses yet