How to use the mlxtend._base._MultiClass function in mlxtend

To help you get started, we’ve selected a few mlxtend examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rasbt / mlxtend / mlxtend / classifier / multilayerperceptron.py View on Github external
# Author: Sebastian Raschka 
#
# License: BSD 3 clause

import numpy as np
from time import time
from scipy.special import expit
from .._base import _BaseModel
from .._base import _IterativeModel
from .._base import _MultiClass
from .._base import _MultiLayer
from .._base import _Classifier


class MultiLayerPerceptron(_BaseModel, _IterativeModel,
                           _MultiClass, _MultiLayer, _Classifier):

    """Multi-layer perceptron classifier with logistic sigmoid activations

    Parameters
    ------------
    eta : float (default: 0.5)
        Learning rate (between 0.0 and 1.0)
    epochs : int (default: 50)
        Passes over the training dataset.
        Prior to each epoch, the dataset is shuffled
        if `minibatches > 1` to prevent cycles in stochastic gradient descent.
    hidden_layers : list (default: [50])
        Number of units per hidden layer. By default 50 units in the
        first hidden layer. At the moment only 1 hidden layer is supported
    n_classes : int (default: None)
        A positive integer to declare the number of class labels
github rasbt / mlxtend / mlxtend / tf_classifier / tf_multilayerperceptron.py View on Github external
# Author: Sebastian Raschka 
#
# License: BSD 3 clause

import tensorflow as tf
import numpy as np
from time import time
from .._base import _BaseModel
from .._base import _IterativeModel
from .._base import _MultiClass
from .._base import _MultiLayer
from .._base import _Classifier


class TfMultiLayerPerceptron(_BaseModel, _IterativeModel,
                             _MultiClass, _MultiLayer, _Classifier):
    """Multi-layer perceptron classifier.

    Parameters
    ------------
    eta : float (default: 0.5)
        Learning rate (between 0.0 and 1.0)
    epochs : int (default: 50)
        Passes over the training dataset.
        Prior to each epoch, the dataset is shuffled
        if `minibatches > 1` to prevent cycles in stochastic gradient descent.
    hidden_layers : list (default: [50, 10])
        Number of units per hidden layer. By default 50 units in the
        first hidden layer, and 10 hidden units in the second hidden layer.
    n_classes : int (default: None)
        A positive integer to declare the number of class labels
        if not all class labels are present in a partial training set.
github rasbt / mlxtend / mlxtend / tf_classifier / tf_softmax.py View on Github external
#
# Implementation of Softmax Regression in Tensorflow
# Author: Sebastian Raschka 
#
# License: BSD 3 clause

import tensorflow as tf
import numpy as np
from time import time
from .._base import _BaseModel
from .._base import _IterativeModel
from .._base import _MultiClass
from .._base import _Classifier


class TfSoftmaxRegression(_BaseModel, _IterativeModel, _MultiClass,
                          _Classifier):
    """Softmax regression classifier.

    Parameters
    ------------
    eta : float (default: 0.5)
        Learning rate (between 0.0 and 1.0)
    epochs : int (default: 50)
        Passes over the training dataset.
        Prior to each epoch, the dataset is shuffled
        if `minibatches > 1` to prevent cycles in stochastic gradient descent.
    n_classes : int (default: None)
        A positive integer to declare the number of class labels
        if not all class labels are present in a partial training set.
        Gets the number of class labels automatically if None.
    minibatches : int (default: 1)
github rasbt / mlxtend / mlxtend / classifier / multilayerperceptron.py View on Github external
def __init__(self, eta=0.5, epochs=50,
                 hidden_layers=[50],
                 n_classes=None,
                 momentum=0.0, l1=0.0, l2=0.0,
                 dropout=1.0,
                 decrease_const=0.0,
                 minibatches=1, random_seed=None,
                 print_progress=0):

        _BaseModel.__init__(self)
        _Classifier.__init__(self)
        _IterativeModel.__init__(self)
        _MultiClass.__init__(self)
        _MultiLayer.__init__(self)

        if len(hidden_layers) > 1:
            raise AttributeError('Currently, only 1 hidden layer is supported')
        self.hidden_layers = hidden_layers
        self.eta = eta
        self.n_classes = n_classes
        self.l1 = l1
        self.l2 = l2
        self.decrease_const = decrease_const
        self.momentum = momentum
        self.epochs = epochs
        self.minibatches = minibatches
        self.random_seed = random_seed
        self.print_progress = print_progress
        self._is_fitted = False
github rasbt / mlxtend / mlxtend / classifier / softmax_regression.py View on Github external
def __init__(self, eta=0.01, epochs=50,
                 l2=0.0,
                 minibatches=1,
                 n_classes=None,
                 random_seed=None,
                 print_progress=0):

        _BaseModel.__init__(self)
        _IterativeModel.__init__(self)
        _Classifier.__init__(self)
        _MultiClass.__init__(self)

        self.eta = eta
        self.epochs = epochs
        self.l2 = l2
        self.minibatches = minibatches
        self.n_classes = n_classes
        self.random_seed = random_seed
        self.print_progress = print_progress
        self._is_fitted = False
github rasbt / mlxtend / mlxtend / classifier / softmax_regression.py View on Github external
# classification.

# Author: Sebastian Raschka 
#
# License: BSD 3 clause

import numpy as np
from time import time
from .._base import _BaseModel
from .._base import _IterativeModel
from .._base import _MultiClass
from .._base import _Classifier


class SoftmaxRegression(_BaseModel, _IterativeModel,
                        _Classifier,  _MultiClass):

    """Softmax regression classifier.

    Parameters
    ------------
    eta : float (default: 0.01)
        Learning rate (between 0.0 and 1.0)
    epochs : int (default: 50)
        Passes over the training dataset.
        Prior to each epoch, the dataset is shuffled
        if `minibatches > 1` to prevent cycles in stochastic gradient descent.
    l2 : float
        Regularization parameter for L2 regularization.
        No regularization if l2=0.0.
    minibatches : int (default: 1)
        The number of minibatches for gradient-based optimization.