コード例 #1
0
        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,
                        memory=10**5)
        p.stopTraining()
        players.append(p)

    for p in players:
        t.addPlayer(p)

    #train Player 1 for 1000 hands, training once
    players[0].startTraining()
    simulate(t, nHands=2000, nTrain=100, nBuyIn=10)
    players[0].stopTraining()

    #for p in players: p.setBankroll(10**6)
コード例 #2
0
ファイル: cross_val_demo.py プロジェクト: ziiin/poker-learn
    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
    simulate(t, nHands=1000, nBuyIn=10, nTrain=0, vocal=False)

    features = []
    labels = []

    for p in players:
        features.extend(p.getFeatures())