0

i want know Accuracy and confusion matrix for my custom object detection dataset. getting value error

from sklearn.model_selection import train_test_split from sklearn.linear_model import LogisticRegression import pandas as pd import matplotlib.pyplot as plt # plotting import numpy as np # dense matrices from scipy.sparse import csr_matrix # sparse matrices %matplotlib inline df = pd.read_csv('train_labels.csv') df.head(1728) df['class'].value_counts() #Defining features and target variable y = df['class'] #target variable we want to predict X = df.drop(columns = ['class']) #set of required features, in this case all #Splitting the data into train and test set X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25, random_state=42) #Predicting using Logistic Regression for Binary classification LR = LogisticRegression() LR.fit(X_train,y_train) #fitting the model y_pred = LR.predict(X_test) #prediction ValueError: could not convert string to float: '889.jpg' for this line LR.fit(X_train,y_train) #fitting the model

6th Jul 2020, 3:22 PM
Anik Datta
Anik Datta - avatar
3 Answers
0
Logistic regression requires numeric input. You can't use strings in your training dataset
6th Jul 2020, 4:34 PM
Artem Khaiet
Artem Khaiet - avatar
0
Artem Khaiet any way to solve it??
6th Jul 2020, 5:10 PM
Anik Datta
Anik Datta - avatar
0
Anik Datta use a different model...
6th Jul 2020, 5:32 PM
Artem Khaiet
Artem Khaiet - avatar