# This file was automatically generated by SWIG (http://www.swig.org).
# Version 4.0.2
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.

from sys import version_info as _swig_python_version_info
if _swig_python_version_info < (2, 7, 0):
    raise RuntimeError("Python 2.7 or later required")

# Import the low-level C/C++ module
import _streamdm

try:
    import builtins as __builtin__
except ImportError:
    import __builtin__

def _swig_repr(self):
    try:
        strthis = "proxy of " + self.this.__repr__()
    except __builtin__.Exception:
        strthis = ""
    return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)


def _swig_setattr_nondynamic_instance_variable(set):
    def set_instance_attr(self, name, value):
        if name == "thisown":
            self.this.own(value)
        elif name == "this":
            set(self, name, value)
        elif hasattr(self, name) and isinstance(getattr(type(self), name), property):
            set(self, name, value)
        else:
            raise AttributeError("You cannot add instance attributes to %s" % self)
    return set_instance_attr


def _swig_setattr_nondynamic_class_variable(set):
    def set_class_attr(cls, name, value):
        if hasattr(cls, name) and not isinstance(getattr(cls, name), property):
            set(cls, name, value)
        else:
            raise AttributeError("You cannot add class attributes to %s" % cls)
    return set_class_attr


def _swig_add_metaclass(metaclass):
    """Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass"""
    def wrapper(cls):
        return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy())
    return wrapper


class _SwigNonDynamicMeta(type):
    """Meta class to enforce nondynamic attributes (no new attributes) for a class"""
    __setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__)



import numpy as np

class HoeffdingTree(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self):

        self.label_map = {}
        self.label_map_inv = {}


        _streamdm.HoeffdingTree_swiginit(self, _streamdm.new_HoeffdingTree())

    def fit(self, samples, targets):
        indexed_targets = []
        for target in targets:
            if (target not in self.label_map):
                map_len = len(self.label_map)
                self.label_map[target] = map_len
                self.label_map_inv[map_len] = target
            indexed_targets.append(self.label_map[target])
        return _streamdm.HoeffdingTree_fit(self, samples, indexed_targets)



    def predict(self, samples):
        predictions_len = len(samples)
        predictions = _streamdm.HoeffdingTree_predict(self, samples, predictions_len)
        return np.array([self.label_map_inv[p] for p in predictions])



    def export_json(self, file_name):
        return _streamdm.HoeffdingTree_export_json(self, file_name)
    __swig_destroy__ = _streamdm.delete_HoeffdingTree

# Register HoeffdingTree in _streamdm:
_streamdm.HoeffdingTree_swigregister(HoeffdingTree)

class HoeffdingAdaptiveTree(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self):

        self.label_map = {}
        self.label_map_inv = {}


        _streamdm.HoeffdingAdaptiveTree_swiginit(self, _streamdm.new_HoeffdingAdaptiveTree())

    def fit(self, samples, targets):
        indexed_targets = []
        for target in targets:
            if (target not in self.label_map):
                map_len = len(self.label_map)
                self.label_map[target] = map_len
                self.label_map_inv[map_len] = target
            indexed_targets.append(self.label_map[target])
        return _streamdm.HoeffdingAdaptiveTree_fit(self, samples, indexed_targets)



    def predict(self, samples):
        predictions_len = len(samples)
        predictions = _streamdm.HoeffdingAdaptiveTree_predict(self, samples, predictions_len)
        return np.array([self.label_map_inv[p] for p in predictions])



    def export_json(self, file_name):
        return _streamdm.HoeffdingAdaptiveTree_export_json(self, file_name)
    __swig_destroy__ = _streamdm.delete_HoeffdingAdaptiveTree

# Register HoeffdingAdaptiveTree in _streamdm:
_streamdm.HoeffdingAdaptiveTree_swigregister(HoeffdingAdaptiveTree)

class NaiveBayes(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self):

        self.label_map = {}
        self.label_map_inv = {}


        _streamdm.NaiveBayes_swiginit(self, _streamdm.new_NaiveBayes())

    def fit(self, samples, targets):
        indexed_targets = []
        for target in targets:
            if (target not in self.label_map):
                map_len = len(self.label_map)
                self.label_map[target] = map_len
                self.label_map_inv[map_len] = target
            indexed_targets.append(self.label_map[target])
        return _streamdm.NaiveBayes_fit(self, samples, indexed_targets)



    def predict(self, samples):
        predictions_len = len(samples)
        predictions = _streamdm.NaiveBayes_predict(self, samples, predictions_len)
        return np.array([self.label_map_inv[p] for p in predictions])



    def export_json(self, file_name):
        return _streamdm.NaiveBayes_export_json(self, file_name)
    __swig_destroy__ = _streamdm.delete_NaiveBayes

