I want to use random forest algorithm. The error is "setting an array element with a sequence." type(s)=dataframe. type(data)=dataframe the error is in rf.fit(inputs_train, expected_output_train)
data_inputs = s[["year_int","month_of_year_int","day_of_month_int","day_of_week_int","day_of_year_int"]]
expected_output = data[["SchDep"]]
inputs_train, inputs_test, expected_output_train, expected_output_test = train_test_split(data_inputs, expected_output,test_size = 0.33, random_state = 42)
rf = RandomForestClassifier(n_estimators = 100)
rf.fit(inputs_train, expected_output_train)
accuracy = rf.score(inputs_test, expected_output_test)
print("Accuracy = {}% ".format(accuracy*100))
Aucun commentaire:
Enregistrer un commentaire