idq.classifiers.sklearn

class idq.classifiers.sklearn.ApproximateKernelSGD(*args, **kwargs)[source]

A Stochastic Gradient Descent classifier based on scikit-learn, with a choice of an approximate kernel to transform nonlinear features into linear features suitable for the SDG classifier.

Guide for using the Stochastic Gradient Descent classifier:

  • `SGD User’s Guide

<http://scikit-learn.org/stable/modules/sgd.html#stochastic-gradient-descent>`_.

  • `SGD API

<http://scikit-learn.org/stable/modules/generated/sklearn.linear_model.SGDClassifier.html#sklearn-linear-model-sgdclassifier>`_.

Guide for the approximate kernel algorithm (using the Nystroem method), types of kernels and appropriate parameters:

  • `Kernel Approximation User’s Guide

<http://scikit-learn.org/stable/modules/kernel_approximation.html#kernel-approximation>`_.

  • `Kernel Approximation API

<http://scikit-learn.org/stable/modules/generated/sklearn.kernel_approximation.Nystroem.html#sklearn.kernel_approximation.Nystroem>`_.

classifier()[source]

Creates an approximate kernel SGD classifier.

class idq.classifiers.sklearn.ApproximateKernelSVM(*args, **kwargs)[source]

A linear SVM based on scikit-learn, with a choice of an approximate kernel to transform nonlinear features into linear features suitable for the SVM classifier.

Guide for using the linear SVM classifier:

  • `SVM User’s Guide

<http://scikit-learn.org/stable/modules/svm.html#support-vector-machines>`_.

  • `Linear SVM API

<http://scikit-learn.org/stable/modules/generated/sklearn.svm.LinearSVC.html#sklearn.svm.LinearSVC>`_.

Guide for the approximate kernel algorithm (using the Nystroem method), types of kernels and appropriate parameters:

  • `Kernel Approximation User’s Guide

<http://scikit-learn.org/stable/modules/kernel_approximation.html#kernel-approximation>`_.

  • `Kernel Approximation API

<http://scikit-learn.org/stable/modules/generated/sklearn.kernel_approximation.Nystroem.html#sklearn.kernel_approximation.Nystroem>`_.

classifier()[source]

Creates a approximate kernel SVM classifier.

class idq.classifiers.sklearn.GradientBoostedTree(*args, **kwargs)[source]

A Gradient Tree Boosting algorithm based on scikit-learn.

This is a supervised learning algorithm which produces an ensemble of decision trees, builds them up in a stage-wise fashion, and allows use of arbitrary differentiable loss functions.

  • `GBT User’s Guide

<http://scikit-learn.org/stable/modules/ensemble.html#gradient-boosting>`_.

  • `GBT API

<http://scikit-learn.org/stable/modules/generated/sklearn.ensemble.GradientBoostingClassifier.html#sklearn.ensemble.GradientBoostingClassifier>`_.

classifier()[source]

Creates a gradient boosted tree classifier.

class idq.classifiers.sklearn.IncrementalApproximateKernelSGD(*args, **kwargs)[source]

A Stochastic Gradient Descent classifier based on scikit-learn, with a choice of an approximate kernel to transform nonlinear features into linear features suitable for the SDG classifier. Trains in an incremental fashion.

Guide for using the Stochastic Gradient Descent classifier:

  • `SGD User’s Guide

<http://scikit-learn.org/stable/modules/sgd.html#stochastic-gradient-descent>`_.

  • `SGD API

<http://scikit-learn.org/stable/modules/generated/sklearn.linear_model.SGDClassifier.html#sklearn-linear-model-sgdclassifier>`_.

Guide for the approximate kernel algorithm (using the Nystroem method), types of kernels and appropriate parameters:

  • `Kernel Approximation User’s Guide

<http://scikit-learn.org/stable/modules/kernel_approximation.html#kernel-approximation>`_.

  • `Kernel Approximation API

<http://scikit-learn.org/stable/modules/generated/sklearn.kernel_approximation.Nystroem.html#sklearn.kernel_approximation.Nystroem>`_.

classifier()[source]

Creates a approximate kernel SGD classifier.

class idq.classifiers.sklearn.IncrementalNaiveBayes(*args, **kwargs)[source]

A Naive Bayes classifier based on scikit-learn. Trains in an incremental fashion.

This is a supervised learning algorithm which assumes independence between all features, and uses Bayes’ theorem to determine the posterior probability that a set of features is in a given class. In this particular implementation, the likelihood of features are Gaussian in form.

  • `Gaussian Naive Bayes User’s Guide

<http://scikit-learn.org/stable/modules/naive_bayes.html#gaussian-naive-bayes>`_.

  • `Gaussian Naive Bayes API

<http://scikit-learn.org/stable/modules/generated/sklearn.naive_bayes.GaussianNB.html#sklearn.naive_bayes.GaussianNB>`_.

classifier()[source]

Creates a Gaussian Naive Bayes classifier.

class idq.classifiers.sklearn.IncrementalNeuralNetwork(*args, **kwargs)[source]

A Multilayer Perception (neural network) algorithm based on scikit-learn. Trains in an incremental fashion.

This is a supervised learning algorithm which produces a shallow neural network of multiple layers with a choice of activation function for the hidden layers. It trains itself using backpropagation.

  • `MultiLayer Perceptron User’s Guide

<http://scikit-learn.org/stable/modules/neural_networks_supervised.html#multi-layer-perceptron>`_.

  • `MultiLayer Perceptron API

<http://scikit-learn.org/stable/modules/generated/sklearn.neural_network.MLPClassifier.html#sklearn.neural_network.MLPClassifier>`_.

