How to fix "Expected sequence or array-like" I am trying to get the accuracy of the model and I am getting this error


  TypeError: Expected sequence or array-like, got 


Here's my code sample.

%matplotlib inline
import matplotlib.pyplot as plt 
import pandas as pd

dataframe = pd.read_csv("WA_Fn-UseC_-HR-Employee-Attrition.csv")

dataframe.head(2)

# spare input and target variables
inputs = dataframe.drop('PerformanceRating', axis='columns')

target = dataframe['PerformanceRating']

from sklearn.preprocessing import LabelEncoder

MaritalStatus_ = LabelEncoder()
JobRole_ = LabelEncoder()
Gender_ = LabelEncoder()
EducationField_ = LabelEncoder()
Department_ = LabelEncoder()
BusinessTravel_ = LabelEncoder()
Attrition_ = LabelEncoder()
OverTime_ = LabelEncoder()
Over18_ = LabelEncoder()

inputs['MaritalStatus_'] = MaritalStatus_.fit_transform(inputs['MaritalStatus'])
inputs['JobRole_'] = JobRole_.fit_transform(inputs['JobRole'])
inputs['Gender_'] = Gender_.fit_transform(inputs['Gender'])
inputs['EducationField_'] = EducationField_.fit_transform(inputs['EducationField'])
inputs['Department_'] = Department_.fit_transform(inputs['Department'])
inputs['BusinessTravel_'] = BusinessTravel_.fit_transform(inputs['BusinessTravel'])
inputs['Attrition_'] = Attrition_.fit_transform(inputs['Attrition'])
inputs['OverTime_'] = OverTime_.fit_transform(inputs['OverTime'])
inputs['Over18_'] = Over18_.fit_transform(inputs['Over18'])


inputs.drop(['MaritalStatus', 'JobRole', 'Attrition' , 'OverTime' , 
                'Gender', 'EducationField', 'Department', 'BusinessTravel', 'Over18'], axis=1, inplace=True)

inputs.rename(columns={'MaritalStatus_':'MaritalStatus', 
                       'JobRole_' : 'JobRole',
                       'Gender_' : 'Gender',
                       'EducationField_' : 'EducationField',
                       'Department_' : 'Department',
                       'BusinessTravel_' : 'BusinessTravel',
                       'Attrition_' : 'Attrition',
                       'OverTime_' : 'OverTime',
                       'Over18_' : 'Over18'}, inplace=True)

inputs.head(2)


from sklearn import preprocessing

scaler = preprocessing.StandardScaler()
scaled_df = scaler.fit_transform(inputs)
scaled_df = pd.DataFrame(scaled_df, columns=inputs.columns)
scaled_df.head()


from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import accuracy_score
import numpy as np

inputs = scaled_df
X_train, X_test, y_train, y_test = train_test_split(inputs, target, test_size=0.2)


model = RandomForestClassifier(ccp_alpha=0.01)

# train
pred = model.fit(X_train, y_train)


from sklearn.metrics import accuracy_score
accuracy_score(X_test,pred) #--------------&gt; this is where I get the error


Can someone help me?
# train
pred = model.fit(X_train, y_train)


Here you are juts fitting the model, not making any predictions.

accuracy_score(X_test,pred)


Here you are supposed to pass y_test, and y_predict, since its the output you are comparing not the input data.

Try this-

pred = model.predict(X_test)
accuracy_score(X_test,pred)