this is my code:
class Morpion:
def __init__(self):
self.clf = tree.DecisionTreeClassifier()
self.scaler = preprocessing.StandardScaler()
def ai_player_joue(self,joueur,list_mvt_possible):
list_mvt_possible_copy=copy.deepcopy(list_mvt_possible)
for i in range (0,len(list_mvt_possible_copy)):
list_mvt_possible_copy[i]=self.convert_plateau(np.array(list_mvt_possible_copy[i]).reshape(-1)).astype(np.float64)
self.scaler = preprocessing.StandardScaler().fit(list_mvt_possible_copy)
X_test=self.scaler.transform(list_mvt_possible_copy)
self.clf.fit(X_test,list_mvt_possible_copy)
proba_success_mvt=self.clf.predict_proba(X_test)
indice_mvt=0
for i in range (0, len(proba_success_mvt)):
if(proba_success_mvt[indice_mvt]<proba_success_mvt[i]):
indice_mvt=i
self.plateau=list_mvt_possible[indice_mvt]
When I start my script I get this error:
Traceback (most recent call last):
File "morpion.py", line 282, in <module>
morpion.train_ai_jeu()
File "morpion.py", line 86, in train_ai_jeu
sauvegarde_plateaux, result = self.ai_jeu(i)
File "morpion.py", line 55, in ai_jeu
self.ai_player_joue(self.J2,list_mvt_possible)
File "morpion.py", line 204, in ai_player_joue
if(proba_success_mvt[indice_mvt]<proba_success_mvt[i]):
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
I try some solution found her and on the web, but nothing works.