R/CrossEntropyClustering.R

Defines functions CrossEntropyClustering

Documented in CrossEntropyClustering

CrossEntropyClustering=function(Data,ClusterNo,PlotIt=FALSE,...){
  # INPUT
  # Data[1:n,1:d]     Data set with n observations and d features
  # ClusterNo         Number of clusters to search for
  # 
  # OPTIONAL
  # PlotIt            Boolean. Decision to plot or not
  # 
  # OUTPUT
  # Cls[1:n]          Clustering of data
  # Object            Object of CEC::cec algorithm
  #
  # Author: MT
  if (!requireNamespace('CEC')) {
    message(
      'Subordinate clustering package is missing. No computations are performed.
            Please install the package which is defined in "Suggests".'
    )
    return(
      list(
        Cls = rep(1, nrow(Data)),
        Object = "Subordinate clustering package is missing.
                Please install the package which is defined in 'Suggests'."
      )
    )
  }
  
  model=CEC::cec(Data,centers = ClusterNo,...)
  
  Cls=model$cluster
  if(PlotIt){
    ClusterPlotMDS(Data,Cls)
  }
  
  Cls=ClusterRename(Cls,Data)
  return(list(Cls=Cls,Object=model))
}

Try the FCPS package in your browser

Any scripts or data that you put into this service are public.

FCPS documentation built on Sept. 7, 2020, 5:10 p.m.