Class KMedoidsImputer

java.lang.Object
smile.feature.imputation.KMedoidsImputer
All Implemented Interfaces:
Serializable, Function<Tuple,Tuple>, Transform

public class KMedoidsImputer extends Object implements Transform
Missing value imputation by K-Medoids clustering. The k-medoids algorithm is an adaptation of the k-means algorithm. Rather than calculate the mean of the items in each cluster, a representative item, or medoid, is chosen for each cluster at each iteration. The missing values of an instance are replaced the corresponding ones of the nearest medoid.
See Also:
  • Constructor Details

    • KMedoidsImputer

      public KMedoidsImputer(CLARANS<Tuple> kmedoids)
      Constructor.
      Parameters:
      kmedoids - the K-Medoids clustering.
  • Method Details

    • apply

      public Tuple apply(Tuple x)
      Specified by:
      apply in interface Function<Tuple,Tuple>
    • fit

      public static KMedoidsImputer fit(DataFrame data, Distance<Tuple> distance, int k)
      Fits the missing value imputation values.
      Parameters:
      data - the training data.
      distance - the lambda of distance measure.
      k - the number of clusters.
      Returns:
      the imputer.