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:
- ts
TimeSeries
data to find outliers within
- N
float
, optional if
method='s'
: number of standard deviations to consider an outlier ifmethod='pf'
: percentile range limit to consider an outlier default for both methods: 5- method
str
, optional outlier identification method to be used, must be
's'
(standard deviation method) or'pf'
(percentil range method) default:'s'
- ts
- Returns:
- out
ndarray
array indices of the input where outliers occur
- out
- gwdetchar.lasso.core.fit(data, target, alpha=None)[source]¶
Fit some data to the target using a Lasso model
- Parameters:
- data
numpy.ndarray
the data
- target
numpy.ndarray
the target data
- alpha
float
the Lasso alpha parameter, if
None
one will be determined usingfind_alpha()
- data
- Returns:
- model
Lasso
the fitted model
- model
- gwdetchar.lasso.core.remove_bad(tsdict)[source]¶
Remove data that cannot be scaled from a
TimeSeriesDict
- gwdetchar.lasso.core.remove_outliers(ts, N=5, method='s')[source]¶
Find and remove outliers within a
TimeSeries
- Parameters:
- ts
TimeSeries
data to find outliers within
- N
float
, optional if
method='s'
: number of standard deviations to consider an outlier ifmethod='pf'
: percentile range limit to consider an outlier default for both methods: 5- method
str
, optional outlier identification method to be used, must be
's'
(standard deviation method) or'pf'
(percentil range method) default:'s'
- ts
Notes
This action is done in-place, with no
return
statement.