# Path: facerec_py/facerec/model.py
# class PredictableModel(AbstractPredictableModel):
#     def __init__(self, feature, classifier):
#         super(PredictableModel, self).__init__()
#         if not isinstance(feature, AbstractFeature):
#             raise TypeError("feature must be of type AbstractFeature!")
#         if not isinstance(classifier, AbstractClassifier):
#             raise TypeError("classifier must be of type AbstractClassifier!")
# 
#         self.feature = feature
#         self.classifier = classifier
# 
#     def compute(self, X, y):
#         features = self.feature.compute(X, y)
#         self.classifier.compute(features, y)
# 
#     def predict(self, X):
#         q = self.feature.extract(X)
#         return self.classifier.predict(q)
# 
#     def __repr__(self):
#         feature_repr = repr(self.feature)
#         classifier_repr = repr(self.classifier)
#         return "%s(feature=%s, classifier=%s)" % (self.__class__.__name__, feature_repr, classifier_repr)
# 
# class AbstractPredictableModel(object):
#     def compute(self, X, y):
#         raise NotImplementedError("Every AbstractPredictableModel must implement the compute method.")
# 
#     def predict(self, X):
#         raise NotImplementedError("Every AbstractPredictableModel must implement the predict method.")
# 
#     def __repr__(self):
#         return self.__class__.__name__
# 
# Path: util/commons_util/fundamentals/generators.py
# def frange(start, stop, step):
#     return list(drange(start, stop, step))


import math as math
import random as random
import logging
import cv2
import numpy as np
from facerec_py.facerec.model import PredictableModel, AbstractPredictableModel
from util.commons_util.fundamentals.generators import frange
        return self.__div(self.true_positives, self.true_positives+self.false_positives)

    @property
    def total(self):
        return self.true_negatives+self.true_positives+self.false_negatives+self.false_positives
    @property
    def accuracy(self):
        return self.__div(self.true_positives+self.true_negatives, self.total)

    @property
    def F1(self):
        return self.__div(2*self.precision*self.recall, self.precision+self.recall)

    def __repr__(self):
        return "ValidationResult (Description=%s, Precision=%.2f%%, Recall=%.2f%%, TPR=%.2f%%, FPR=%.2f%%, TP=%d, TN=%d, FP=%d, FN=%d)" % (
            self.description, self.precision*100, self.recall*100, self.TPR*100, self.FPR*100, self.true_positives, self.true_negatives, self.false_positives, self.false_negatives)


class ValidationStrategy(object):
    """ Represents a generic Validation kernel for all Validation strategies.
    """

    def __init__(self, model):
        """    
        Initialize validation with empty results.
        
        Args:
        
            model [PredictableModel] The model, which is going to be validated.
        """

# Path: facerec_py/facerec/model.py
# class PredictableModel(AbstractPredictableModel):
#     def __init__(self, feature, classifier):
#         super(PredictableModel, self).__init__()
#         if not isinstance(feature, AbstractFeature):
#             raise TypeError("feature must be of type AbstractFeature!")
#         if not isinstance(classifier, AbstractClassifier):
#             raise TypeError("classifier must be of type AbstractClassifier!")
# 
#         self.feature = feature
#         self.classifier = classifier
# 
#     def compute(self, X, y):
#         features = self.feature.compute(X, y)
#         self.classifier.compute(features, y)
# 
#     def predict(self, X):
#         q = self.feature.extract(X)
#         return self.classifier.predict(q)
# 
#     def __repr__(self):
#         feature_repr = repr(self.feature)
#         classifier_repr = repr(self.classifier)
#         return "%s(feature=%s, classifier=%s)" % (self.__class__.__name__, feature_repr, classifier_repr)
# 
# class AbstractPredictableModel(object):
#     def compute(self, X, y):
#         raise NotImplementedError("Every AbstractPredictableModel must implement the compute method.")
# 
#     def predict(self, X):
#         raise NotImplementedError("Every AbstractPredictableModel must implement the predict method.")
# 
#     def __repr__(self):
#         return self.__class__.__name__
# 
# Path: util/commons_util/fundamentals/generators.py
# def frange(start, stop, step):
#     return list(drange(start, stop, step))


# Path: facerec_py/facerec/validation.py
import math as math
import random as random
import logging
import cv2
import numpy as np
from facerec_py.facerec.model import PredictableModel, AbstractPredictableModel
from util.commons_util.fundamentals.generators import frange

        return self.__div(self.true_positives, self.true_positives+self.false_positives)

    @property
    def total(self):
        return self.true_negatives+self.true_positives+self.false_negatives+self.false_positives
    @property
    def accuracy(self):
        return self.__div(self.true_positives+self.true_negatives, self.total)

    @property
    def F1(self):
        return self.__div(2*self.precision*self.recall, self.precision+self.recall)

    def __repr__(self):
        return "ValidationResult (Description=%s, Precision=%.2f%%, Recall=%.2f%%, TPR=%.2f%%, FPR=%.2f%%, TP=%d, TN=%d, FP=%d, FN=%d)" % (
            self.description, self.precision*100, self.recall*100, self.TPR*100, self.FPR*100, self.true_positives, self.true_negatives, self.false_positives, self.false_negatives)


class ValidationStrategy(object):
    """ Represents a generic Validation kernel for all Validation strategies.
    """

    def __init__(self, model):
        """    
        Initialize validation with empty results.
        
        Args:
        
            model [PredictableModel] The model, which is going to be validated.
        """

        if not isinstance(model, AbstractPredictableModel):