2

我得到如下数据文件:

|HandPercentage 0.5958  |NoOfPlayersInPlay 2    |HeroPosition 5 |Pot 1.00   |Player0 0 0.00 100.00  |Player1 1 0.00 100.00  |Player2 2 0.00 100.00  |Player3 3 0.00 100.00  |Player4 4 1.00 99.00   |Player5 5 0.00 100.00  |Action 0 0 1
|HandPercentage 0.5958  |NoOfPlayersInPlay 2    |HeroPosition 5 |Pot 2.00   |Player0 0 0.00 100.00  |Player1 1 0.00 100.00  |Player2 2 0.00 100.00  |Player3 3 0.00 100.00  |Player4 4 2.00 98.00   |Player5 5 0.00 100.00  |Action 0 1 0
|HandPercentage 0.5958  |NoOfPlayersInPlay 2    |HeroPosition 5 |Pot 3.00   |Player0 0 0.00 100.00  |Player1 1 0.00 100.00  |Player2 2 0.00 100.00  |Player3 3 0.00 100.00  |Player4 4 3.00 97.00   |Player5 5 0.00 100.00  |Action 0 1 0
|HandPercentage 0.5958  |NoOfPlayersInPlay 2    |HeroPosition 5 |Pot 4.00   |Player0 0 0.00 100.00  |Player1 1 0.00 100.00  |Player2 2 0.00 100.00  |Player3 3 0.00 100.00  |Player4 4 4.00 96.00   |Player5 5 0.00 100.00  |Action 0 1 0
|HandPercentage 0.5958  |NoOfPlayersInPlay 2    |HeroPosition 5 |Pot 5.00   |Player0 0 0.00 100.00  |Player1 1 0.00 100.00  |Player2 2 0.00 100.00  |Player3 3 0.00 100.00  |Player4 4 5.00 95.00   |Player5 5 0.00 100.00  |Action 0 1 0
|HandPercentage 0.5958  |NoOfPlayersInPlay 2    |HeroPosition 5 |Pot 6.00   |Player0 0 0.00 100.00  |Player1 1 0.00 100.00  |Player2 2 0.00 100.00  |Player3 3 0.00 100.00  |Player4 4 6.00 94.00   |Player5 5 0.00 100.00  |Action 0 1 0
|HandPercentage 0.5958  |NoOfPlayersInPlay 2    |HeroPosition 5 |Pot 7.00   |Player0 0 0.00 100.00  |Player1 1 0.00 100.00  |Player2 2 0.00 100.00  |Player3 3 0.00 100.00  |Player4 4 7.00 93.00   |Player5 5 0.00 100.00  |Action 0 1 0
|HandPercentage 0.5958  |NoOfPlayersInPlay 2    |HeroPosition 5 |Pot 8.00   |Player0 0 0.00 100.00  |Player1 1 0.00 100.00  |Player2 2 0.00 100.00  |Player3 3 0.00 100.00  |Player4 4 8.00 92.00   |Player5 5 0.00 100.00  |Action 0 1 0
|HandPercentage 0.5958  |NoOfPlayersInPlay 2    |HeroPosition 5 |Pot 9.00   |Player0 0 0.00 100.00  |Player1 1 0.00 100.00  |Player2 2 0.00 100.00  |Player3 3 0.00 100.00  |Player4 4 9.00 91.00   |Player5 5 0.00 100.00  |Action 0 1 0
|HandPercentage 0.5958  |NoOfPlayersInPlay 2    |HeroPosition 5 |Pot 100.00 |Player0 0 0.00 100.00  |Player1 1 0.00 100.00  |Player2 2 0.00 100.00  |Player3 3 0.00 100.00  |Player4 4 100.00 0.00  |Player5 5 0.00 100.00  |Action 0 1 0
|HandPercentage 0.5958  |NoOfPlayersInPlay 2    |HeroPosition 5 |Pot 10.00  |Player0 0 0.00 100.00  |Player1 1 0.00 100.00  |Player2 2 0.00 100.00  |Player3 3 0.00 100.00  |Player4 4 10.00 90.00  |Player5 5 0.00 100.00  |Action 0 1 0
|HandPercentage 0.5958  |NoOfPlayersInPlay 2    |HeroPosition 5 |Pot 15.00  |Player0 0 0.00 100.00  |Player1 1 0.00 100.00  |Player2 2 0.00 100.00  |Player3 3 0.00 100.00  |Player4 4 15.00 85.00  |Player5 5 0.00 100.00  |Action 0 1 0
|HandPercentage 0.5958  |NoOfPlayersInPlay 2    |HeroPosition 5 |Pot 20.00  |Player0 0 0.00 100.00  |Player1 1 0.00 100.00  |Player2 2 0.00 100.00  |Player3 3 0.00 100.00  |Player4 4 20.00 80.00  |Player5 5 0.00 100.00  |Action 0 1 0
|HandPercentage 0.5958  |NoOfPlayersInPlay 2    |HeroPosition 5 |Pot 30.00  |Player0 0 0.00 100.00  |Player1 1 0.00 100.00  |Player2 2 0.00 100.00  |Player3 3 0.00 100.00  |Player4 4 30.00 70.00  |Player5 5 0.00 100.00  |Action 0 1 0
|HandPercentage 0.5958  |NoOfPlayersInPlay 2    |HeroPosition 5 |Pot 40.00  |Player0 0 0.00 100.00  |Player1 1 0.00 100.00  |Player2 2 0.00 100.00  |Player3 3 0.00 100.00  |Player4 4 40.00 60.00  |Player5 5 0.00 100.00  |Action 0 1 0
|HandPercentage 0.5958  |NoOfPlayersInPlay 2    |HeroPosition 5 |Pot 50.00  |Player0 0 0.00 100.00  |Player1 1 0.00 100.00  |Player2 2 0.00 100.00  |Player3 3 0.00 100.00  |Player4 4 50.00 50.00  |Player5 5 0.00 100.00  |Action 0 0 1
|HandPercentage 0.5958  |NoOfPlayersInPlay 2    |HeroPosition 5 |Pot 60.00  |Player0 0 0.00 100.00  |Player1 1 0.00 100.00  |Player2 2 0.00 100.00  |Player3 3 0.00 100.00  |Player4 4 60.00 40.00  |Player5 5 0.00 100.00  |Action 0 1 0
|HandPercentage 0.5958  |NoOfPlayersInPlay 2    |HeroPosition 5 |Pot 70.00  |Player0 0 0.00 100.00  |Player1 1 0.00 100.00  |Player2 2 0.00 100.00  |Player3 3 0.00 100.00  |Player4 4 70.00 30.00  |Player5 5 0.00 100.00  |Action 0 1 0
|HandPercentage 0.5958  |NoOfPlayersInPlay 2    |HeroPosition 5 |Pot 80.00  |Player0 0 0.00 100.00  |Player1 1 0.00 100.00  |Player2 2 0.00 100.00  |Player3 3 0.00 100.00  |Player4 4 80.00 20.00  |Player5 5 0.00 100.00  |Action 0 1 0
|HandPercentage 0.5958  |NoOfPlayersInPlay 2    |HeroPosition 5 |Pot 90.00  |Player0 0 0.00 100.00  |Player1 1 0.00 100.00  |Player2 2 0.00 100.00  |Player3 3 0.00 100.00  |Player4 4 90.00 10.00  |Player5 5 0.00 100.00  |Action 0 1 0
|HandPercentage 0.5958  |NoOfPlayersInPlay 3    |HeroPosition 3 |Pot 0.00   |Player0 0 0.00 100.00  |Player1 1 0.00 100.00  |Player2 2 0.00 100.00  |Player3 3 0.00 100.00  |Player4 4 0.00 100.00  |Player5 5 0.00 100.00  |Action 0 0 1
|HandPercentage 0.5958  |NoOfPlayersInPlay 2    |HeroPosition 5 |Pot 1.00   |Player0 0 0.00 100.00  |Player1 1 0.00 100.00  |Player2 2 0.00 100.00  |Player3 3 1.00 99.00   |Player4 4 0.00 100.00  |Player5 5 0.00 100.00  |Action 0 1 0
|HandPercentage 0.5958  |NoOfPlayersInPlay 2    |HeroPosition 5 |Pot 2.00   |Player0 0 0.00 100.00  |Player1 1 0.00 100.00  |Player2 2 0.00 100.00  |Player3 3 2.00 98.00   |Player4 4 0.00 100.00  |Player5 5 0.00 100.00  |Action 0 1 0
|HandPercentage 0.5958  |NoOfPlayersInPlay 2    |HeroPosition 5 |Pot 3.00   |Player0 0 0.00 100.00  |Player1 1 0.00 100.00  |Player2 2 0.00 100.00  |Player3 3 3.00 97.00   |Player4 4 0.00 100.00  |Player5 5 0.00 100.00  |Action 0 1 0
|HandPercentage 0.5958  |NoOfPlayersInPlay 2    |HeroPosition 5 |Pot 4.00   |Player0 0 0.00 100.00  |Player1 1 0.00 100.00  |Player2 2 0.00 100.00  |Player3 3 4.00 96.00   |Player4 4 0.00 100.00  |Player5 5 0.00 100.00  |Action 0 1 0
|HandPercentage 0.5958  |NoOfPlayersInPlay 2    |HeroPosition 5 |Pot 7.00   |Player0 0 0.00 100.00  |Player1 1 0.00 100.00  |Player2 2 0.00 100.00  |Player3 3 7.00 93.00   |Player4 4 0.00 100.00  |Player5 5 0.00 100.00  |Action 1 0 0
|HandPercentage 0.5958  |NoOfPlayersInPlay 2    |HeroPosition 5 |Pot 8.00   |Player0 0 0.00 100.00  |Player1 1 0.00 100.00  |Player2 2 0.00 100.00  |Player3 3 8.00 92.00   |Player4 4 0.00 100.00  |Player5 5 0.00 100.00  |Action 1 0 0
|HandPercentage 0.5958  |NoOfPlayersInPlay 3    |HeroPosition 4 |Pot 1.00   |Player0 0 0.00 100.00  |Player1 1 0.00 100.00  |Player2 2 0.00 100.00  |Player3 3 1.00 99.00   |Player4 4 0.00 100.00  |Player5 5 0.00 100.00  |Action 0 1 0
|HandPercentage 0.5958  |NoOfPlayersInPlay 3    |HeroPosition 4 |Pot 2.00   |Player0 0 0.00 100.00  |Player1 1 0.00 100.00  |Player2 2 0.00 100.00  |Player3 3 2.00 98.00   |Player4 4 0.00 100.00  |Player5 5 0.00 100.00  |Action 0 1 0
|HandPercentage 0.5958  |NoOfPlayersInPlay 3    |HeroPosition 4 |Pot 100.00 |Player0 0 0.00 100.00  |Player1 1 0.00 100.00  |Player2 2 0.00 100.00  |Player3 3 100.00 0.00  |Player4 4 0.00 100.00  |Player5 5 0.00 100.00  |Action 0 1 0
|HandPercentage 0.5958  |NoOfPlayersInPlay 3    |HeroPosition 5 |Pot 2.00   |Player0 0 0.00 100.00  |Player1 1 0.00 100.00  |Player2 2 0.00 100.00  |Player3 3 1.00 99.00   |Player4 4 1.00 99.00   |Player5 5 0.00 100.00  |Action 0 1 0

