LSH/ANN.py
def tune(self, validationData, validationLabels, hyperparamsToTest):
        '''
        Given validation data and labels, test all hyperparameters provided
        on the data and maintain the hyperparameter that provided for the best
        results.
        @param validationData a 2D numpy array containing the validation data
        @param validationLabels a 1D numpy array containing the validation data labels
        @param hyperparamsToTest an iterable containing the entire array of hyper-parameters 
                (values for L) to test.
        @raise LogicalError if hyperparamsToTest is not an iterable, None or Empty
        @return the optimal value of L
        '''
        
        try:
            len(hyperparamsToTest)
        except TypeError:
            raise LogicalError, "Method ANN.tune(): need to provide an iterable for third argument."
        self.printAloneMsg = False
        if hyperparamsToTest is None or len(hyperparamsToTest) == 0:
            raise LogicalError, "Method ANN.tune(): need to provide hyper-parameters."
        bestAccuracy = 0.0
        for h in hyperparamsToTest:
            accuracy = self.test(validationData, validationLabels, h)
            if accuracy > bestAccuracy:
                bestAccuracy = accuracy
                self.L = h
        self.printAloneMsg = True
        return self.L

        Given validation data and labels, test all hyperparameters provided
        on the data and maintain the hyperparameter that provided for the best
        results.
        @param validationData a 2D numpy array containing the validation data
        @param validationLabels a 1D numpy array containing the validation data labels
        @param hyperparamsToTest an iterable containing the entire array of hyper-parameters 
                (values for L) to test.
        @raise LogicalError if hyperparamsToTest is not an iterable, None or Empty
        @return the optimal value of L
        
Given validation data and labels, test all hyperparameters provided
on the data and maintain the hyperparameter that provided for the best
results.
@param validationData a 2D numpy array containing the validation data
@param validationLabels a 1D numpy array containing the validation data labels
@param hyperparamsToTest an iterable containing the entire array of hyper-parameters
(values for L) to test.
@raise LogicalError if hyperparamsToTest is not an iterable, None or Empty
@return the optimal value of L
Given validation data and labels test all hyperparameters provided on the data and maintain the hyperparameter that provided for the best results . @param validationData a 2D numpy array containing the validation data @param validationLabels a 1D numpy array containing the validation data labels @param hyperparamsToTest an iterable containing the entire array of hyper - parameters ( values for L ) to test . @raise LogicalError if hyperparamsToTest is not an iterable None or Empty @return the optimal value of L
def tune(self, validationData, validationLabels, hyperparamsToTest):
        try:
            len(hyperparamsToTest)
        except TypeError:
            raise LogicalError, "Method ANN.tune(): need to provide an iterable for third argument."
        self.printAloneMsg = False
        if hyperparamsToTest is None or len(hyperparamsToTest) == 0:
            raise LogicalError, "Method ANN.tune(): need to provide hyper-parameters."
        bestAccuracy = 0.0
        for h in hyperparamsToTest:
            accuracy = self.test(validationData, validationLabels, h)
            if accuracy > bestAccuracy:
                bestAccuracy = accuracy
                self.L = h
        self.printAloneMsg = True
        return self.L
def tune ( self , validationData , validationLabels , hyperparamsToTest ) : try : len ( hyperparamsToTest ) except TypeError : raise LogicalError , "Method ANN.tune(): need to provide an iterable for third argument." self . printAloneMsg = False if hyperparamsToTest is None or len ( hyperparamsToTest ) == 0 : raise LogicalError , "Method ANN.tune(): need to provide hyper-parameters." bestAccuracy = 0.0 for h in hyperparamsToTest : accuracy = self . test ( validationData , validationLabels , h ) if accuracy > bestAccuracy : bestAccuracy = accuracy self . L = h self . printAloneMsg = True return self . L
Given validation data and labels, test all hyperparameters provided
on the data and maintain the hyperparameter that provided for the best
results.
Given validation data and labels test all hyperparameters provided on the data and maintain the hyperparameter that provided for the best results .
'''
        Given validation data and labels, test all hyperparameters provided
        on the data and maintain the hyperparameter that provided for the best
        results.
        @param validationData a 2D numpy array containing the validation data
        @param validationLabels a 1D numpy array containing the validation data labels
        @param hyperparamsToTest an iterable containing the entire array of hyper-parameters 
                (values for L) to test.
        @raise LogicalError if hyperparamsToTest is not an iterable, None or Empty
        @return the optimal value of L
        '''
self
validationData
validationLabels
hyperparamsToTest