-2

Showing same accuracy in decision tree and naive bayes algorithm with different symptoms

I tried to get different accuracy but all results are remaining same

this project is about disease prediction

#decision_tree

from sklearn import tree
from sklearn.metrics import accuracy_score

decision_tree = tree.DecisiontTreeClassifier()
decision_tree = decision_tree.fit(train_x,train_y)
res_pred = decision_tree.predict(x_test)
print(accuracy_score(y_test,res_pred))

#naive_bayes

from sklearn.naive_bayes import GaussuanNB
gnb = gnb.fit(train_x,np.ravel(train_y))

y_pred = gnb.predict(x_test)
print(accuracy_score(y_test,y_pred)

result is 0.9512195121951219 all time

desertnaut
  • 57,590
  • 26
  • 140
  • 166

1 Answers1

0

There are often some ML problems which are so simple that almost every model will perform equally well on them. To get different results from both the models, try to change their hyperparameters (like set the max depth of decision tree to 1).

secretive
  • 2,032
  • 7
  • 16