Help with an error in passing data to an IA through partial_fit ()

0

I am trying to get an AI to play collect data and learn, everything fumitates correctly, but at the time of passing on the collected data so that it learns about the following error:

  

ValueError: Found input variables with inconsistent numbers of samples: [1, 2]

This is the code

collect_target = []
collect_data = []

while jugar == 0:

    Player = input()
    if Player=="salir":
        jugar = 1
    elif Player=="entrenar":
        train_target=traductor(0,1,x_palabra,x_numero,collect_target)
        train_data=traductor(0,1,y_palabra,y_numero,collect_data)
        print(train_target)
        print(train_data)
        soldado = soldado.partial_fit([train_target],train_data)
    else:
        jugada = soldado.predict_proba([traductor(0,0,x_palabra,x_numero,Player)])[0]
        if jugada[0] >= 0.8:
            IA = action[0]
        elif jugada[1] >= 0.8:
            IA = action[1]
        else:
            IA = azar(action)
        mision = good(Player,IA)
        if mision==0:
            print("Entity: %s Action: %s Mision Cumplida" %(Player,IA))
            score["win"]+=1
            collect_target.append(Player)
            collect_data.append(IA)
        elif mision==1:
            print("Entity: %s Action: %s Mision Fallida" %(Player,IA))
            score["loose"]+=1
    
asked by Jose Francisco Murga 06.03.2018 в 22:27
source

1 answer

0

I already found the solution, it turns out that the second parameter had to enter it as a matrix It was:

  

soldier = soldier.partial_fit ([train_target], train_data)

And it had to be:

  

soldier = soldier.partial_fit ([train_target], [train_data])

    
answered by 06.03.2018 в 23:35