Loaders
Contains functions to load transition matrices from arrays or predefined csv's.
load_from_data(data, normalizer=standard_row_normalization)
Based on a Gaussian similarity matrix, create a transition matrix for the data as given in the array.
Parameters:
-
data
(ndarray
) –Array in which the rows represent data points.
-
normalizer
(Callable[[ndarray], ndarray]
, default:standard_row_normalization
) –Normalization function used to create a stochastic matrix from the Gaussian similarity matrix, by default standard_row_normalization. See normalizers.py for pre-defined options.
Returns:
-
ndarray
–Transition matrix of a Markov chain for the given data.
Source code in pykda\loaders.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
|
load_predefined_transition_matrix(name, normalizer=standard_row_normalization)
Load a predefined csv file from the data folder as transition matrix. The data is normalized when needed.
Parameters:
-
name
(str
) –Name of the transition matrix to be loaded.
-
normalizer
(Callable[[ndarray], ndarray]
, default:standard_row_normalization
) –Normalization function used to create a stochastic matrix from a matrix A, by default standard_row_normalization. See normalizers.py for pre-defined options.
Returns:
-
ndarray
–Transition matrix of a Markov chain.
Source code in pykda\loaders.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
|
load_transition_matrix(A, normalizer=standard_row_normalization)
Load a transition matrix from a given array. If the array is not a stochastic matrix, the function will try to normalize it.
Parameters:
-
A
(Union[ndarray, list[list]]
) –Array to be loaded as a Markov chain transition matrix.
-
normalizer
(Callable[[ndarray], ndarray]
, default:standard_row_normalization
) –Normalization function used to create a stochastic matrix from a matrix A, by default standard_row_normalization. See normalizers.py for pre-defined options.
Returns:
-
ndarray
–Transition matrix of a Markov chain.
Source code in pykda\loaders.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
|