'Scikit-learn has very low accuracy on LOGISTIC REGRESSION, Random Forest, SVM but has high accuracy on linear regression [closed]
This is my dataset
I transformed the columns with string type to float by doing this
df2['Sex'] = df['Sex'].astype('category')
df2['Housing'] = df['Housing'].astype('category')
df2['Saving accounts'] = df['Saving accounts'].astype('category')
df2['Checking account'] = df['Checking account'].astype('category')
df2['Purpose'] = df['Purpose'].astype('category')
To train the model:
train, test = train_test_split(df2, test_size=0.2)
Y_train = pd.DataFrame()
Y_test = pd.DataFrame()
Y_train["score"] = train["score"]
Y_test["score"] = test["score"]
X_train = train.drop('score', 1)
X_test = test.drop('score', 1)
lr = LogisticRegression(penalty='l1', C=0.9, solver='liblinear', n_jobs=-1)
lr.fit(X_train, Y_train)
Y_pred = lr.predict(X_test)
My accuracy with LOGISTIC REGRESSION, RandomForest or SVM is very low
from sklearn.metrics import accuracy_score
accuracy_score(Y_test,Y_pred)
0.05
Solution 1:[1]
Your problem is regression, but you tried classification models (Logistic regression, SVM and RandomForest). You should try RandomForestRegressor, SVR (as opposed to SVC) etc.
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 | lejlot |