我在 python 中使用 CNTK,我的阅读器如下所示:

def create_reader(path):
    streams = CTFDeserializer(path, StreamDefs(
        HandPercentage = StreamDef(field='HandPercentage', shape=input_dim,   is_sparse=False),
        NoOfPlayersInPlay = StreamDef(field='NoOfPlayersInPlay', shape=input_dim,   is_sparse=False),
        HeroPosition = StreamDef(field='HeroPosition', shape=input_dim,   is_sparse=False),
        Pot = StreamDef(field='Pot', shape=input_dim,   is_sparse=False),
        Player0 = StreamDef(field='Player0', shape=player_dim,   is_sparse=False),
        Player1 = StreamDef(field='Player1', shape=player_dim,   is_sparse=False),
        Player2 = StreamDef(field='Player2', shape=player_dim,   is_sparse=False),
        Player3 = StreamDef(field='Player3', shape=player_dim,   is_sparse=False),
        Player4 = StreamDef(field='Player4', shape=player_dim,   is_sparse=False),
        Player5 = StreamDef(field='Player5', shape=player_dim,   is_sparse=False),
        labels  = StreamDef(field='Action', shape=label_dim,   is_sparse=False)))
    return MinibatchSource(streams)

当我需要训练我的模型时,我需要将所有节点放在一起,我创建一个 input_map,如下所示:

