membership               package:clue               R Documentation

_M_e_m_b_e_r_s_h_i_p_s _o_f _P_a_r_t_i_t_i_o_n_s

_D_e_s_c_r_i_p_t_i_o_n:

     Compute the memberships values for objects representing
     partitions.

_U_s_a_g_e:

     cl_membership(x, k = n_of_classes(x))
     as.cl_membership(x)

     as.cl_hard_partition(x)

_A_r_g_u_m_e_n_t_s:

       x: an R object representing a partition of objects.

       k: an integer giving the number of columns (corresponding to
          class ids) to be used in the membership matrix.  Must not be
          less, and default to, the number of classes in the partition.

_D_e_t_a_i_l_s:

     'cl_membership' is a generic function.

     The methods provided in package 'clue' handle the partitions
     obtained from clustering functions in the base R distribution, as
     well as packages 'cclust', 'cluster', 'e1071', and 'mclust' (and
     of course, 'clue' itself).

     'as.cl_membership' can be used for coercing "raw" class ids (given
     as atomic vectors) or membership values (given as numeric
     matrices) to membership objects.

_V_a_l_u_e:

     An object of class '"cl_membership"' with the matrix of membership
     values.

     For 'as.cl_hard_partition', an object of class '"cl_membership"'
     with the membership values of the hard partition obtained by
     taking the class ids of the (first) maximal membership values.

_S_e_e _A_l_s_o:

     'is.cl_partition'

_E_x_a_m_p_l_e_s:

     ## Getting the memberships of a single soft partition.
     d <- dist(USArrests)
     hclust_methods <- c("ward", "single", "complete", "average",
                         "mcquitty", "median", "centroid")
     hclust_results <- lapply(hclust_methods, function(m) hclust(d, m))
     ## Now create an ensemble from the results.
     hens <- cl_ensemble(list = hclust_results)
     names(hens) <- hclust_methods
     ## Create a dissimilarity object from this.
     d1 <- cl_dissimilarity(hens)
     ## And compute a soft partition.
     require("cluster")
     party <- fanny(d1, 2)
     cl_membership(party)
     ## The "nearest" hard partition to this:
     as.cl_hard_partition(party)
     ## (which has the same class ids as cl_class_ids(party)).

     ## Converting all elements in an ensemble of partitions to their
     ## memberships.
     pens <- cl_boot(USArrests, 30, 3)
     pens
     pens <- cl_ensemble(list = lapply(pens, cl_membership))
     pens
     pens[[length(pens)]]

