controllers Package

KDE Module

class qikify.controllers.KDE.KDE[source]

Bases: object

This class implements non-parametric kernel density estimation.

Methods

run(X[, specs, nSamples, counts, a, bounds]) Primary execution point.
run(X, specs=None, nSamples=0, counts=None, a=0, bounds=None)[source]

Primary execution point. Run either standard KDE or class-membership based KDE. If any of the class-membership based KDE arguments are set, it will be run instead of standard KDE.

Parameters :

X : array_like

Contains data stored in a pandas.DataFrame.

nSamples : int

The number of samples to generate.

specs : qikify.models.Specs, optional

If using partitioned sampling, boundaries defining pass/critical/fail subspaces must be provided.

counts : dict, optional

If using partitioned sampling, counts dictionary must be provided, with three keys: nGood, nCritical, nFail.

LSFS Module

class qikify.controllers.LSFS.LSFS[source]

Bases: object

Methods

constructS(X, gnd[, k, t, bLDA, bSelfConnected])
run(Xin, gnd) Run Laplacian Score Feature Selection.
threshold(T_L)
constructS(X, gnd, k=0, t=1, bLDA=False, bSelfConnected=True)[source]
run(Xin, gnd)[source]

Run Laplacian Score Feature Selection.

Note

Eventually, it’d be nice to maintain col names with Xin so that we can add a plot method to plot scores vs. column names.

Parameters :

Xin : array_like

A numpy.ndarray or pandas.DataFrame, with rows corresponding to observations and columns to features.

gnd : array_like

A numpy.ndarray or pandas.DataFrame pass/fail vector of the same dimension as Xin

Notes

This code is based on the definition from the paper [R1]:

[R1]He, X. and Cai, D. and Niyogi, P., “Laplacian Score for Feature Selection”, NIPS 2005.
threshold(T_L)[source]

OLS Module

class qikify.controllers.OLS.OLS[source]

Bases: object

Ordinary least squares multivariate regression.

Methods

JB() Calculate residual skewness, kurtosis, and do the JB test for normality
computeStatistics()
dw() Calculates the Durbin-Waston statistic
ll() Calculate model log-likelihood and two information criteria
omni() Omnibus test for normality
train(X, y[, useQR, addConstant]) Solve y = Xb.
JB()[source]

Calculate residual skewness, kurtosis, and do the JB test for normality

computeStatistics()[source]
dw()[source]

Calculates the Durbin-Waston statistic

ll()[source]

Calculate model log-likelihood and two information criteria

omni()[source]

Omnibus test for normality

train(X, y, useQR=True, addConstant=True)[source]

Solve y = Xb.

Parameters :

x : array, shape (M, N)

y : array, shape (M,)

useQR : boolean

Whether or not to use QR decomposition to fit regression line.

addConstant: boolean :

Whether or not to add a constant column to X

QFFS Module

class qikify.controllers.QFFS.QFFS[source]

Bases: object

Qikify feature selection library. Doesn’t do much yet; right now only implements correlation coefficient-based feature selection.

Methods

computeCorrCoefs(X, y) Returns the correlation coefficients between X and y,
run(X, y[, n_features, intercept, method]) Do feature selection on the basis of correlation coefficients.
computeCorrCoefs(X, y)[source]

Returns the correlation coefficients between X and y, along with the arg-sorted indices of ranked most-correlated X-to-y vars.

run(X, y, n_features=10, intercept=True, method='corrcoef')[source]

Do feature selection on the basis of correlation coefficients.

Parameters :

X : numpy array of shape [n_samples,n_features]

Training data

y : numpy array of shape [n_samples]

Target values

n_features : int, optional

Number of features to retain

intercept : bool, optional

Whether the first column is an all-constant intercept and should be excluded

method : string, optional

Determines the feature selection method to use.

Returns :

features : The X column indices to retain.

Notes

We typically exclude the first column since it is the intercept all-constant column.

SVM Module

class qikify.controllers.SVM.SVM[source]

Bases: object

Methods

getTEYL(gnd, predicted)
predict(X)
train(X, gnd[, gridSearch])
getTEYL(gnd, predicted)[source]
predict(X)[source]
train(X, gnd, gridSearch=False)[source]

identifyOutliers Module

qikify.controllers.identifyOutliers.identifyOutliers(data, k=3)[source]

Compare a dataset against mu +/- k*sigma limits, and return a boolean vector with False elements denoting outliers.

Parameters :data : Contains data stored in a pandas DataFrame or Series.
qikify.controllers.identifyOutliers.identifyOutliersSpecs(data, specs, ind, k=3)[source]

Compare a dataset against expanded spec limits, and return a boolean vector with False elements denoting outliers.

Parameters :data : Contains data stored in a pandas DataFrame or Series.

interpolate Module

qikify.controllers.interpolate.bilinear_interp(x, y, xlim, ylim, Q)[source]

bilinear interpolation of z over 2d surface {x,y}

qikify.controllers.interpolate.cart2polar(x, y)[source]
qikify.controllers.interpolate.cart2polar_recenter(x, y, xmax, ymax)[source]
qikify.controllers.interpolate.lerp(x, xlim, ylim)[source]

linearly interpolate a value of y given ranges for x, y.

arguments:
x: scalar xlim: array with xmin, xmax ylim: array with ymin, ymax
qikify.controllers.interpolate.polar2cart(r, theta)[source]
qikify.controllers.interpolate.polar2cart_recenter(r, theta, xmax, ymax)[source]

slicesample Module

qikify.controllers.slicesample.inside(x, th, pdf)[source]
qikify.controllers.slicesample.logpdf(x, pdf)[source]
qikify.controllers.slicesample.outside(x, th, pdf)[source]
qikify.controllers.slicesample.slicesample(x0, nsamples, pdf, width=10, maxiter=200)[source]

Loosely based on slicesample() from MATLAB.

Table Of Contents

This Page