from sklearn.mixture import GaussianMixture gmm = GaussianMixture(n_components=2) gmm.fit(XA) yP = gmm.predict_proba(XB) # produces probabilities # Arbitrary labels with unsupervised clustering may need to be reversed if len(XB[np.round(yP[:,0])!=yB]) > n/4: yP = 1 - yP assess(np.round(yP[:,0]))