SOMUtils
SOMUtils functions.
- susi.SOMUtils.check_estimation_input(X: Sequence, y: Sequence, *, is_classification: bool = False) Tuple[ndarray, ndarray] [source]
Check input arrays.
This function is adapted from sklearn.utils.validation.
- Parameters:
X (nd-array or list) – Input data.
y (nd-array, list) – Labels.
is_classification (boolean (default=`False`)) – Wether the data is used for classification or regression tasks.
- Returns:
X (object) – The converted and validated X.
y (object) – The converted and validated y.
- susi.SOMUtils.decreasing_rate(a_1: float, a_2: float, *, iteration_max: int, iteration: int, mode: str) float [source]
Return a decreasing rate from collection.
- Parameters:
a_1 (float) – Starting value of decreasing rate
a_2 (float) – End value of decreasing rate
iteration_max (int) – Maximum number of iterations
iteration (int) – Current number of iterations
mode (str) – Mode (= formula) of the decreasing rate
- Returns:
rate – Decreasing rate
- Return type:
Examples
>>> import susi >>> susi.decreasing_rate(0.8, 0.1, 100, 5, "exp")
- susi.SOMUtils.modify_weight_matrix_online(som_array: ndarray, *, dist_weight_matrix: ndarray, true_vector: ndarray, learning_rate: float) ndarray [source]
Modify weight matrix of the SOM for the online algorithm.
- Parameters:
som_array (np.ndarray) – Weight vectors of the SOM shape = (self.n_rows, self.n_columns, X.shape[1])
dist_weight_matrix (np.ndarray of float) – Current distance weight of the SOM for the specific node
true_vector (np.ndarray) – True vector
learning_rate (float) – Current learning rate of the SOM
- Returns:
Weight vector of the SOM after the modification
- Return type:
np.array