'ValueError: Unknown label type: 'continuous' Logistic Regression
Trying to Perform logistic regression on Fuel Economy Dataset
But getting this error:
ValueError: Unknown label type: 'continuous'
Code:
X = fuel.drop('Fuel Economy (MPG)', axis=1).values
y = fuel['Fuel Economy (MPG)'].values
from sklearn.preprocessing import StandardScaler
sc = StandardScaler()
X = sc.fit_transform(X)
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.30)
from sklearn.linear_model import LogisticRegression
logir = LogisticRegression()
logir.fit(X)
Solution 1:[1]
Logistic Regression is for classification problems and can only be used with discrete or categorical values. Here I guess you are trying to predict a car's fuel economy based on its horsepower, so you are predicting a continuous value. For this you should use a Regression algorithm like Linear Regression or SVR.
To learn more about Linear Regression check out this article on ml-concepts.com.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Zero |

