gwdetchar.lasso.core module

Lasso regression utilities

gwdetchar.lasso.core.find_alpha(data, target)[source]

Find the best alpha value to use for the given data

gwdetchar.lasso.core.find_outliers(ts, N=5, method='s')[source]

Find outliers within a TimeSeries

Parameters:
tsTimeSeries

data to find outliers within

Nfloat, optional

if method='s': number of standard deviations to consider an outlier if method='pf': percentile range limit to consider an outlier default for both methods: 5

methodstr, optional

outlier identification method to be used, must be 's' (standard deviation method) or 'pf' (percentil range method) default: 's'

Returns:
outndarray

array indices of the input where outliers occur

gwdetchar.lasso.core.fit(data, target, alpha=None)[source]

Fit some data to the target using a Lasso model

Parameters:
datanumpy.ndarray

the data

targetnumpy.ndarray

the target data

alphafloat

the Lasso alpha parameter, if None one will be determined using find_alpha()

Returns:
modelLasso

the fitted model

gwdetchar.lasso.core.remove_bad(tsdict)[source]

Remove data that cannot be scaled from a TimeSeriesDict

gwdetchar.lasso.core.remove_flat(tsdict)[source]

Remove flat timeseries from a TimeSeriesDict

gwdetchar.lasso.core.remove_outliers(ts, N=5, method='s')[source]

Find and remove outliers within a TimeSeries

Parameters:
tsTimeSeries

data to find outliers within

Nfloat, optional

if method='s': number of standard deviations to consider an outlier if method='pf': percentile range limit to consider an outlier default for both methods: 5

methodstr, optional

outlier identification method to be used, must be 's' (standard deviation method) or 'pf' (percentil range method) default: 's'

Notes

This action is done in-place, with no return statement.