input_dim = 1
player_dim = 3
label_dim = 3

....

HandPercentage = Input(input_dim,  is_sparse=False)
NoOfPlayersInPlay = Input(input_dim,  is_sparse=False)
HeroPosition = Input(input_dim,  is_sparse=False)
Pot = Input(input_dim,  is_sparse=False)
Player0 = Input(player_dim,  is_sparse=False)
Player1 = Input(player_dim,  is_sparse=False)
Player2 = Input(player_dim,  is_sparse=False)
Player3 = Input(player_dim,  is_sparse=False)
Player4 = Input(player_dim,  is_sparse=False)
Player5 = Input(player_dim,  is_sparse=False)
labels = Input(label_dim, is_sparse=False)  # TODO: make sparse once it works

input_map = {
    HandPercentage : reader.streams.HandPercentage,
    NoOfPlayersInPlay : reader.streams.NoOfPlayersInPlay,
    HeroPosition : reader.streams.HeroPosition,
    Pot : reader.streams.Pot,
    Player0 : reader.streams.Player0,
    Player1 : reader.streams.Player1,
    Player2 : reader.streams.Player2,
    Player3 : reader.streams.Player3,
    Player4 : reader.streams.Player4,
    Player5 : reader.streams.Player5,
    labels : reader.streams.labels
}

我想将它们连接在一起,然后将它们传递到我的火车模型中:

inputs = []
inputs.append(HandPercentage)
inputs.append(NoOfPlayersInPlay)
inputs.append(HeroPosition)
inputs.append(Pot)
inputs.append(Player0)
inputs.append(Player1)
inputs.append(Player2)
inputs.append(Player3)
inputs.append(Player4)
inputs.append(Player5)

features = inputs

# apply model to input
z = model(features)

有谁知道我怎么能在 BrainScript 中做类似 RowStack 的事情?

4

1 回答 1

2

既然您拥有所有密集特征,为什么不将所有输入连接到一个平面特征向量中,以便在您生成输入文件时开始(如果可能)。

于 2017-01-24T05:45:07.813 回答