(self, X, y, g, description="ExperimentName")
TODO Add example and refactor into proper interface declaration.
TODO Add example and refactor into proper interface declaration.
TODO Add example and refactor into proper interface declaration .
def validate(self, X, y, g, description="ExperimentName"):
        """
        TODO Add example and refactor into proper interface declaration.
        """
        true_positives, false_positives, true_negatives, false_negatives = (0,0,0,0)
        
        for i in range(0,len(np.unique(y))):
            self.logger.info("Validating Class %s." % i)
            # create folds
            trainIdx = np.where(y!=i)[0]
            testIdx = np.where(y==i)[0]
            # build training data/test data subset
            Xtrain = [X[t] for t in trainIdx]
            gtrain = g[trainIdx]
            
            # Compute the model, this time on the group:
            self.model.compute(Xtrain, gtrain)
            
            for j in testIdx:
                # get prediction
                prediction = self.model.predict(X[j])[0]
                if prediction == g[j]:
                    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 , g , description = "ExperimentName" ) : true_positives , false_positives , true_negatives , false_negatives = ( 0 , 0 , 0 , 0 ) for i in range ( 0 , len ( np . unique ( y ) ) ) : self . logger . info ( "Validating Class %s." % i ) # create folds trainIdx = np . where ( y != i ) [ 0 ] testIdx = np . where ( y == i ) [ 0 ] # build training data/test data subset Xtrain = [ X [ t ] for t in trainIdx ] gtrain = g [ trainIdx ] # Compute the model, this time on the group: self . model . compute ( Xtrain , gtrain ) for j in testIdx : # get prediction prediction = self . model . predict ( X [ j ] ) [ 0 ] if prediction == g [ j ] : true_positives = true_positives + 1 else : false_positives = false_positives + 1 self . add ( ValidationResult ( true_positives , true_negatives , false_positives , false_negatives , description ) )