def test_mnn_with_vector_gamma(): n_sample = len(np.unique(digits['target'])) # vector gamma build_graph(data, thresh=0, n_pca=20, decay=10, knn=5, random_state=42, sample_idx=digits['target'], kernel_symm='gamma', gamma=np.linspace(0, 1, n_sample - 1))
def test_mnn_with_square_gamma_wrong_length(): n_sample = len(np.unique(digits['target'])) # square matrix gamma of the wrong size build_graph(data, thresh=0, n_pca=20, decay=10, knn=5, random_state=42, sample_idx=digits['target'], kernel_symm='gamma', gamma=np.tile(np.linspace(0, 1, n_sample - 1), n_sample).reshape(n_sample - 1, n_sample))
def test_mnn_with_vector_theta(): n_sample = len(np.unique(digits["target"])) # vector theta build_graph( data, thresh=0, n_pca=20, decay=10, knn=5, random_state=42, sample_idx=digits["target"], kernel_symm="mnn", theta=np.linspace(0, 1, n_sample - 1), )
def test_mnn_with_matrix_theta(): n_sample = len(np.unique(digits["target"])) # square matrix theta of the wrong size build_graph( data, thresh=0, n_pca=20, decay=10, knn=5, random_state=42, sample_idx=digits["target"], kernel_symm="mnn", theta=np.tile(np.linspace(0, 1, n_sample), n_sample).reshape( n_sample, n_sample ), )
def test_mnn_with_vector_theta(): with assert_raises_message( TypeError, "Expected `theta` as a float. Got <class 'numpy.ndarray'>."): n_sample = len(np.unique(digits["target"])) # vector theta build_graph( data, thresh=0, n_pca=20, decay=10, knn=5, random_state=42, sample_idx=digits["target"], kernel_symm="mnn", theta=np.linspace(0, 1, n_sample - 1), )
def test_mnn_with_matrix_theta(): with assert_raises_message( TypeError, "Expected `theta` as a float. Got <class 'numpy.ndarray'>."): n_sample = len(np.unique(digits["target"])) # square matrix theta of the wrong size build_graph( data, thresh=0, n_pca=20, decay=10, knn=5, random_state=42, sample_idx=digits["target"], kernel_symm="mnn", theta=np.tile(np.linspace(0, 1, n_sample), n_sample).reshape(n_sample, n_sample), )