def __init__(self, obj, X=None, labels=None, labels_true=None, store_X=False, digits=3): self.model = obj self.components = obj.n_components self.variables = obj.n_features_in_ self.covariance_type = obj.covariance_type self.centers = _clust_centers(obj.means_) self.covariance = obj.covariances_ self.labels, self.proba, self.cluster_size = _clust_proba( obj, X, labels) self.labels_names = np.unique(self.labels) self.cluster_weights = pd.DataFrame(obj.weights_) self.ARI, self.FM = _clustering_evaluation(self.labels, labels_true, digits) self.SIL, self.DB, self.CH = _clustering_metrics( self.labels, X, digits) self.BIC, self.AIC = _criterion_gmm(obj, X, digits) self.iter = obj.n_iter_ self.init = obj.n_init self.init_type = obj.init_params self.X = _store_X(X, store_X) self.labels_true = labels_true
def plot(self, X=None, palette='Set2'): if X is None: X = self.X labels = self.labels _scatter_clusters(_store_X(X, True), labels, palette)
def __init__(self, obj, X = 'None', labels_true=None, store_X=False, digits = 3): self.model = obj self.n_clusters = obj.n_clusters self.variables = np.shape(obj.centers)[1] self.centers = _clust_centers(obj.centers) self.labels = MAP(obj.u) self.cluster_size, self.cluster_weights = _clust_weight(self.labels) self.ARI, self.FM = _clustering_evaluation(self.labels, labels_true, digits) self.fuzzy = obj.m self.membership = obj.u self.X = _store_X(X, store_X) self.labels_true = labels_true
def __init__(self, obj, X=None, labels_true=None, store_X=False, digits = 3): self.model = obj self.n_clusters = obj.n_clusters self.variables = np.shape(obj.cluster_centers_)[1] self.SIL, self.DB, self.CH = _clustering_metrics(obj.labels_, X, digits) self.centers = _clust_centers(obj.cluster_centers_) self.labels = obj.labels_ self.labels_names = np.unique(obj.labels_) self.cluster_size, self.cluster_weights = _clust_weight(obj.labels_) self.ARI, self.FM = _clustering_evaluation(obj.labels_, labels_true, digits) self.iter = obj.n_iter_ self.init = obj.n_init self.init_type = obj.init self.algorithm_type = obj._algorithm self.X = _store_X(X, store_X) self.labels_true = labels_true
def __init__(self, obj, X=None, labels_true=None, store_X=False, digits=3): self.model = obj self.n_clusters = np.unique(obj.labels_).shape[0] self.variables = obj.n_features_in_ self.SIL, self.DB, self.CH = _clustering_metrics( obj.labels_, X, digits) self.centers = _clust_centers_X(X, obj.labels_) self.labels = obj.labels_ self.labels_names = obj.n_features_in_ self.cluster_size, self.cluster_weights = _clust_weight(obj.labels_) self.ARI, self.FM = _clustering_evaluation(obj.labels_, labels_true, digits) self.eps = obj.eps self.min_samples = obj.min_samples self.metric = obj.metric self.power_mink = obj.p self.leaf = obj.leaf_size self.algorithm_type = obj.algorithm self.X = _store_X(X, store_X) self.labels_true = labels_true