| TypeBasedStrategy {D2MCS} | R Documentation |
Feature clustering strategy.
Description
Features are sorted by descendant according to the relevance value obtained after applying an specific heuristic. Next, features are distributed into N clusters following a card-dealing methodology. Finally best distribution is assigned to the distribution having highest homogeneity.
Details
The strategy is suitable only for binary and real features. Other features are automatically grouped into a specific cluster named as 'unclustered'.
Super class
D2MCS::GenericClusteringStrategy -> TypeBasedStrategy
Methods
Public methods
Inherited methods
Method new()
Method for initializing the object arguments during runtime.
Usage
TypeBasedStrategy$new( subset, heuristic, configuration = StrategyConfiguration$new() )
Arguments
subsetThe
Subsetused to apply the feature-clustering strategy.heuristicThe heuristic used to compute the relevance of each feature. Must inherit from
GenericHeuristicabstract class.configurationOptional parameter to customize configuration parameters for the strategy. Must inherited from
StrategyConfigurationabstract class.
Method execute()
Function responsible of performing the clustering strategy
over the defined Subset.
Usage
TypeBasedStrategy$execute(verbose = FALSE)
Arguments
verboseA logical value to specify if more verbosity is needed.
Method getDistribution()
Function used to obtain a specific cluster distribution.
Usage
TypeBasedStrategy$getDistribution( num.clusters = NULL, num.groups = NULL, include.unclustered = FALSE )
Arguments
Returns
A list with the features comprising an specific clustering distribution.
Method createTrain()
The function is used to create a Trainset object from a specific clustering distribution.
Usage
TypeBasedStrategy$createTrain( subset, num.clusters = NULL, num.groups = NULL, include.unclustered = FALSE )
Arguments
subsetThe
Subsetobject used as a basis to create the train set (seeTrainsetclass).num.clustersA numeric value to select the number of clusters (define the distribution).
num.groupsA single or numeric vector value to identify a specific group that forms the clustering distribution.
include.unclusteredA logical value to determine if unclustered features should be included.
Details
If num.clusters and num.groups are not defined,
best clustering distribution is used to create the train set.
Returns
A Trainset object.
Method plot()
The function is responsible for creating a plot to visualize the clustering distribution.
Usage
TypeBasedStrategy$plot(dir.path = NULL, file.name = NULL)
Arguments
dir.pathAn optional character argument to define the name of the directory where the exported plot will be saved. If not defined, the file path will be automatically assigned to the current working directory, '
getwd()'.file.nameA character to define the name of the PDF file where the plot is exported.
Method saveCSV()
The function is used to save the clustering distribution to a CSV file.
Usage
TypeBasedStrategy$saveCSV(dir.path = NULL, name = NULL, num.clusters = NULL)
Arguments
dir.pathThe name of the directory to save the CSV file.
nameDefines the name of the CSV file.
num.clustersAn optional parameter to select the number of clusters to be saved. If not defined, all cluster distributions will be saved.
Method clone()
The objects of this class are cloneable with this method.
Usage
TypeBasedStrategy$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
See Also
GenericClusteringStrategy,
StrategyConfiguration