Exemplo n.º 1
0

if __name__ == '__main__':

    my_id = "pk-man"
    #    my_id = "730908575451990f4f3dc625baef4697"
    my_md5 = hashlib.md5(my_id).hexdigest()
    #    my_md5 = "730908575451990f4f3dc625baef4697"
    print my_md5

    try:
        import matplotlib.pyplot as plt
    except:
        print 'Must install matplotlib to run this demo.\n'

    t = Table(smallBlind=1, bigBlind=2, maxBuyIn=200)

    players = []
    for i in range(6):

        #create BasicPlayer that uses GradientBoostingRegressor as machine learning model
        #with wealth of 1 million and 10 discrete choices for raising,
        #with each raise choice .7 times the next largest raise choice
        #Player forgets training samples older than 100,000
        r = GradientBoostingRegressor()
        name = 'Player ' + str(i + 1)
        p = BasicPlayer(name=name,
                        reg=r,
                        bankroll=10000,
                        nRaises=4,
                        rFactor=.7,
Exemplo n.º 2
0
from pklearn import Table
from pklearn.templates import simulate, BasicPlayer
from sklearn.ensemble import GradientBoostingRegressor

if __name__ == '__main__':

    t = Table(smallBlind=1, bigBlind=2, maxBuyIn=200)

    players = []
    for i in range(6):
        
        #create BasicPlayer that uses GradientBoostingRegressor as machine learning model
        #with wealth of 1 million and 10 discrete choices for raising,
        #with each raise choice .7 times the next largest raise choice
        #Player forgets training samples older than 100,000
        r = GradientBoostingRegressor()
        name = 'Player ' + str(i+1)
        p = BasicPlayer(name=name, reg=r, bankroll=10**6, nRaises=10, rFactor=.7, memory=10**5)
        players.append(p)

    for p in players: t.addPlayer(p)

    #simulate 'nHands' hands
    #begin training after 'firstTrain' hands
    #before which players take random actions and explore state space
    #players train every 'nTrain' hands after 'firstTrain'
    #players cash out/ buy in every 'nBuyIn' hands
    #table narrates each hands if 'vocal' is True
    simulate(t, nHands=10000, firstTrain=2000, nTrain=1000, nBuyIn=10)
    simulate(t, nHands=20, nBuyIn=10, vocal=True)
Exemplo n.º 3
0
from pklearn import Table
from pklearn.templates import simulate, BasicPlayer
import numpy as np

from sklearn.cross_validation import cross_val_score
from sklearn.linear_model import LinearRegression, Lasso
from sklearn.ensemble import RandomForestRegressor, GradientBoostingRegressor

if __name__ == '__main__':

    try:
        import matplotlib.pyplot as plt
    except:
        print 'Must install matplotlib to run this demo.\n'

    t = Table(smallBlind=1, bigBlind=2, maxBuyIn=200)

    players = []
    for i in range(6):
        # create BasicPlayer without a machine learning model
        # with wealth of 1 million and 10 discrete choices for raising,
        # with each raise choice .7 times the next largest raise choice
        # Player forgets training samples older than 100,000
        name = 'Player ' + str(i + 1)
        p = BasicPlayer(name=name, bankroll=10 ** 6, nRaises=10, rFactor=.7,
                        memory=10 ** 5)
        players.append(p)

    for p in players: t.addPlayer(p)

    # simulate 1,000 hands, cashing out/buying in every 10 hands, without training or narrating