示例#1
0
    def __init__(self):
        """
		configure
		@param memory: store tuning information
		@param enviroment: implement enviroment----filter
		@param networks: AI
		"""
        # configure the enviroment
        self.myfilter = Filter()

        # configure the networks
        self.net_models = Nnet()

        # configure the memory
        self.data_memory = MemoryD(self.memory_size, self.myfilter.state_size,
                                   self.state_nbr)
        """
		random demostration for calculate the avg qvaluse
		"""
        random_screws = np.zeros((self.random_nr, 2), dtype=np.float64)
        for i in range(self.random_nr):
            random_screws[i] = ([
                random.uniform(self.myfilter.screw_min,
                               self.myfilter.screw_max),
                random.uniform(self.myfilter.screw_min,
                               self.myfilter.screw_max)
            ])

        # Fetch random states
        random_states = self.myfilter.new_tuning(random_screws)
        # dimensionality reduction
        self.dr_random_states = self.myfilter.dimreduction_pca(
            random_states.transpose())
示例#2
0
 def __init__(self):
     self.memory = MemoryD(self.memory_size)
     self.ale = ALE(display_screen="true",
                    skip_frames=4,
                    game_ROM='../libraries/ale/roms/breakout.bin')
     self.nnet = NeuralNet(self.state_size, self.number_of_actions,
                           "ai/deepmind-layers.cfg",
                           "ai/deepmind-params.cfg", "layer4")
示例#3
0
    def __init__(self):
        self.memory = MemoryD(self.memory_size)
        self.minibatch_size = 32  # Given in the paper
        self.number_of_actions = 4  # Game "Breakout" has 4 possible actions

        # Properties of the neural net which come from the paper
        self.nnet = NeuralNet([1, 4, 84, 84],
                              filter_shapes=[[16, 4, 8, 8], [32, 16, 4, 4]],
                              strides=[4, 2],
                              n_hidden=256,
                              n_out=self.number_of_actions)
        self.ale = ALE(self.memory)
示例#4
0
    def __init__(self, game_name, run_id):

        self.number_of_actions = len(action_dict[game_name])
        valid_actions = action_dict[game_name]

        net.layers[-2] = dp.FullyConnected(n_output=self.number_of_actions,
                                           weights=dp.Parameter(
                                               dp.NormalFiller(sigma=0.1),
                                               weight_decay=0.004,
                                               monitor=False))

        self.memory = MemoryD(self.memory_size)

        self.ale = ALE(valid_actions,
                       run_id,
                       display_screen="false",
                       skip_frames=4,
                       game_ROM='ale/roms/' + game_name + '.bin')

        self.nnet = net
        self.q_values = []
        self.test_game_scores = []
示例#5
0
 def __init__(self):
     self.memory = MemoryD(self.memory_size)
     self.ale = ALE(self.memory)
     self.nnet = NeuralNet(self.state_size, self.number_of_actions,
                           "ai/deepmind-layers.cfg",
                           "ai/deepmind-params.cfg", "layer4")
示例#6
0
 def setUp(self):
     self.memory = MemoryD(10)