Example #1
0
 def __init__(self, config):
     LearningAlgorithm.__init__(self, [config, config.logistic])
     self.iterations = config.algorithm.iterations
     self.training_set_data = np.array(self.training_set.data)
     self.training_set_labels = np.array(self.training_set.labels)
     self.classifiers = {}
     for label in set(self.training_set.labels):
         self.logger.debug("Creating classifier for: "+label)
         classifier = LogisticRegression.Classifier(config, self.training_set_data, self.training_set_labels == label)
         self.classifiers[label] = classifier
Example #2
0
    def __init__(self, config):
        LearningAlgorithm.__init__(self, [config, config.nn])
        self.hidden_size = config.nn.hidden_size
        self.momentum =config.nn.momentum
        self.mini_batch_size = config.nn.mini_batch_size

        # Random initialization of weights
        self.input_to_hidden = np.random.rand(self.input_size, self.hidden_size)*2*config.nn.epsilon_init - config.nn.epsilon_init
        self.hidden_to_output = np.random.rand(self.hidden_size, self.output_size)*2*config.nn.epsilon_init - config.nn.epsilon_init

        #Initialize speed matrices
        self.speed = type('Speed', (object,), {'input_to_hidden': None, 'hidden_to_output': None})
        self.speed.input_to_hidden = np.zeros((self.input_size, self.hidden_size))
        self.speed.hidden_to_output = np.zeros((self.hidden_size, self.output_size))
        self.iterations = config.algorithm.iterations
Example #3
0
 def __init__(self, config, training_set_data, training_set_labels):
     LearningAlgorithm.__init__(self, [config, config.logistic])
     self.training_set_data = training_set_data
     self.training_set_labels = training_set_labels
     self.theta = np.zeros(self.input_size)