Ejemplo n.º 1
0
    def _predict_failure(self, ip_feature_db):
        """
        Turn the ip_feature_db into two dimensional array and feed it to
        all classifiers.
        """
        failList = list()
        ip_set = TrainingSet()
        for cur_ip in ip_feature_db:
            ip_set.add_ip(cur_ip, ip_feature_db[cur_ip])
            
        for fail_classifier in self.__fail_classifiers:
            bad_ip_prediction = fail_classifier.predict(ip_set._ip_feature_list)

            failList.extend([ip_set._ip_index[i] for i in range(0, len(bad_ip_prediction)) if bad_ip_prediction[i] == ip_set.BAD_TARGET])

        return failList
Ejemplo n.º 2
0
    def _predict_failure(self, ip_feature_db):
        """
        Turn the ip_feature_db into two dimensional array and feed it to
        all classifiers.
        """
        failList = list()
        ip_set = TrainingSet()
        for cur_ip in ip_feature_db:
            ip_set.add_ip(cur_ip, ip_feature_db[cur_ip])

        for fail_classifier in self.__fail_classifiers:
            bad_ip_prediction = fail_classifier.predict(
                ip_set._ip_feature_list)

            failList.extend([
                ip_set._ip_index[i] for i in range(0, len(bad_ip_prediction))
                if bad_ip_prediction[i] == ip_set.BAD_TARGET
            ])

        return failList
Ejemplo n.º 3
0
    def _predict_failure(self, ip_feature_db):
        """
        Turn the ip_feature_db into two dimensional array and feed it to
        all classifiers.
        """
        failList = list()
        ip_set = TrainingSet()
        for fail_model in self._fail_models:
            ip_set._normalisation_data = fail_model.getNormalisationData()
            ip_set._normalisation_function = ip_set.normalise_individual
            if ip_set._normalisation_data[TrainingSet.NORMALISATION_TYPE] == 'sparse':
                ip_set._normalisation_function = ip_set.normalise_sparse

            ip_set = ip_set.precook_to_predict(ip_feature_db)
            print ip_set._ip_feature_array
            
            bad_ip_prediction = fail_model.getClassifier().predict(ip_set._ip_feature_array)

            failList.extend([ip_set._ip_index[i] for i in range(0, len(bad_ip_prediction)) if bad_ip_prediction[i] == ip_set.BAD_TARGET])

        return failList
Ejemplo n.º 4
0
    def _predict_failure(self, ip_feature_db):
        """
        Turn the ip_feature_db into two dimensional array and feed it to
        all classifiers.
        """
        failList = list()
        ip_set = TrainingSet()
        for fail_model in self._fail_models:
            ip_set._normalisation_data = fail_model.getNormalisationData()
            ip_set._normalisation_function = ip_set.normalise_individual
            if ip_set._normalisation_data[
                    TrainingSet.NORMALISATION_TYPE] == 'sparse':
                ip_set._normalisation_function = ip_set.normalise_sparse

            ip_set = ip_set.precook_to_predict(ip_feature_db)
            print ip_set._ip_feature_array

            bad_ip_prediction = fail_model.getClassifier().predict(
                ip_set._ip_feature_array)

            failList.extend([
                ip_set._ip_index[i] for i in range(0, len(bad_ip_prediction))
                if bad_ip_prediction[i] == ip_set.BAD_TARGET
            ])

        return failList