Esempio n. 1
0
    def __init__(
        self,
        state_space_parameters,
        epsilon,
        data_path='./MNIST',
        state=None,
        qstore=None,

        # replay_dictionary = pd.DataFrame(columns=['net',
        #                                         'accuracy_best_val',
        #                                         'accuracy_last_val',       # uncomment while actual training
        #                                         'epsilon',
        #                                         'train_flag'])):
        replay_dictionary=pd.DataFrame(columns=[
            'net', 'loss_inverse', 'loss', 'epsilon', 'computeLoss_flag'
        ])):

        self.state_list = []
        self.data_path = data_path
        # self.bucketed_state_list = []
        self.state_space_parameters = state_space_parameters

        self.enum = se.StateEnumerator(state_space_parameters)
        self.stringutils = StateStringUtils(state_space_parameters)

        self.state = se.State('start', 0, 1, 0, 0,
                              state_space_parameters.image_size, 0,
                              0) if not state else state
        # self.bucketed_state = self.enum.bucket_state(self.state)

        self.qstore = QValues() if not qstore else qstore
        self.replay_dictionary = replay_dictionary

        self.epsilon = epsilon
Esempio n. 2
0
    def __init__(
        self,
        state_space_parameters,
        epsilon,
        WeightInitializer=None,
        device=None,
        args=None,
        save_path=None,
        state=None,
        qstore=None,
        replaydict=None,
        replay_dictionary=pd.DataFrame(columns=[
            'net_disc', 'input_size', 'reward', 'epsilon', 'train_flag'
        ])):
        self.state_list = []
        self.state_space_parameters = state_space_parameters
        self.args = args
        self.enum = se.StateEnumerator(state_space_parameters, args)
        self.stringutils = StateStringUtils(state_space_parameters, args)

        self.state = se.State('start', 0, 1, 0, 0, args.patch_size, 0,
                              0) if not state else state
        self.qstore = QValues() if not qstore else qstore
        if type(qstore) is not type(None):
            self.qstore.load_q_values(qstore_)
            self.replay_dictionary = pd.read_csv(replaydict, index_col=0)
        else:
            self.replay_dictionary = replay_dictionary
        self.epsilon = epsilon
        self.WeightInitializer = WeightInitializer
        self.device = device
        self.gpu_mem_0 = GPUMem(torch.device('cuda') == self.device)
        self.save_path = save_path
        # TODO: hard-coded arc no. to resume from if epsilon < 1
        self.count = args.continue_ite - 1
    def __init__(
        self,
        premise,
        hypothesis,
        epsilon,
        state_space_parameters,
        state=None,
        qstore=None,
        replaydict=None,
        WeightInitializer=None,
        device=None,
        replay_dictionary=pd.DataFrame(columns=[
            'path', 'epsilon', 'accuracy_best_val', 'accuracy_last_val',
            'accuracy_best_test', 'accuracy_last_test', 'ix_q_value_update'
        ])):

        self.state_list = []
        self.state_space_parameters = state_space_parameters
        self.enumerator = se.StateEnumerator(state_space_parameters)
        self.state = se.State('start', premise, 0, self.state_list)
        self.qstore = QValues()

        if type(qstore) is not type(None):
            self.qstore.laod_q_values(qstore)
            self.replay_dictionary = pd.read_csv(replaydict, index_col=0)
        else:
            self.replay_dictionary = replay_dictionary

        self.epsilon = epsilon
        self.WeightInitializer = WeightInitializer
        self.device = device
Esempio n. 4
0
    def __init__(self,
                 state_space_parameters,
                 epsilon,
                 state=None,
                 qstore=None,
                 replay_dictionary=pd.DataFrame(columns=[
                     'net', 'accuracy_best_val', 'accuracy_last_val',
                     'accuracy_best_test', 'accuracy_last_test',
                     'ix_q_value_update', 'epsilon'
                 ])):
        self.state_list = []

        self.state_space_parameters = state_space_parameters

        # Class that will expand states for us
        self.enum = se.StateEnumerator(state_space_parameters)
        self.stringutils = StateStringUtils(state_space_parameters)

        # Starting State
        self.state = se.State('start', 0, 1, 0, 0,
                              state_space_parameters.image_size, 0,
                              0) if not state else state
        self.bucketed_state = self.enum.bucket_state(self.state)

        # Cached Q-Values -- used for q learning update and transition
        self.qstore = QValues() if not qstore else qstore
        self.replay_dictionary = replay_dictionary

        self.epsilon = epsilon  # epsilon: parameter for epsilon greedy strategy
    def __init__(self, state_space_parameters, network_number, qstore=None):

        self.state_list = []

        self.state_space_parameters = state_space_parameters

        # Class that will expand states for us
        self.enum = se.StateEnumerator(state_space_parameters)
        self.stringutils = StateStringUtils(state_space_parameters)

        # Starting State
        self.state = se.State('start', 0, 1, 0, 0, state_space_parameters.image_size, 0, 0, 0, 0, 0, 0, 0, 0, 0)# if not state else state
        self.bucketed_state = self.enum.bucket_state(self.state)

        # Cached Q-Values -- used for q learning update and transition
        self.qstore = QValues() if not qstore else qstore
        # self.replay_dictionary = replay_dictionary

        # self.epsilon=epsilon # epsilon: parameter for epsilon greedy strategy
        self.network_number = network_number
 def __init__(self, state_space_parameters):
     self.image_size = state_space_parameters.image_size
     self.output_number = state_space_parameters.output_states
     self.enum = se.StateEnumerator(state_space_parameters)
 def __init__(self, state_space_parameters, args):
     # TODO: decide on patch-size
     self.image_size = args.patch_size
     # TODO: unnecessary to instantiate StateEnumerator again
     self.enum = se.StateEnumerator(state_space_parameters, args)
     self.ssp = state_space_parameters
 def __init__(self, state_space_parameters, args):
     self.image_size = args.patch_size
     self.ssp = state_space_parameters
     self.enum = se.StateEnumerator(state_space_parameters, args)