tsfel.utils package#
Submodules#
tsfel.utils.add_personal_features module#
- tsfel.utils.add_personal_features.add_feature_json(features_path, json_path)#
Adds new feature to features.json.
- Parameters:
- features_path: string
Personal Python module directory containing new features implementation.
- json_path: string
Personal .json file directory containing existing features from TSFEL. New customised features will be added to file in this directory.
tsfel.utils.calculate_complexity module#
- tsfel.utils.calculate_complexity.compute_complexity(feature, domain, json_path, **kwargs)#
Computes the feature complexity.
- Parameters:
- featurestring
Feature name
- domainstring
Feature domain
- json_path: json
Features json file
- **kwargs:
- See below:
- features_path (
string) – Directory of script with personal features
- features_path (
- Returns:
- int
Feature complexity
- Writes complexity in json file
- tsfel.utils.calculate_complexity.find_best_curve(t, signal)#
Finds the best curve.
- Parameters:
- tnd-array
Log space
- signalnd-array
Mean execution time array
- Returns:
- str
Best fit curve name
- tsfel.utils.calculate_complexity.n_constant(x, no)#
The model function.
- tsfel.utils.calculate_complexity.n_linear(x, no)#
The model function.
- tsfel.utils.calculate_complexity.n_log(x, no)#
The model function.
- tsfel.utils.calculate_complexity.n_nlog(x, no)#
The model function.
- tsfel.utils.calculate_complexity.n_squared(x, no)#
The model function.
tsfel.utils.progress_bar module#
- tsfel.utils.progress_bar.display_progress_bar(iteration, total, out)#
Displays progress bar according to python interface.
- Parameters:
- iteration: int
current iteration
- total: int
total iterations
- out: progress bar notebook output
- tsfel.utils.progress_bar.progress_bar_notebook(iteration, total=100)#
Progress bar for notebooks.
- Parameters:
- iteration: int
current iteration
- total: int
total iterations
- Returns:
- Progress bar for notebooks
- tsfel.utils.progress_bar.progress_bar_terminal(iteration, total, prefix='', suffix='', decimals=0, length=100, fill='█', printend='\r')#
Call in a loop to create terminal progress bar.
- Parameters:
- iteration: int
current iteration
- total: int
total iterations
- prefix: str
prefix string
- suffix: str
suffix string
- decimals: int
positive number of decimals in percent complete
- length: int
character length of bar
- fill: str
bar fill character
- printend: str
end character (e.g. “
- “, “
- “)
tsfel.utils.signal_processing module#
Identify and optionally remove highly correlated features from a DataFrame.
This function computes the pairwise Pearson correlation of features using pandas.corr() and identifies features that have an absolute value of the correlation coefficient higher than the specified threshold. Different correlation methods supported by such as ‘pearson’, ‘spearman’, or ‘kendall’.
Deprecated since version 0.1.11: tsfel.correlated_features will be deprecated in tsfel 0.1.11 and will be removed in other upcoming releases. It will be replaced by a future DropCorrelated feature class using fit and transform logic.
- Parameters:
- featurespd.DataFrame
A DataFrame containing the feature data.
- thresholdfloat
The correlation value for removing highly correlated features.
- methodstr
Method to compute correlation. Must be one of {‘pearson’, ‘kendall’, ‘spearman’}
- drop_correlatedbool:
If True, drop the highly correlated features from the DataFrame.
- Returns:
- Union[List[str], Tuple[List[str], pd.DataFrame]]:
A list of names of highly correlated features.
If drop_correlated is True, a tuple containing the list of dropped feature names and the updated DataFrame with those features removed.
- tsfel.utils.signal_processing.merge_time_series(data, fs_resample, time_unit)#
Time series data interpolation.
- Parameters:
- datadict
data to interpolate
- fs_resample
resample sampling frequency
- time_unit
time unit in seconds
- Returns:
- DataFrame
Interpolated data
- tsfel.utils.signal_processing.signal_window_splitter(signal, window_size, overlap=0)#
Splits the signal into windows.
- Parameters:
- signalnd-array or pandas DataFrame
input signal
- window_sizeint
number of points of window size
- overlapfloat
percentage of overlap, value between 0 and 1 (exclusive) Default: 0
- Returns
- ——-
- list
list of signal windows