lorserker / ben

a game engine for bridge
GNU General Public License v3.0
41 stars 30 forks source link

Re-Use of the models #80

Closed eherrera1971 closed 10 months ago

eherrera1971 commented 10 months ago

Hi With TensorFlow 2. What is the logic of the input of a model like "bidding.h5" so I can re-used? In other words, If I have:

from tensorflow.keras.models import load_model model = load_model('bidding.h5') output = model.predict(myInput)

how to convert the cards and current state of the action into myInput?

Thanks, Eduardo.

ThorvaldAagaard commented 10 months ago

When I converted to Keras I was told, that Keras would keep the state, so the state management should not be implemented. What I have seen is that the because the bidding is an sequence of 8 bidding round Keras want 8 bidding rounds as input, so when bidding first round I just fill the other 7 rounds with zeroes. Then when I come to the second round I include bidding for the first round in the 8 sequences sent in the request, and so on

But Keras is about 4 times slower and the training went from hours to days, so currently it is on stand-by.

In bidding_info_h5.ipynb there is an example of how I read the bidding info, perhaps that is useful for you.

The important method to see how the input is created is the function: get_auction_binary