classifier()[source]

Creates a multilayer perceptron classifier.

class idq.classifiers.sklearn.IncrementalSupervisedSklearnClassifier(*args, **kwargs)[source]

a base class for incremental supervised sk-learn classifiers, which contains simple implementations for incremental supervised classifier methods.

Note: not to be used as a standalone classifier.

evaluate(dataset)[source]

Applies a supervised sk-learn model to feature data.

feature_importance()[source]

Estimates the likelihood ratio of each feature over the training data set bootstrap/importance sample to estimate the average importance

timeseries(*args, **kwargs)[source]

Generate a time series of predictions based on predicted model probabilities

train(dataset)[source]

Trains a supervised scikit-learn model to feature data using a labeled dataset.

class idq.classifiers.sklearn.NaiveBayes(*args, **kwargs)[source]

A Naive Bayes classifier based on scikit-learn.

This is a supervised learning algorithm which assumes independence between all features, and uses Bayes’ theorem to determine the posterior probability that a set of features is in a given class. In this particular implementation, the likelihood of features are Gaussian in form.

  • `Gaussian Naive Bayes User’s Guide

<http://scikit-learn.org/stable/modules/naive_bayes.html#gaussian-naive-bayes>`_.

  • `Gaussian Naive Bayes API

<http://scikit-learn.org/stable/modules/generated/sklearn.naive_bayes.GaussianNB.html#sklearn.naive_bayes.GaussianNB>`_.

classifier()[source]

Create a Gaussian Naive Bayes classifer

class idq.classifiers.sklearn.NeuralNetwork(*args, **kwargs)[source]

A neural network (multi-layer perception) algorithm based on scikit-learn.

This is a supervised learning algorithm which produces a shallow neural network of multiple layers with a choice of activation function for the hidden layers. It trains itself using backpropagation.

  • `MultiLayer Perceptron User’s Guide

<http://scikit-learn.org/stable/modules/neural_networks_supervised.html#multi-layer-perceptron>`_.

  • `MultiLayer Perceptron API

<http://scikit-learn.org/stable/modules/generated/sklearn.neural_network.MLPClassifier.html#sklearn.neural_network.MLPClassifier>`_.

classifier()[source]

Creates a multilayer perceptron classifier.

class idq.classifiers.sklearn.PassiveAggressive(*args, **kwargs)[source]

A Passive-Aggressive classifier based on scikit-learn. Trains in an incremental fashion.

Based off of <http://jmlr.csail.mit.edu/papers/volume7/crammer06a/crammer06a.pdf>`_.

  • `Passive-Aggressive User’s Guide

<http://scikit-learn.org/stable/modules/linear_model.html#passive-aggressive>`_.

  • `Passive-Aggressive API

<http://scikit-learn.org/stable/modules/generated/sklearn.linear_model.PassiveAggressiveClassifier.html#sklearn-linear-model-passiveaggressiveclassifier>`_.

classifier()[source]

Creates a Passive-Aggressive classifier.

class idq.classifiers.sklearn.RandomForest(*args, **kwargs)[source]

A Random Forest of Decision Trees based on scikit-learn.

This is a supervised learning algorithm which uses a group of randomized decision trees (a forest) to perform classification.

  • `Random Forest User’s Guide

<http://scikit-learn.org/stable/modules/ensemble.html#forest>`_.

  • `Random Forest API

<http://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestClassifier.html#sklearn.ensemble.RandomForestClassifier>`_.

classifier()[source]

Create a random forest classifier

class idq.classifiers.sklearn.SklearnModel(start, end, pipeline, channels, downselector, transformer, time='time', bounds=None, segs=None, model_id=None, generate_id=False)[source]

a base model class for all sklearn classifiers

class idq.classifiers.sklearn.SupervisedSklearnClassifier(*args, **kwargs)[source]

a base class for supervised sk-learn classifiers, which contains simple implementations for supervised classifier methods.

Note: not to be used as a standalone classifier.

evaluate(dataset)[source]

Applies a supervised scikit-learn model to feature data. Takes in an unlabeled dataset and produces ranks for each feature vector within that dataset.

feature_importance()[source]

Retrieve feature importances from a classifier if it has such a method.

timeseries(info, dataset_factory, dt=0.00390625, segs=None, set_ok=None)[source]

Generate a time series of predictions based on predicted model probabilities.

train(dataset)[source]

Trains a supervised scikit-learn model to feature data using a labeled dataset.

class idq.classifiers.sklearn.SupportVectorMachine(*args, **kwargs)[source]

A support vector machine based on scikit-learn.

This is a supervised learning algorithm which uses a hyperplane to separate data points into two distinct classes. It also allows for kernel-based learning, so that if samples aren’t appropriate to be separated by a hyperplane, samples gets transformed via a kernel to a higher-dimensional space where samples can be separated in a linear fashion.

Various kernels are supported and can be passed in by passing in the kernel kwarg to the classifier configuration section.

NOTE: The scikit-learn classifier, SVC, is used to perform classification. Probability is set to true so that the mapping between rank to a calibrated probability can be performed more easily.

<http://scikit-learn.org/stable/modules/generated/sklearn.svm.SVC.html#sklearn.svm.SVC>`_.

classifier()[source]

Creates a support vector machine classifier