# Register NaiveBayes in _streamdm:
_streamdm.NaiveBayes_swigregister(NaiveBayes)

class LogisticRegression(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self):

        self.label_map = {}
        self.label_map_inv = {}


        _streamdm.LogisticRegression_swiginit(self, _streamdm.new_LogisticRegression())

    def fit(self, samples, targets):
        indexed_targets = []
        for target in targets:
            if (target not in self.label_map):
                map_len = len(self.label_map)
                self.label_map[target] = map_len
                self.label_map_inv[map_len] = target
            indexed_targets.append(self.label_map[target])
        return _streamdm.LogisticRegression_fit(self, samples, indexed_targets)



    def predict(self, samples):
        predictions_len = len(samples)
        predictions = _streamdm.LogisticRegression_predict(self, samples, predictions_len)
        return np.array([self.label_map_inv[p] for p in predictions])



    def export_json(self, file_name):
        return _streamdm.LogisticRegression_export_json(self, file_name)
    __swig_destroy__ = _streamdm.delete_LogisticRegression

# Register LogisticRegression in _streamdm:
_streamdm.LogisticRegression_swigregister(LogisticRegression)

class MajorityClass(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self):

        self.label_map = {}
        self.label_map_inv = {}


        _streamdm.MajorityClass_swiginit(self, _streamdm.new_MajorityClass())

    def fit(self, samples, targets):
        indexed_targets = []
        for target in targets:
            if (target not in self.label_map):
                map_len = len(self.label_map)
                self.label_map[target] = map_len
                self.label_map_inv[map_len] = target
            indexed_targets.append(self.label_map[target])
        return _streamdm.MajorityClass_fit(self, samples, indexed_targets)



    def predict(self, samples):
        predictions_len = len(samples)
        predictions = _streamdm.MajorityClass_predict(self, samples, predictions_len)
        return np.array([self.label_map_inv[p] for p in predictions])



    def export_json(self, file_name):
        return _streamdm.MajorityClass_export_json(self, file_name)
    __swig_destroy__ = _streamdm.delete_MajorityClass

# Register MajorityClass in _streamdm:
_streamdm.MajorityClass_swigregister(MajorityClass)

class Perceptron(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self):

        self.label_map = {}
        self.label_map_inv = {}


        _streamdm.Perceptron_swiginit(self, _streamdm.new_Perceptron())

    def fit(self, samples, targets):
        indexed_targets = []
        for target in targets:
            if (target not in self.label_map):
                map_len = len(self.label_map)
                self.label_map[target] = map_len
                self.label_map_inv[map_len] = target
            indexed_targets.append(self.label_map[target])
        return _streamdm.Perceptron_fit(self, samples, indexed_targets)



    def predict(self, samples):
        predictions_len = len(samples)
        predictions = _streamdm.Perceptron_predict(self, samples, predictions_len)
        return np.array([self.label_map_inv[p] for p in predictions])



    def export_json(self, file_name):
        return _streamdm.Perceptron_export_json(self, file_name)
    __swig_destroy__ = _streamdm.delete_Perceptron

# Register Perceptron in _streamdm:
_streamdm.Perceptron_swigregister(Perceptron)

class Bagging(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self):

        self.label_map = {}
        self.label_map_inv = {}


        _streamdm.Bagging_swiginit(self, _streamdm.new_Bagging())

    def fit(self, samples, targets):
        indexed_targets = []
        for target in targets:
            if (target not in self.label_map):
                map_len = len(self.label_map)
                self.label_map[target] = map_len
                self.label_map_inv[map_len] = target
            indexed_targets.append(self.label_map[target])
        return _streamdm.Bagging_fit(self, samples, indexed_targets)



    def predict(self, samples):
        predictions_len = len(samples)
        predictions = _streamdm.Bagging_predict(self, samples, predictions_len)
        return np.array([self.label_map_inv[p] for p in predictions])



    def export_json(self, file_name):
        return _streamdm.Bagging_export_json(self, file_name)
    __swig_destroy__ = _streamdm.delete_Bagging

# Register Bagging in _streamdm:
_streamdm.Bagging_swigregister(Bagging)



