cerebralcortex.algorithms.stats package¶
Submodules¶
cerebralcortex.algorithms.stats.features module¶
-
interpolate
(ds, freq=16, method='linear', axis=0, limit=None, inplace=False, limit_direction='forward', limit_area=None, downcast=None)[source]¶ Interpolate values according to different methods. This method internally uses pandas interpolation.
Parameters: - ds (DataStream) – Windowed/grouped DataStream object
- freq (int) – Frequency of the signal
- method (str) – default ‘linear’ - ‘linear’: Ignore the index and treat the values as equally spaced. This is the only method supported on MultiIndexes. - ‘time’: Works on daily and higher resolution data to interpolate given length of interval. - ‘index’, ‘values’: use the actual numerical values of the index. - ‘pad’: Fill in NaNs using existing values. - ‘nearest’, ‘zero’, ‘slinear’, ‘quadratic’, ‘cubic’, ‘spline’, ‘barycentric’, ‘polynomial’: Passed to scipy.interpolate.interp1d. These methods use the numerical values of the index. Both ‘polynomial’ and ‘spline’ require that you also specify an order (int), e.g. df.interpolate(method=’polynomial’, order=5). - ‘krogh’, ‘piecewise_polynomial’, ‘spline’, ‘pchip’, ‘akima’: Wrappers around the SciPy interpolation methods of similar names. See Notes. - ‘from_derivatives’: Refers to scipy.interpolate.BPoly.from_derivatives which replaces ‘piecewise_polynomial’ interpolation method in scipy 0.18.
- {0 or ‘index’, 1 or ‘columns’, None} (axis) – default None. Axis to interpolate along.
- limit (int) – optional. Maximum number of consecutive NaNs to fill. Must be greater than 0.
- inplace (bool) – default False. Update the data in place if possible.
- {‘forward’, ‘backward’, ‘both’} (limit_direction) – default ‘forward’. If limit is specified, consecutive NaNs will be filled in this direction.
- {None, ‘inside’, ‘outside’} (limit_area) – default None. If limit is specified, consecutive NaNs will be filled with this restriction. - None: No fill restriction. - ‘inside’: Only fill NaNs surrounded by valid values (interpolate). - ‘outside’: Only fill NaNs outside valid values (extrapolate).
- optional, ‘infer’ or None (downcast) – defaults to None
- **kwargs – Keyword arguments to pass on to the interpolating function.
Returns DataStream: interpolated data
-
magnitude
(ds, col_names=[])[source]¶ Compute magnitude of columns
Parameters: - ds (DataStream) – Windowed/grouped DataStream object
- col_names (list[str]) – column names
Returns: DataStream
-
statistical_features
(ds, exclude_col_names: list = [], feature_names=['mean', 'median', 'stddev', 'variance', 'max', 'min', 'skew', 'kurt', 'sqr'])[source]¶ Compute statistical features.
Parameters: - ds (DataStream) – Windowed/grouped DataStream object
- list (feature_names) – name of the columns on which features should not be computed
- list – names of the features. Supported features are [‘mean’, ‘median’, ‘stddev’, ‘variance’, ‘max’, ‘min’, ‘skew’, ‘kurt’, ‘sqr’, ‘zero_cross_rate’
Returns: DataStream object with all the existing data columns and FFT features