def _test_pairplot_with_gmm_outputs(**kws): X = np.random.rand(15, 3) gmm = GaussianMixture(n_components=3, **kws).fit(X) labels = ["A"] * 5 + ["B"] * 5 + ["C"] * 5 cluster_palette = {0: "red", 1: "blue", 2: "green"} label_palette = {"A": "red", "B": "blue", "C": "green"} fig = pairplot_with_gmm(X, gmm) fig = pairplot_with_gmm( X, gmm, labels=labels, cluster_palette=cluster_palette, label_palette=label_palette, )
def _test_pairplot_with_gmm_inputs(caller: unittest.TestCase, **kws): X = np.random.rand(15, 3) gmm = GaussianMixture(n_components=3, **kws).fit(X) labels = ["A"] * 5 + ["B"] * 5 + ["C"] * 5 # test data with caller.assertRaises(ValueError): pairplot_with_gmm(X="test", gmm=gmm) with caller.assertRaises(ValueError): pairplot_with_gmm(X=X, gmm=gmm, labels=["A"]) with caller.assertRaises(NameError): pairplot_with_gmm(X, gmm=None)
def test_pairplot_with_gmm_inputs(): X = np.random.rand(15, 3) gmm = GaussianMixture(n_components=3, covariance_type="full").fit(X) labels = ["A"] * 5 + ["B"] * 5 + ["C"] * 5 # test data with pytest.raises(ValueError): pairplot_with_gmm(X="test", gmm=gmm) with pytest.raises(ValueError): pairplot_with_gmm(X=X, gmm=gmm, labels=["A"]) with pytest.raises(NameError): pairplot_with_gmm(X, gmm=None)