(self, X, y, description="ExperimentName")
Performs a LOOCV.
        
        Args:
            X [dim x num_data] input data to validate on
            y [1 x num_data] classes
Performs a LOOCV.
        
        Args:
            X [dim x num_data] input data to validate on
            y [1 x num_data] classes
Performs a LOOCV . Args : X [ dim x num_data ] input data to validate on y [ 1 x num_data ] classes
def validate(self, X, y, description="ExperimentName"):
        """ Performs a LOOCV.
        
        Args:
            X [dim x num_data] input data to validate on
            y [1 x num_data] classes
        """
        #(X,y) = shuffle(X,y)
        true_positives, false_positives, true_negatives, false_negatives = (0,0,0,0)
        n = y.shape[0]
        for i in range(0,n):
            
            self.logger.info("Processing fold %d/%d." % (i+1, n))
            
            # create train index list
            trainIdx = []
            trainIdx.extend(range(0,i))
            trainIdx.extend(range(i+1,n))
            
            # build training data/test data subset
            Xtrain = [X[t] for t in trainIdx]
            ytrain = y[trainIdx]
            
            # compute the model
            self.model.compute(Xtrain, ytrain)
            
            # get prediction
            prediction = self.model.predict(X[i])[0]
            if prediction == y[i]:
                true_positives = true_positives + 1
            else:
                false_positives = false_positives + 1
                
        self.add(ValidationResult(true_positives, true_negatives, false_positives, false_negatives, description))
def validate ( self , X , y , description = "ExperimentName" ) : #(X,y) = shuffle(X,y) true_positives , false_positives , true_negatives , false_negatives = ( 0 , 0 , 0 , 0 ) n = y . shape [ 0 ] for i in range ( 0 , n ) : self . logger . info ( "Processing fold %d/%d." % ( i + 1 , n ) ) # create train index list trainIdx = [ ] trainIdx . extend ( range ( 0 , i ) ) trainIdx . extend ( range ( i + 1 , n ) ) # build training data/test data subset Xtrain = [ X [ t ] for t in trainIdx ] ytrain = y [ trainIdx ] # compute the model self . model . compute ( Xtrain , ytrain ) # get prediction prediction = self . model . predict ( X [ i ] ) [ 0 ] if prediction == y [ i ] : true_positives = true_positives + 1 else : false_positives = false_positives + 1 self . add ( ValidationResult ( true_positives , true_negatives , false_positives , false_negatives , description ) )