equired. raise_exception : bool, default=False If True then raise an exception if array is not symmetric. Returns ------- array_sym : {ndarray, sparse matrix} Symmetrized version of the input array, i.e. the average of array and array.transpose(). If sparse, then duplicate entries are first summed and zeros are eliminated. Examples -------- >>> import numpy as np >>> from sklearn.utils.validation import check_symmetric >>> symmetric_array = np.array([[0, 1, 2], [1, 0, 1], [2, 1, 0]]) >>> check_symmetric(symmetric_array) array([[0, 1, 2], [1, 0, 1], [2, 1, 0]]) >>> from scipy.sparse import csr_matrix >>> sparse_symmetric_array = csr_matrix(symmetric_array) >>> check_symmetric(sparse_symmetric_array) r