Weight calculation
Weight calculation is one of the core operations in FaultMap. It processes time series data collected from process sensors to infer the relative importance of connections between process elements.
The weight calculation module orchestrates the computation of transfer entropy between all pairs of process signals and produces edge weights for the directed graph. Key steps include:
Loading and preprocessing time series data (normalization, optional FFT and band-pass filtering).
Computing pairwise transfer entropy across a range of time delays.
Selecting optimal delay values and computing significance thresholds.
Writing results to HDF5 storage for downstream use by the node ranking and graph reduction stages.
Multiprocessing is supported to parallelize pairwise computations across available CPU cores.
Note
The following is auto-generated documentation from the weightcalc module source:
This module provides methods for calculating the gains (weights) of edges connecting variables in the directed graph.
Calculation of both Pearson’s correlation and transfer entropy is supported. Transfer entropy is calculated according to the global average of local entropy method. All weights are optimized with respect to time shifts between the time series data vectors (i.e. cross-correlated).
The delay giving the maximum weight is returned, together with the maximum weights.
All weights are tested for significance. The Pearson’s correlation weights are tested for significance according to the parameters presented by Bauer2005. The transfer entropy weights are tested for significance using a non-parametric rank-order method using surrogate data generated according to the iterative amplitude adjusted Fourier transform method (iAAFT).
- class faultmap.weightcalc.WeightCalcData(mode, case, single_entropies, fft_calc, do_multiprocessing, use_gpu)[source]
Creates a data object from files or functions for use in weight calculation methods.
- Parameters:
- faultmap.weightcalc.writecsv_weightcalc(filename, items, header)[source]
CSV writer customized for use in weightcalc function.
- faultmap.weightcalc.calculate_weights(weight_calc_data, method, scenario, write_output)[source]
Determines the maximum weight between two variables by searching through a specified set of delays.
- Parameters:
weight_calc_data (WeightCalcData)
method (str) – Can be one of the following: ‘cross_correlation’ ‘partial_correlation’ – does not support time delays ‘transfer_entropy_kernel’ ‘transfer_entropy_kraskov’
scenario (str)
write_output (bool)
TODO: Fix partial correlation method to make use of time delays
Returns:
- faultmap.weightcalc.weight_calc(mode, case, writeoutput=False, single_entropies=False, calc_fft=False, do_multiprocessing=False, use_gpu=False)[source]
Reports the maximum weight as well as associated delay obtained by shifting the affected variable behind the causal variable a specified set of delays.
- Parameters:
mode (str) – Either ‘test’ or ‘cases’. Tests data are generated dynamically and stored in specified folders. Case data are read from file and stored under organized headings in the saveloc directory specified in config.json.
case (str) – The name of the case that is to be run. Points to dictionary in either test or case config files.
single_entropies (bool) – Flags whether the entropies of single signals should be calculated.
calc_fft (bool) – Indicates whether the FFT of all individual signals should be calculated.
do_multiprocessing (bool) – Indicates whether the weight calculation operations should run in parallel processing mode where all available CPU cores are utilized.
writeoutput (bool)
use_gpu (bool)
- Return type:
None
Notes
Supports calculating weights according to either correlation or transfer entropy metrics.