Title: | Learning Hierarchical Clustering Algorithms |
---|---|
Description: | Classical hierarchical clustering algorithms, agglomerative and divisive clustering. Algorithms are implemented as a theoretical way, step by step. It includes some detailed functions that explain each step. Every function allows options to get different results using different techniques. The package explains non expert users how hierarchical clustering algorithms work. |
Authors: | Roberto Alcantara [aut, cre], Juan Jose Cuadrado [aut], Universidad de Alcala de Henares [aut] |
Maintainer: | Roberto Alcantara <[email protected]> |
License: | Unlimited |
Version: | 1.1 |
Built: | 2025-02-18 05:26:49 UTC |
Source: | https://github.com/cran/LearnClust |
To execute complete agglomerative hierarchical clusterization algorithm choosing distance and approach type.
agglomerativeHC(data, distance, approach)
agglomerativeHC(data, distance, approach)
data |
could be a numeric vector, a matrix or a numeric data frame. It will be transformed into matrix and list to be used. |
distance |
is a string. It chooses the distance to use. |
approach |
is a string. It chooses the approach to use. |
This function is the main part of the agglomerative hierarchical clusterization method. It executes the theoretical algorithm step by step.
1 - The function transforms data in useful object to be used.
2 - It creates the clusters.
3 - It calculates a matrix distances with the clusters created applying distance and approach given.
4 - It chooses the distance value and gets the clusters.
5 - It groups the clusters in a new one and updates clusters list.
6 - It repeats these steps until an unique cluster exists.
R object with a dendrogram, the grouped clusters and the list with every cluster.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
a <- c(1,2,1,3,1,4,1,5,1,6) matrixA <- matrix(a,ncol=2) dataFrameA <- data.frame(matrixA) agglomerativeHC(a,'EUC','MAX') agglomerativeHC(matrixA,'MAN','AVG') agglomerativeHC(dataFrameA,'CAN','MIN')
a <- c(1,2,1,3,1,4,1,5,1,6) matrixA <- matrix(a,ncol=2) dataFrameA <- data.frame(matrixA) agglomerativeHC(a,'EUC','MAX') agglomerativeHC(matrixA,'MAN','AVG') agglomerativeHC(dataFrameA,'CAN','MIN')
To explain the complete agglomerative hierarchical clusterization algorithm choosing distance and approach type.
agglomerativeHC.details(data, distance, approach)
agglomerativeHC.details(data, distance, approach)
data |
could be a numeric vector, a matrix or a numeric data frame. It will be transformed into matrix and list to be used. |
distance |
is a string. It chooses the distance to use. |
approach |
is a string. It chooses the approach to use. |
This function is the main part of the agglomerative hierarchical clusterization method. It explains the theoretical algorithm step by step.
1 - The function transforms data into useful object to be used.
2 - It creates the clusters.
3 - It calculates a matrix distance with the clusters created by applying the distance and the approach given.
4 - It chooses the distance value and gets the clusters.
5 - It groups the clusters in a new one and updates clusters list.
6 - It repeats these steps until an unique cluster exists.
agglomerative algorithm explanation.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
a <- c(1,2,1,3,1,4,1,5,1,6) matrixA <- matrix(a,ncol=2) dataFrameA <- data.frame(matrixA) agglomerativeHC.details(a,'EUC','MAX') agglomerativeHC.details(matrixA,'MAN','AVG') agglomerativeHC.details(dataFrameA,'CAN','MIN')
a <- c(1,2,1,3,1,4,1,5,1,6) matrixA <- matrix(a,ncol=2) dataFrameA <- data.frame(matrixA) agglomerativeHC.details(a,'EUC','MAX') agglomerativeHC.details(matrixA,'MAN','AVG') agglomerativeHC.details(dataFrameA,'CAN','MIN')
To calculate the Canberra distance of two clusters.
canberradistance(x, y)
canberradistance(x, y)
x |
is a numeric vector or a matrix. It represents the values of a cluster. |
y |
is a numeric vector or a matrix. It represents the values of a cluster. |
This function is part of the hierarchical clusterization method. The function calculates the
Canberra distance value from x
and y
.
canberra distance value.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
x <- c(1,2) y <- c(1,3) cluster1 <- matrix(x,ncol=2) cluster2 <- matrix(y,ncol=2) canberradistance(x,y) canberradistance(cluster1,cluster2)
x <- c(1,2) y <- c(1,3) cluster1 <- matrix(x,ncol=2) cluster2 <- matrix(y,ncol=2) canberradistance(x,y) canberradistance(cluster1,cluster2)
To show the formula and to return the Canberra distance of two clusters.
canberradistance.details(x, y)
canberradistance.details(x, y)
x |
is a numeric vector or a matrix. It represents the values of a cluster. |
y |
is a numeric vector or a matrix. It represents the values of a cluster. |
This function is part of the hierarchical clusterization method. The function calculates the
Canberra distance value from x
and y
.
canberra distance value with its formula.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
x <- c(1,2) y <- c(1,3) cluster1 <- matrix(x,ncol=2) cluster2 <- matrix(y,ncol=2) canberradistance(x,y) canberradistance(cluster1,cluster2)
x <- c(1,2) y <- c(1,3) cluster1 <- matrix(x,ncol=2) cluster2 <- matrix(y,ncol=2) canberradistance(x,y) canberradistance(cluster1,cluster2)
To calculate the Canberra distance between clusters applying weights given.
canberradistanceW(cluster1, cluster2, weight)
canberradistanceW(cluster1, cluster2, weight)
cluster1 |
is a cluster. |
cluster2 |
is a cluster. |
weight |
is a numeric vector. |
The function calculates the Canberra distance value from cluster1
and cluster2
, applying weights to the cluster's components.
canberra distance applying weights value.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
cluster1 <- matrix(c(1,2),ncol=2) cluster2 <- matrix(c(1,3),ncol=2) weight1 <- c(0.4,0.6) weight2 <- c(2,12) canberradistanceW(cluster1,cluster2,weight1) canberradistanceW(cluster1,cluster2,weight2)
cluster1 <- matrix(c(1,2),ncol=2) cluster2 <- matrix(c(1,3),ncol=2) weight1 <- c(0.4,0.6) weight2 <- c(2,12) canberradistanceW(cluster1,cluster2,weight1) canberradistanceW(cluster1,cluster2,weight2)
To explain how to calculate the Canberra distance between clusters applying weights given.
canberradistanceW.details(cluster1, cluster2, weight)
canberradistanceW.details(cluster1, cluster2, weight)
cluster1 |
is a cluster. |
cluster2 |
is a cluster. |
weight |
is a numeric vector. |
The function calculates the Canberra distance value from cluster1
and cluster2
, applying weights to the cluster's components.
canberra distance applying weights value. Explanation.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
cluster1 <- matrix(c(1,2),ncol=2) cluster2 <- matrix(c(1,3),ncol=2) weight1 <- c(0.4,0.6) weight2 <- c(2,12) canberradistanceW.details(cluster1,cluster2,weight1) canberradistanceW.details(cluster1,cluster2,weight2)
cluster1 <- matrix(c(1,2),ncol=2) cluster2 <- matrix(c(1,3),ncol=2) weight1 <- c(0.4,0.6) weight2 <- c(2,12) canberradistanceW.details(cluster1,cluster2,weight1) canberradistanceW.details(cluster1,cluster2,weight2)
To calculate the Chebyshev distance of two clusters.
chebyshevDistance(x, y)
chebyshevDistance(x, y)
x |
is a numeric vector or a matrix. It represents the values of a cluster. |
y |
is a numeric vector or a matrix. It represents the values of a cluster. |
This function is part of the hierarchical clusterization method. The function calculates the
Chebyshev distance value from x
and y
.
Chebyshev distance value.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
x <- c(1,2) y <- c(1,3) cluster1 <- matrix(x,ncol=2) cluster2 <- matrix(y,ncol=2) chebyshevDistance(x,y) chebyshevDistance(cluster1,cluster2)
x <- c(1,2) y <- c(1,3) cluster1 <- matrix(x,ncol=2) cluster2 <- matrix(y,ncol=2) chebyshevDistance(x,y) chebyshevDistance(cluster1,cluster2)
To show the formula of the Chebyshev distance of two clusters.
chebyshevDistance.details(x, y)
chebyshevDistance.details(x, y)
x |
is a numeric vector or a matrix. It represents the values of a cluster. |
y |
is a numeric vector or a matrix. It represents the values of a cluster. |
This function is part of the hierarchical clusterization method. The function calculates the
Chebyshev distance value from x
and y
.
Chebyshev distance value and formula.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
x <- c(1,2) y <- c(1,3) cluster1 <- matrix(x,ncol=2) cluster2 <- matrix(y,ncol=2) chebyshevDistance(x,y) chebyshevDistance(cluster1,cluster2)
x <- c(1,2) y <- c(1,3) cluster1 <- matrix(x,ncol=2) cluster2 <- matrix(y,ncol=2) chebyshevDistance(x,y) chebyshevDistance(cluster1,cluster2)
To calculate the Chebyshev distance between clusters applying weights given.
chebyshevDistanceW(cluster1, cluster2, weight)
chebyshevDistanceW(cluster1, cluster2, weight)
cluster1 |
is a cluster. |
cluster2 |
is a cluster. |
weight |
is a numeric vector. |
The function calculates the Chebyshev distance value from cluster1
and cluster2
, applying weights to the cluster's components.
Chebyshev distance applying weights value.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
cluster1 <- matrix(c(1,2),ncol=2) cluster2 <- matrix(c(1,3),ncol=2) weight1 <- c(0.4,0.6) weight2 <- c(2,12) chebyshevDistanceW(cluster1,cluster2,weight1) chebyshevDistanceW(cluster1,cluster2,weight2)
cluster1 <- matrix(c(1,2),ncol=2) cluster2 <- matrix(c(1,3),ncol=2) weight1 <- c(0.4,0.6) weight2 <- c(2,12) chebyshevDistanceW(cluster1,cluster2,weight1) chebyshevDistanceW(cluster1,cluster2,weight2)
To explain how to calculate the Chebyshev distance between clusters applying weights given.
chebyshevDistanceW.details(cluster1, cluster2, weight)
chebyshevDistanceW.details(cluster1, cluster2, weight)
cluster1 |
is a cluster. |
cluster2 |
is a cluster. |
weight |
is a numeric vector. |
The function calculates the Chebyshev distance value from cluster1
and cluster2
, applying weights to the cluster's components.
Chebyshev distance applying weights value. Explanation.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
cluster1 <- matrix(c(1,2),ncol=2) cluster2 <- matrix(c(1,3),ncol=2) weight1 <- c(0.4,0.6) weight2 <- c(2,12) chebyshevDistanceW.details(cluster1,cluster2,weight1) chebyshevDistanceW.details(cluster1,cluster2,weight2)
cluster1 <- matrix(c(1,2),ncol=2) cluster2 <- matrix(c(1,3),ncol=2) weight1 <- c(0.4,0.6) weight2 <- c(2,12) chebyshevDistanceW.details(cluster1,cluster2,weight1) chebyshevDistanceW.details(cluster1,cluster2,weight2)
To calculate the distance between clusters depending on the approach and distance type.
clusterDistance(cluster1, cluster2, approach, distance)
clusterDistance(cluster1, cluster2, approach, distance)
cluster1 |
is a matrix |
cluster2 |
is a matrix |
approach |
is a string. Type of function to apply. |
distance |
is a string. Type of distance to use. |
This function is part of the hierarchical clusterization method. The function calculates the
final distance between cluster1
and cluster2
applying the approach definition, using the distance type given.
approach
indicates the algorithm used to get the value. distance
indicates the distance used to get the value. Possible values: 'MAX'
,
'MIN'
, 'AVG'
.
Distance between clusters.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
cluster1 <- matrix(c(1,2),ncol=2) cluster2 <- matrix(c(1,4),ncol=2) clusterDistance.details(cluster1,cluster2,'AVG','MAN') clusterDistance.details(cluster1,cluster2,'MAX','OCT')
cluster1 <- matrix(c(1,2),ncol=2) cluster2 <- matrix(c(1,4),ncol=2) clusterDistance.details(cluster1,cluster2,'AVG','MAN') clusterDistance.details(cluster1,cluster2,'MAX','OCT')
To explain how to calculate the distance between clusters depending on the approach and distance type.
clusterDistance.details(cluster1, cluster2, approach, distance)
clusterDistance.details(cluster1, cluster2, approach, distance)
cluster1 |
is a matrix |
cluster2 |
is a matrix |
approach |
is a string. Type of function to apply. |
distance |
is a string. Type of distance to use. |
This function is part of the hierarchical clusterization method. The function explains how to calculate the
final distance between cluster1
and cluster2
applying the approach definition, using the distance type given.
approach
indicates the algorithm used to get the value. distance
indicates the distance used to get the value. Possible values: 'MAX'
,
'MIN'
, 'AVG'
.
Distance between clusters. Explanation.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
cluster1 <- matrix(c(1,2),ncol=2) cluster2 <- matrix(c(1,4),ncol=2) clusterDistance.details(cluster1,cluster2,'AVG','MAN') clusterDistance.details(cluster1,cluster2,'MAX','OCT')
cluster1 <- matrix(c(1,2),ncol=2) cluster2 <- matrix(c(1,4),ncol=2) clusterDistance.details(cluster1,cluster2,'AVG','MAN') clusterDistance.details(cluster1,cluster2,'MAX','OCT')
To calculate the distance depending on option
given.
clusterDistanceByApproach(distances, approach)
clusterDistanceByApproach(distances, approach)
distances |
is a numeric vector. |
approach |
is a string. Type of function to apply. |
This function is part of the hierarchical clusterization method. The function calculates the
distance value from distances
.
approach
indicates the algorithm used to get the value. Possible values: 'MAX'
,
'MIN'
, 'AVG'
.
max, min or average from a vector.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
distances1 <- c(4,14,24,34) distances2 <- c(1:10) clusterDistanceByApproach(distances1,'MAX') clusterDistanceByApproach(distances2,'MIN')
distances1 <- c(4,14,24,34) distances2 <- c(1:10) clusterDistanceByApproach(distances1,'MAX') clusterDistanceByApproach(distances2,'MIN')
To explain how to calculate the distance depending on option
given.
clusterDistanceByApproach.details(distances, approach)
clusterDistanceByApproach.details(distances, approach)
distances |
is a numeric vector. |
approach |
is a string. Type of function to apply. |
This function is part of the hierarchical clusterization method. The function explains how to calculate the
distance value from distances
.
approach
indicates the algorithm used to get the value. Possible values: 'MAX'
,
'MIN'
, 'AVG'
.
max, min or average from a vector.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
distances1 <- c(4,14,24,34) distances2 <- c(1:10) clusterDistanceByApproach(distances1,'MAX') clusterDistanceByApproach(distances2,'MIN')
distances1 <- c(4,14,24,34) distances2 <- c(1:10) clusterDistanceByApproach(distances1,'MAX') clusterDistanceByApproach(distances2,'MIN')
To check if two clusters include every element but without repeating anyone.
complementaryClusters(components, cluster1, cluster2)
complementaryClusters(components, cluster1, cluster2)
components |
is an elements list. It contains every component that has to be in one cluster or in the other one. But each element can only be included in one cluster. |
cluster1 |
is a cluster (matrix). |
cluster2 |
is a cluster (matrix). |
This function checks if the cluster that will be divided contains the simple elements that they have to include. They have to contain every element, but anyone should be duplicated.
The function will return a boolean value.
Boolean value.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
data <- c(1,2,1,3,1,4,1,5) components <- toListDivisive(data) cluster1 <- matrix(c(1,2,1,3),ncol=2) cluster2 <- matrix(c(1,4,1,5),ncol=2) cluster3 <- matrix(c(1,6,1,7),ncol=2) complementaryClusters(components,cluster1,cluster2) #TRUE complementaryClusters(components,cluster3,cluster2) #FALSE
data <- c(1,2,1,3,1,4,1,5) components <- toListDivisive(data) cluster1 <- matrix(c(1,2,1,3),ncol=2) cluster2 <- matrix(c(1,4,1,5),ncol=2) cluster3 <- matrix(c(1,6,1,7),ncol=2) complementaryClusters(components,cluster1,cluster2) #TRUE complementaryClusters(components,cluster3,cluster2) #FALSE
To explain how and why two clusters include every element but without repeating anyone.
complementaryClusters.details(components, cluster1, cluster2)
complementaryClusters.details(components, cluster1, cluster2)
components |
is an elements list. It contains every component that has to be in one cluster or in the other one. But each element can only be included in one cluster. |
cluster1 |
is a cluster (matrix). |
cluster2 |
is a cluster (matrix). |
This function checks if the cluster that will be divided contains the simple elements that they have to include. They have to contain every element, but anyone should be duplicated.
The function will return a boolean value.
Boolean value. Explanation.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
data <- c(1,2,1,3,1,4,1,5) components <- toListDivisive(data) cluster1 <- matrix(c(1,2,1,3),ncol=2) cluster2 <- matrix(c(1,4,1,5),ncol=2) cluster3 <- matrix(c(1,6,1,7),ncol=2) complementaryClusters.details(components,cluster1,cluster2) #TRUE complementaryClusters.details(components,cluster3,cluster2) #FALSE
data <- c(1,2,1,3,1,4,1,5) components <- toListDivisive(data) cluster1 <- matrix(c(1,2,1,3),ncol=2) cluster2 <- matrix(c(1,4,1,5),ncol=2) cluster3 <- matrix(c(1,6,1,7),ncol=2) complementaryClusters.details(components,cluster1,cluster2) #TRUE complementaryClusters.details(components,cluster3,cluster2) #FALSE
To execute hierarchical correlation algorithm applying weights, distance types, ...
correlationHC( data, target = NULL, weight = c(), distance = "EUC", normalize = TRUE, labels = NULL )
correlationHC( data, target = NULL, weight = c(), distance = "EUC", normalize = TRUE, labels = NULL )
data |
is a data frame with the main data. |
target |
is a data frame , a numeric vector or a matrix. Default value = NULL. |
weight |
is a numeric vector. Default value = empty vector. |
distance |
is a string. The distance type. Default value = Euclidean distance. |
normalize |
is a boolean parameter. If the user wants to normalize weights. Default value = TRUE. |
labels |
is a string vector. For the graphical solution. Default value = NULL. |
This function execute the complete hierarchical correlation method.
1 - The function transforms data in useful object to be used.
2 - It creates the clusters.
3 - It calculates the distance from the target to every cluster applying distance type given.
4 - It orders the distance in increasing way.
5 - It orders the clusters according to their distance from the previous step
6 - It shows the clusters sorted and the distance used.
R object with a dendrogram, the sorted distances and the list with every cluster.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
data <- matrix(c(1,2,1,4,5,1,8,2,9,6,3,5,8,5,4),ncol= 3) dataFrame <- data.frame(data) target1 <- c(1,2,3) target2 <- dataFrame[1,] weight1 <- c(1,6,3) weight2 <- c(0.1,0.6,0.3) correlationHC(dataFrame, target1) correlationHC(dataFrame, target1, weight1) correlationHC(dataFrame, target1, weight1, normalize = FALSE) correlationHC(dataFrame, target1, weight2, 'CAN', FALSE)
data <- matrix(c(1,2,1,4,5,1,8,2,9,6,3,5,8,5,4),ncol= 3) dataFrame <- data.frame(data) target1 <- c(1,2,3) target2 <- dataFrame[1,] weight1 <- c(1,6,3) weight2 <- c(0.1,0.6,0.3) correlationHC(dataFrame, target1) correlationHC(dataFrame, target1, weight1) correlationHC(dataFrame, target1, weight1, normalize = FALSE) correlationHC(dataFrame, target1, weight2, 'CAN', FALSE)
To explain how the hierarchical correlation algorithm works.
correlationHC.details( data, target = NULL, weight = c(), distance = "EUC", normalize = TRUE, labels = NULL )
correlationHC.details( data, target = NULL, weight = c(), distance = "EUC", normalize = TRUE, labels = NULL )
data |
is a data frame with the main data. |
target |
is a data frame , a numeric vector or a matrix. Default value = NULL. |
weight |
is a numeric vector. Default value = empty vector. |
distance |
is a string. The distance type. Default value = Euclidean distance. |
normalize |
is a boolean parameter. If the user wants to normalize weights. Default value = TRUE. |
labels |
is a string vector. For the graphical solution. Default value = NULL. |
This function explains the complete hierarchical correlation method. It explains the theoretical algorithm step by step.
1 - The function transforms data in useful object to be used.
2 - It creates the clusters.
3 - It calculates the distance from the target to every cluster applying the distance type given.
4 - It orders the distance in an increasing way.
5 - It orders the clusters according to their distance from the previous step
6 - It shows the clusters sorted and the distance used.
R object with a dendrogram, the sorted distances and the list with every cluster. Explanation.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
data <- matrix(c(1,2,1,4,5,1,8,2,9,6,3,5,8,5,4),ncol= 3) dataFrame <- data.frame(data) target1 <- c(1,2,3) target2 <- dataFrame[1,] weight1 <- c(1,6,3) weight2 <- c(0.1,0.6,0.3) correlationHC.details(dataFrame, target1) correlationHC.details(dataFrame, target1, weight1) correlationHC.details(dataFrame, target1, weight1, normalize = FALSE) correlationHC.details(dataFrame, target1, weight2, 'CAN', FALSE)
data <- matrix(c(1,2,1,4,5,1,8,2,9,6,3,5,8,5,4),ncol= 3) dataFrame <- data.frame(data) target1 <- c(1,2,3) target2 <- dataFrame[1,] weight1 <- c(1,6,3) weight2 <- c(0.1,0.6,0.3) correlationHC.details(dataFrame, target1) correlationHC.details(dataFrame, target1, weight1) correlationHC.details(dataFrame, target1, weight1, normalize = FALSE) correlationHC.details(dataFrame, target1, weight2, 'CAN', FALSE)
To calculate distances between two clusters applying weights depending on the distance type.
distances(cluster1, cluster2, distance, weight)
distances(cluster1, cluster2, distance, weight)
cluster1 |
is a matrix. |
cluster2 |
is a matrix. |
distance |
is a string. The distance type to apply. |
weight |
is a numeric vector. |
This function calculates distance applying distance
type and applying each weight to its characteristic.
Distance type could be EUC
, MAN
, CAN
, CHE
or OCT
.
Distance value applying weights.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
cluster1 <- matrix(c(2,3)) cluster2 <- matrix(c(4,5)) weight1 <- c(0.6,0.4) weight2 <- c(2,4) distances(cluster1, cluster2, 'MAN', weight1) distances(cluster1, cluster2, 'CHE', weight2)
cluster1 <- matrix(c(2,3)) cluster2 <- matrix(c(4,5)) weight1 <- c(0.6,0.4) weight2 <- c(2,4) distances(cluster1, cluster2, 'MAN', weight1) distances(cluster1, cluster2, 'CHE', weight2)
To explain how to calculate distances between two clusters applying weights depending on the distance type.
distances.details(cluster1, cluster2, distance, weight)
distances.details(cluster1, cluster2, distance, weight)
cluster1 |
is a matrix. |
cluster2 |
is a matrix. |
distance |
is a string. The distance type to apply. |
weight |
is a numeric vector. |
This function calculates distance applying distance
type and applying each weight to its characteristic.
Distance type could be EUC
, MAN
, CAN
, CHE
or OCT
.
Distance value applying weights. Explanation.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
cluster1 <- matrix(c(2,3)) cluster2 <- matrix(c(4,5)) weight1 <- c(0.6,0.4) weight2 <- c(2,4) distances.details(cluster1, cluster2, 'MAN', weight1) distances.details(cluster1, cluster2, 'CHE', weight2)
cluster1 <- matrix(c(2,3)) cluster2 <- matrix(c(4,5)) weight1 <- c(0.6,0.4) weight2 <- c(2,4) distances.details(cluster1, cluster2, 'MAN', weight1) distances.details(cluster1, cluster2, 'CHE', weight2)
To execute complete divisive hierarchical clusterization algorithm by choosing distance and approach types.
divisiveHC(data, distance, approach)
divisiveHC(data, distance, approach)
data |
could be a numeric vector, a matrix or a numeric data frame. It will be transformed into matrix and list to be used. |
distance |
is a string. It chooses the distance to use. |
approach |
is a string. It chooses the approach to use. |
This function is the main part of the divisive hierarchical clusterization method. It executes the theoretical algorithm step by step.
1 - The function transforms data in useful object to be used.
2 - It creates a cluster that includes every simple elements.
3 - It initializes posible clusters using the initial elements.
4 - It calculates a matrix distance with the clusters created in the 3rd step.
5 - It chooses the maximal distance value and gets the clusters to be divided.
6 - It divides the cluster into two new complementary clusters and updates the clusters list.
6 - It repeats these steps until every cluster can't be divided again. The solution includes every simple cluster.
A list with the divided clusters.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
a <- c(1,2,1,3,1,4,1,5,1,6) matrixA <- matrix(a,ncol=2) dataFrameA <- data.frame(matrixA) divisiveHC(a,'EUC','MAX') divisiveHC(matrixA,'MAN','AVG') divisiveHC(dataFrameA,'CHE','MIN')
a <- c(1,2,1,3,1,4,1,5,1,6) matrixA <- matrix(a,ncol=2) dataFrameA <- data.frame(matrixA) divisiveHC(a,'EUC','MAX') divisiveHC(matrixA,'MAN','AVG') divisiveHC(dataFrameA,'CHE','MIN')
To explain the complete divisive hierarchical clusterization algorithm by choosing distance and approach types.
divisiveHC.details(data, distance, approach)
divisiveHC.details(data, distance, approach)
data |
could be a numeric vector, a matrix or a numeric data frame. It will be transformed into matrix and list to be used. |
distance |
is a string. It chooses the distance to use. |
approach |
is a string. It chooses the approach to use. |
This function is the main part of the divisive hierarchical clusterization method. It explains the theoretical algorithm step by step.
1 - The function transforms data in useful object to be used.
2 - It creates a cluster that includes every simple elements.
3 - It initializes posible clusters using the initial elements.
4 - It calculates a matrix distance with the clusters created in the 3rd step.
5 - It chooses the maximal distance value and gets the clusters to be divided.
6 - It divides the cluster into two new complementary clusters and updates the clusters list.
6 - It repeats these steps until every cluster can't be divided again. The solution includes every simple cluster.
A list with the divided clusters. Explanation
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
a <- c(1,2,1,3,1,4,1,5,1,6) matrixA <- matrix(a,ncol=2) dataFrameA <- data.frame(matrixA) divisiveHC.details(a,'EUC','MAX') divisiveHC.details(matrixA,'MAN','AVG') divisiveHC.details(dataFrameA,'CHE','MIN')
a <- c(1,2,1,3,1,4,1,5,1,6) matrixA <- matrix(a,ncol=2) dataFrameA <- data.frame(matrixA) divisiveHC.details(a,'EUC','MAX') divisiveHC.details(matrixA,'MAN','AVG') divisiveHC.details(dataFrameA,'CHE','MIN')
To calculate the Euclidean distance of two clusters.
edistance(x, y)
edistance(x, y)
x |
is a numeric vector or a matrix. It represents the values of a cluster. |
y |
is a numeric vector or a matrix. It represents the values of a cluster. |
This function is part of the hierarchical clusterization method. The function calculates the
Euclidean distance value from x
and y
.
Euclidean distance value.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
x <- c(1,2) y <- c(1,3) cluster1 <- matrix(x,ncol=2) cluster2 <- matrix(y,ncol=2) edistance(x,y) edistance(cluster1,cluster2)
x <- c(1,2) y <- c(1,3) cluster1 <- matrix(x,ncol=2) cluster2 <- matrix(y,ncol=2) edistance(x,y) edistance(cluster1,cluster2)
To show the Euclidean distance formula and to calculate the Euclidean distance of two clusters.
edistance.details(x, y)
edistance.details(x, y)
x |
is a numeric vectoror a matrix. It represents the values of a cluster. |
y |
is a numeric vectoror a matrix. It represents the values of a cluster. |
This function is part of the hierarchical clusterization method. The function calculates the
Euclidean distance value from x
and y
.
Euclidean distance value and formula.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
x <- c(1,2) y <- c(1,3) cluster1 <- matrix(x,ncol=2) cluster2 <- matrix(y,ncol=2) edistance(x,y) edistance(cluster1,cluster2)
x <- c(1,2) y <- c(1,3) cluster1 <- matrix(x,ncol=2) cluster2 <- matrix(y,ncol=2) edistance(x,y) edistance(cluster1,cluster2)
To calculate the Euclidean distance between clusters applying weights given.
edistanceW(cluster1, cluster2, weight)
edistanceW(cluster1, cluster2, weight)
cluster1 |
is a cluster. |
cluster2 |
is a cluster. |
weight |
is a numeric vector. |
The function calculates the Euclidean distance value from cluster1
and cluster2
, applying weights to the cluster's components.
Euclidean distance applying weights value.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
cluster1 <- matrix(c(1,2),ncol=2) cluster2 <- matrix(c(1,3),ncol=2) weight1 <- c(0.4,0.6) weight2 <- c(2,12) edistanceW(cluster1,cluster2,weight1) edistanceW(cluster1,cluster2,weight2)
cluster1 <- matrix(c(1,2),ncol=2) cluster2 <- matrix(c(1,3),ncol=2) weight1 <- c(0.4,0.6) weight2 <- c(2,12) edistanceW(cluster1,cluster2,weight1) edistanceW(cluster1,cluster2,weight2)
To explain how to calculate the Euclidean distance between clusters applying weights given.
edistanceW.details(cluster1, cluster2, weight)
edistanceW.details(cluster1, cluster2, weight)
cluster1 |
is a cluster. |
cluster2 |
is a cluster. |
weight |
is a numeric vector. |
The function calculates the Euclidean distance value from cluster1
and cluster2
, applying weights to the cluster's components.
Euclidean distance applying weights value. Explanation.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
cluster1 <- matrix(c(1,2),ncol=2) cluster2 <- matrix(c(1,3),ncol=2) weight1 <- c(0.4,0.6) weight2 <- c(2,12) edistanceW.details(cluster1,cluster2,weight1) edistanceW.details(cluster1,cluster2,weight2)
cluster1 <- matrix(c(1,2),ncol=2) cluster2 <- matrix(c(1,3),ncol=2) weight1 <- c(0.4,0.6) weight2 <- c(2,12) edistanceW.details(cluster1,cluster2,weight1) edistanceW.details(cluster1,cluster2,weight2)
To get the clusters with the minimal distance value. By using the given distance
,
it gets the matrix index.
getCluster(distance, matrix)
getCluster(distance, matrix)
distance |
is a number. It should be in the matrix. |
matrix |
is a numeric matrix. |
This function is part of the hierarchical clusterization method. The function uses the
distance
value and gets the clustersId with the minimal distance.
For the divisive algorithm, it chooses the distances from a distances list.
numeric vector with two cluster indexs.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
matrixExample <- matrix(c(1:10), ncol=2) getCluster(2,matrixExample)
matrixExample <- matrix(c(1:10), ncol=2) getCluster(2,matrixExample)
To explain how to get the clusters with the minimal distance value. By using the given distance
,
it gets the matrix index.
getCluster.details(distance, matrix)
getCluster.details(distance, matrix)
distance |
is a number. It should be in the matrix. |
matrix |
is a numeric matrix. |
This function is part of the hierarchical clusterization method. The function uses the
distance
value and gets the clustersId with the minimal distance.
For the divisive algorithm, it chooses the distances from a distances list.
Numeric vector with two clusters indexs.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
matrixExample <- matrix(c(1:10), ncol=2) getCluster.details(2,matrixExample)
matrixExample <- matrix(c(1:10), ncol=2) getCluster.details(2,matrixExample)
To get the clusters with the maximal distance value. By using the given distance
,
it gets the matrix index.
getClusterDivisive(distance, vector)
getClusterDivisive(distance, vector)
distance |
is a number. It should be in the matrix. |
vector |
is a numeric vector |
This function is part of the hierarchical clusterization method. The function uses the
distance
value and gets the clustersId with the minimal distance.
For the divisive algorithm, it chooses the distances from a distances list.
A cluster.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
getClusterDivisive(2,c(1:10)) getClusterDivisive(6,c(2,4,6,8,10,12))
getClusterDivisive(2,c(1:10)) getClusterDivisive(6,c(2,4,6,8,10,12))
To explain how to get the clusters with the maximal distance value. By using the given distance
,
it gets the matrix index.
getClusterDivisive.details(distance, vector)
getClusterDivisive.details(distance, vector)
distance |
is a number. It should be in the matrix. |
vector |
is a numeric vector. |
This function is part of the hierarchical clusterization method. The function uses the
distance
value and gets the clustersId with the minimal distance.
For the divisive algorithm, it chooses the distances from a distances list.
A cluster. Explanation.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
getClusterDivisive.details(2,c(1:10)) getClusterDivisive(6,c(2,4,6,8,10,12))
getClusterDivisive.details(2,c(1:10)) getClusterDivisive(6,c(2,4,6,8,10,12))
To initialize clusters for the divisive algorithm.
initClusters(initList)
initClusters(initList)
initList |
is a clusters list. It will contain clusters with one element. |
This function will calculate every cluster that can be created by joining initial clusters with each other. It creates clusters from length = 1 until a cluster with every element is created.
These clusters will be used to find the most different clusters that we can create by dividing the initial cluster.
A cluster list.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
data <- c(1:8) matrix <- matrix(data,ncol=2) listData <- toListDivisive(data) listMatrix <- toListDivisive(matrix) initClusters(listData) initClusters(listMatrix)
data <- c(1:8) matrix <- matrix(data,ncol=2) listData <- toListDivisive(data) listMatrix <- toListDivisive(matrix) initClusters(listData) initClusters(listMatrix)
To explain how to initialize clusters for the divisive algorithm.
initClusters.details(initList)
initClusters.details(initList)
initList |
is a clusters list. It will contain clusters with one element. |
This function will explain how to calculate every cluster that can be created by joining initial clusters with each other. It creates clusters from length = 1 until a cluster with every element is created.
These clusters will be used to find the most different clusters that we can create by dividing the initial cluster.
A cluster list. Explanation.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
data <- c(1:8) matrix <- matrix(data, ncol=2) listData <- toListDivisive(data) listMatrix <- toListDivisive(matrix) initClusters.details(listData) initClusters.details(listMatrix)
data <- c(1:8) matrix <- matrix(data, ncol=2) listData <- toListDivisive(data) listMatrix <- toListDivisive(matrix) initClusters.details(listData) initClusters.details(listMatrix)
To initialize data, hierarchical correlation algorithm.
initData(data)
initData(data)
data |
is a data frame with the main data. |
This function is part of the hierarchical correlation method. The function initializes data
transforming each row from the data frame into
a matrix with every row elements.
A cluster list. Initializing data.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
data <- matrix(c(1,2,1,4,5,1,8,2,9,6,3,5,8,5,4),ncol= 3) dataFrame <- data.frame(data) initData(dataFrame)
data <- matrix(c(1,2,1,4,5,1,8,2,9,6,3,5,8,5,4),ncol= 3) dataFrame <- data.frame(data) initData(dataFrame)
To explain how to initialize data, hierarchical correlation algorithm.
initData.details(data)
initData.details(data)
data |
is a data frame with the main data. |
This function is part of the hierarchical correlation method. The function initializes data
transforming each row from the data frame into
a matrix with every row elements.
A cluster list. Initializing data. Explanation.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
data <- matrix(c(1,2,1,4,5,1,8,2,9,6,3,5,8,5,4),ncol= 3) dataFrame <- data.frame(data) initData.details(dataFrame)
data <- matrix(c(1,2,1,4,5,1,8,2,9,6,3,5,8,5,4),ncol= 3) dataFrame <- data.frame(data) initData.details(dataFrame)
An auxiliar function to display a picture.
initImages(path)
initImages(path)
path |
is a file path. |
To initialize target, hierarchical correlation algorithm. It checks if target is valid, if not, it initializes the target
initTarget(target, data)
initTarget(target, data)
target |
is a numeric vector, a matrix or a data frame. |
data |
is a data frame with the main data. |
This function is part of the hierarchical correlation method. The function initializes target
and checks if it is a valid target.
The function transforms the target into a matrix. Then, it checks if the target has only one row and the same columns has the main data.
If it is not a valid target, the function will notice the problem and will initialized a new target with every column with value 0.
A cluster.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
data <- matrix(c(1,2,1,4,5,1,8,2,9,6,3,5,8,5,4),ncol= 3) dataFrame <- data.frame(data) target1 <- matrix(c(2,3)) target2 <- matrix(c(2,3,6)) initTarget(target1,dataFrame) initTarget(target2,dataFrame)
data <- matrix(c(1,2,1,4,5,1,8,2,9,6,3,5,8,5,4),ncol= 3) dataFrame <- data.frame(data) target1 <- matrix(c(2,3)) target2 <- matrix(c(2,3,6)) initTarget(target1,dataFrame) initTarget(target2,dataFrame)
To initialize target, hierarchical correlation algorithm. It checks if target is valid, if not, it initializes the target
initTarget.details(target, data)
initTarget.details(target, data)
target |
is a numeric vector, a matrix or a data frame. |
data |
is a data frame with the main data. |
This function is part of the hierarchical correlation method. The function initializes target
and checks if it is an acceptable target.
The function transforms the target into a matrix. Then, it checks if the target has only one row and the same columns have the main data.
If it is not an acceptable target, the function will notice the problem and will initialize a new target with every column with value 0.
A cluster. Explanation.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
data <- matrix(c(1,2,1,4,5,1,8,2,9,6,3,5,8,5,4),ncol= 3) dataFrame <- data.frame(data) target1 <- matrix(c(2,3)) target2 <- matrix(c(2,3,6)) initTarget.details(target1,dataFrame) initTarget.details(target2,dataFrame)
data <- matrix(c(1,2,1,4,5,1,8,2,9,6,3,5,8,5,4),ncol= 3) dataFrame <- data.frame(data) target1 <- matrix(c(2,3)) target2 <- matrix(c(2,3,6)) initTarget.details(target1,dataFrame) initTarget.details(target2,dataFrame)
To calculate the matrix distance by using distance
type.
matrixDistance(list, distance)
matrixDistance(list, distance)
list |
is a clusters list. |
distance |
is a literal. |
This function is part of the hierarchical clusterization method. The function calculates the matrix distance by using the distance type given.
The list
parameter will be a list with the clusters as rows and columns.
The function avoids distances equal 0 and undefined clusters.
data <- c(1:10) clusters <- toList(data) matrixDistance(clusters, 'EUC')
data <- c(1:10) clusters <- toList(data) matrixDistance(clusters, 'EUC')
Get the matrix maximal value.
maxDistance(matrix)
maxDistance(matrix)
matrix |
is a numeric matrix. It could be a numeric vector. |
This function is part of the hierarchical clusterization method. The function uses the numeric
vector or matrix matrix
given and return the maximal value.
The function avoids distances equal 0, and initialize maximal value with an auxiliar function initMax
,
which gets the first matrix element with a valid distance.
numeric value. Max value from a matrix
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
matrixExample <- matrix(c(1:10), nrow=2) maxDistance(1:10) maxDistance(matrixExample)
matrixExample <- matrix(c(1:10), nrow=2) maxDistance(1:10) maxDistance(matrixExample)
To explain how to get the matrix maximal value.
maxDistance.details(matrix)
maxDistance.details(matrix)
matrix |
is a numeric matrix. It could be a numeric vector. |
This function is part of the hierarchical clusterization method. The function uses the numeric
vector or matrix matrix
given and return the maximal value.
The function avoids distances equal 0, and initialize maximal value with an auxiliar function initMax
,
which gets the first matrix element with a valid distance.
Numeric value. Max value from a matrix. Explanation.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
matrixExample <- matrix(c(1:10), nrow=2) maxDistance.details(1:10) maxDistance.details(matrixExample)
matrixExample <- matrix(c(1:10), nrow=2) maxDistance.details(1:10) maxDistance.details(matrixExample)
To calculate the matrix distance by using distance
and approach
type.
mdAgglomerative(list, distance, approach)
mdAgglomerative(list, distance, approach)
list |
is a clusters list. |
distance |
is a literal. The distance type to be used. |
approach |
is a literal. The approach type to be used. |
This function is part of the hierarchical clusterization method. The function calculates the matrix distance by using the distance and approach type given.
The list
parameter will be a list with the clusters as rows and columns.
The function avoids distances equal 0 and undefined clusters.
A matrix distance.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
data <- c(1,2,1,3,1,4,1,5,1,6) clusters <- toList(data) mdAgglomerative(clusters, 'EUC', 'MAX') mdAgglomerative(clusters, 'CHE', 'AVG')
data <- c(1,2,1,3,1,4,1,5,1,6) clusters <- toList(data) mdAgglomerative(clusters, 'EUC', 'MAX') mdAgglomerative(clusters, 'CHE', 'AVG')
To explain how to calculate the matrix distance by using distance
and approach
type.
mdAgglomerative.details(list, distance, approach)
mdAgglomerative.details(list, distance, approach)
list |
is a clusters list. |
distance |
is a literal. The distance type to be used. |
approach |
is a literal. The approach type to be used. |
This function is part of the hierarchical clusterization method. The function calculates the matrix distance by using the distance and approach type given.
The list
parameter will be a list with the clusters as rows and columns.
The function avoids distances equal 0 and undefined clusters.
A matrix distance. Explanation.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
data <- c(1,2,1,3,1,4,1,5,1,6) clusters <- toList(data) mdAgglomerative.details(clusters, 'EUC', 'MAX') mdAgglomerative.details(clusters, 'CHE', 'AVG')
data <- c(1,2,1,3,1,4,1,5,1,6) clusters <- toList(data) mdAgglomerative.details(clusters, 'EUC', 'MAX') mdAgglomerative.details(clusters, 'CHE', 'AVG')
To calculate the matrix distance by using distance
and approach
types.
mdDivisive(list, distance, approach, components)
mdDivisive(list, distance, approach, components)
list |
is a clusters list. |
distance |
is a string. The distance type to be used. |
approach |
is a string. The approach type to be used. |
components |
is a clusters list. It contains every clusters with only one element. It is used to check if complementary condition is 'TRUE'. |
This function is part of the divisive hierarchical clusterization method. The function calculates the matrix distance by using the distance and approach types given.
The list
parameter will be a list with the clusters as rows and columns.
The function avoids distances equal 0 and undefined clusters.
It also avoids distances between clusters that are not complementary because they can't be chosen to divide all the clusters.
Matrix distance.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
data <- c(1,2,1,3,1,4,1,5,1,6) clusters <- toList(data) components <- toList(data) mdDivisive(clusters, 'EUC', 'MAX', components) mdDivisive(clusters, 'MAN', 'MIN', components)
data <- c(1,2,1,3,1,4,1,5,1,6) clusters <- toList(data) components <- toList(data) mdDivisive(clusters, 'EUC', 'MAX', components) mdDivisive(clusters, 'MAN', 'MIN', components)
To explain how to calculate the matrix distance by using distance
and approach
types.
mdDivisive.details(list, distance, approach, components)
mdDivisive.details(list, distance, approach, components)
list |
is a clusters list. |
distance |
is a string. The distance type to be used. |
approach |
is a string. The approach type to be used. |
components |
is a clusters list. It contains every clusters with only one element. It is used to check if complementary condition is 'TRUE'. |
This function is part of the divisive hierarchical clusterization method. The function calculates the matrix distance by using the distance and approach types given.
The list
parameter will be a list with the clusters as rows and columns.
The function avoids distances equal 0 and undefined clusters.
It also avoids distances between clusters that are not complementary because they can't be chosen to divide all the clusters.
Matrix distance. Explanation.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
data <- c(1,2,1,3,1,4,1,5,1,6) clusters <- toList(data) components <- toList(data) mdDivisive.details(clusters, 'EUC', 'MAX', components) mdDivisive.details(clusters, 'MAN', 'MIN', components)
data <- c(1,2,1,3,1,4,1,5,1,6) clusters <- toList(data) components <- toList(data) mdDivisive.details(clusters, 'EUC', 'MAX', components) mdDivisive.details(clusters, 'MAN', 'MIN', components)
To calculate the Manhattan distance of two clusters.
mdistance(x, y)
mdistance(x, y)
x |
is a numeric vectoror a matrix. It represents the values of a cluster. |
y |
is a numeric vectoror a matrix. It represents the values of a cluster. |
This function is part of the hierarchical clusterization method. The function calculates the
Manhattan distance value from x
and y
.
Manhattan distance value.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
x <- c(1,2) y <- c(1,3) cluster1 <- matrix(x,ncol=2) cluster2 <- matrix(y,ncol=2) mdistance(x,y) mdistance(cluster1,cluster2)
x <- c(1,2) y <- c(1,3) cluster1 <- matrix(x,ncol=2) cluster2 <- matrix(y,ncol=2) mdistance(x,y) mdistance(cluster1,cluster2)
To explain how to calculate the Manhattan distance of two clusters.
mdistance.details(x, y)
mdistance.details(x, y)
x |
is a numeric vectoror a matrix. It represents the values of a cluster. |
y |
is a numeric vectoror a matrix. It represents the values of a cluster. |
This function is part of the hierarchical clusterization method. The function calculates the
Manhattan distance value from x
and y
.
Manhattan distance value and formula.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
x <- c(1,2) y <- c(1,3) cluster1 <- matrix(x,ncol=2) cluster2 <- matrix(y,ncol=2) mdistance(x,y) mdistance(cluster1,cluster2)
x <- c(1,2) y <- c(1,3) cluster1 <- matrix(x,ncol=2) cluster2 <- matrix(y,ncol=2) mdistance(x,y) mdistance(cluster1,cluster2)
To calculate the Manhattan distance between clusters applying weights given.
mdistanceW(cluster1, cluster2, weight)
mdistanceW(cluster1, cluster2, weight)
cluster1 |
is a cluster. |
cluster2 |
is a cluster. |
weight |
is a numeric vector. |
The function calculates the Manhattan distance value from cluster1
and cluster2
, applying weights to the cluster's components.
Manhattan distance applying weights value.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
cluster1 <- matrix(c(1,2),ncol=2) cluster2 <- matrix(c(1,3),ncol=2) weight1 <- c(0.4,0.6) weight2 <- c(2,12) mdistanceW(cluster1,cluster2,weight1) mdistanceW(cluster1,cluster2,weight2)
cluster1 <- matrix(c(1,2),ncol=2) cluster2 <- matrix(c(1,3),ncol=2) weight1 <- c(0.4,0.6) weight2 <- c(2,12) mdistanceW(cluster1,cluster2,weight1) mdistanceW(cluster1,cluster2,weight2)
To explain how to calculate the Manhattan distance between clusters applying weights given.
mdistanceW.details(cluster1, cluster2, weight)
mdistanceW.details(cluster1, cluster2, weight)
cluster1 |
is a cluster. |
cluster2 |
is a cluster. |
weight |
is a numeric vector. |
The function calculates the Manhattan distance value from cluster1
and cluster2
, applying weights to the cluster's components.
Manhattan distance applying weights value. Explanation.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
cluster1 <- matrix(c(1,2),ncol=2) cluster2 <- matrix(c(1,3),ncol=2) weight1 <- c(0.4,0.6) weight2 <- c(2,12) mdistanceW.details(cluster1,cluster2,weight1) mdistanceW.details(cluster1,cluster2,weight2)
cluster1 <- matrix(c(1,2),ncol=2) cluster2 <- matrix(c(1,3),ncol=2) weight1 <- c(0.4,0.6) weight2 <- c(2,12) mdistanceW.details(cluster1,cluster2,weight1) mdistanceW.details(cluster1,cluster2,weight2)
Get the matrix minimal value.
minDistance(matrix)
minDistance(matrix)
matrix |
is a numeric matrix. It could be a numeric vector. |
This function is part of the hierarchical clusterization method. The function uses the numeric
vector or matrix matrix
given and return the minimal value.
The function avoids distances equal 0, and initialize minimum value with an auxiliar function initMin
,
which gets the first matrix element with a valid distance.
Numeric value. Min value from a matrix.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
matrixExample <- matrix(c(1:10), nrow=2) minDistance(1:10) minDistance(matrixExample)
matrixExample <- matrix(c(1:10), nrow=2) minDistance(1:10) minDistance(matrixExample)
To explain how to get the matrix minimal value.
minDistance.details(matrix)
minDistance.details(matrix)
matrix |
is a numeric matrix. It could be a numeric vector. |
This function is part of the hierarchical clusterization method. The function uses the numeric
vector or matrix matrix
given and return the minimal value.
The function avoids distances equal 0, and initialize minimum value with an auxiliar function initMin
,
which gets the first matrix element with a valid distance.
Numeric value. Min value from a matrix. Explanation.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
matrixExample <- matrix(c(1:10), nrow=2) minDistance(1:10) minDistance.details(matrixExample)
matrixExample <- matrix(c(1:10), nrow=2) minDistance(1:10) minDistance.details(matrixExample)
To create the cluster formed by the two clusters given. Add the new cluster to list
.
newCluster(list, clusters)
newCluster(list, clusters)
list |
is the generic cluster list. |
clusters |
is a vector with the matrix index clusters. |
This function is part of the hierarchical clusterization method.
1 - The function maps clusters
in list
.
2 - It creates a new cluster from them.
3 - It adds the new cluster to list
.
4 - It disables the clusters used in the second step.
A list with clusters.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
data <- c(1:10) list <- toList(data) clusters <- c(1,2) newCluster(list,clusters)
data <- c(1:10) list <- toList(data) clusters <- c(1,2) newCluster(list,clusters)
To explain how to create the cluster formed by the two clusters given. Add the new cluster to list
.
newCluster.details(list, clusters)
newCluster.details(list, clusters)
list |
is the generic cluster list. |
clusters |
is a vector with the matrix index clusters. |
This function is part of the hierarchical clusterization method.
1 - The function maps clusters
in list
.
2 - It creates a new cluster from them.
3 - It adds the new cluster to list
.
4 - It disables the clusters used in the second step.
A list with clusters. Explanation.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
data <- c(1:10) list <- toList(data) clusters <- c(1,2) newCluster.details(list,clusters)
data <- c(1:10) list <- toList(data) clusters <- c(1,2) newCluster.details(list,clusters)
To normalize weight values if normalize
= TRUE.
normalizeWeight(normalize, weight, data)
normalizeWeight(normalize, weight, data)
normalize |
is a boolean value. |
weight |
is a numeric vector. |
data |
is a data.frame. |
This function allows users to normalize weights.
If there is not any weight, the function will create a numeric vector of "1".
If normalize = TRUE, the function will make every weight value as a "[0:1]" value.
If normalize = FALSE, the function will not make any changes, weights will be the same.
Numeric vector with updated weights.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
data <- data.frame(matrix(c(1:10),ncol = 2)) weight1 <- c(0.6,0.4) weight2 <- c(2,4) normalizeWeight(FALSE, weight1, data) normalizeWeight(TRUE, weight2, data) normalizeWeight(FALSE, weight2, data)
data <- data.frame(matrix(c(1:10),ncol = 2)) weight1 <- c(0.6,0.4) weight2 <- c(2,4) normalizeWeight(FALSE, weight1, data) normalizeWeight(TRUE, weight2, data) normalizeWeight(FALSE, weight2, data)
To explain how to normalize weight values if normalize
= TRUE.
normalizeWeight.details(normalize, weight, data)
normalizeWeight.details(normalize, weight, data)
normalize |
is a boolean value. |
weight |
is a numeric vector. |
data |
is a data.frame. |
This function allows users to normalize weights.
If there is not any weight, the function will create a numeric vector of "1".
If normalize = TRUE, the function will make every weight value as a "[0:1]" value.
If normalize = FALSE, the function will not make any changes, weights will be the same.
Numeric vector with updated weights. Explanation.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
data <- data.frame(matrix(c(1:10),ncol = 2)) weight1 <- c(0.6,0.4) weight2 <- c(2,4) normalizeWeight.details(FALSE, weight1, data) normalizeWeight.details(TRUE, weight2, data) normalizeWeight.details(FALSE, weight2, data)
data <- data.frame(matrix(c(1:10),ncol = 2)) weight1 <- c(0.6,0.4) weight2 <- c(2,4) normalizeWeight.details(FALSE, weight1, data) normalizeWeight.details(TRUE, weight2, data) normalizeWeight.details(FALSE, weight2, data)
To calculate the octile distance of two clusters.
octileDistance(x, y)
octileDistance(x, y)
x |
is a numeric vector or a matrix. It represents the values of a cluster. |
y |
is a numeric vector or a matrix. It represents the values of a cluster. |
This function is part of the hierarchical clusterization method. The function calculates the
octile distance value from x
and y
.
Octile distance value.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
x <- c(1,2) y <- c(1,3) cluster1 <- matrix(x,ncol=2) cluster2 <- matrix(y,ncol=2) octileDistance(x,y) octileDistance(cluster1,cluster2)
x <- c(1,2) y <- c(1,3) cluster1 <- matrix(x,ncol=2) cluster2 <- matrix(y,ncol=2) octileDistance(x,y) octileDistance(cluster1,cluster2)
To explain how to calculate the octile distance of two clusters.
octileDistance.details(x, y)
octileDistance.details(x, y)
x |
is a numeric vector or a matrix. It represents the values of a cluster. |
y |
is a numeric vector or a matrix. It represents the values of a cluster. |
This function is part of the hierarchical clusterization method. The function calculates the
octile distance value from x
and y
.
Octile distance value.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
x <- c(1,2) y <- c(1,3) cluster1 <- matrix(x,ncol=2) cluster2 <- matrix(y,ncol=2) octileDistance.details(x,y) octileDistance.details(cluster1,cluster2)
x <- c(1,2) y <- c(1,3) cluster1 <- matrix(x,ncol=2) cluster2 <- matrix(y,ncol=2) octileDistance.details(x,y) octileDistance.details(cluster1,cluster2)
To calculate the Octile distance between clusters applying weights given.
octileDistanceW(cluster1, cluster2, weight)
octileDistanceW(cluster1, cluster2, weight)
cluster1 |
is a cluster. |
cluster2 |
is a cluster. |
weight |
is a numeric vector. |
The function calculates the Octile distance value from cluster1
and cluster2
, applying weights to the cluster's components.
Octile distance applying weights value.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
cluster1 <- matrix(c(1,2),ncol=2) cluster2 <- matrix(c(1,3),ncol=2) weight1 <- c(0.4,0.6) weight2 <- c(2,12) octileDistanceW(cluster1,cluster2,weight1) octileDistanceW(cluster1,cluster2,weight2)
cluster1 <- matrix(c(1,2),ncol=2) cluster2 <- matrix(c(1,3),ncol=2) weight1 <- c(0.4,0.6) weight2 <- c(2,12) octileDistanceW(cluster1,cluster2,weight1) octileDistanceW(cluster1,cluster2,weight2)
To explain how to calculate the Octile distance between clusters applying weights given.
octileDistanceW.details(cluster1, cluster2, weight)
octileDistanceW.details(cluster1, cluster2, weight)
cluster1 |
is a cluster. |
cluster2 |
is a cluster. |
weight |
is a numeric vector. |
The function calculates the Octile distance value from cluster1
and cluster2
, applying weights to the cluster's components.
Octile distance applying weights value. Explanation.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
cluster1 <- matrix(c(1,2),ncol=2) cluster2 <- matrix(c(1,3),ncol=2) weight1 <- c(0.4,0.6) weight2 <- c(2,12) octileDistanceW.details(cluster1,cluster2,weight1) octileDistanceW.details(cluster1,cluster2,weight2)
cluster1 <- matrix(c(1,2),ncol=2) cluster2 <- matrix(c(1,3),ncol=2) weight1 <- c(0.4,0.6) weight2 <- c(2,12) octileDistanceW.details(cluster1,cluster2,weight1) octileDistanceW.details(cluster1,cluster2,weight2)
To transform data
into list.
toList(data)
toList(data)
data |
could be a numeric vector, a matrix or a numeric data frame. |
This function is part of the agglomerative hierarchical clusterization method. The function initializes
data
content as a list.
In agglomerative algorithm, it adds a TRUE
flag to each element, which indicates that the cluster is not grouped.
A list with clusters.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
data <- c(1:10) matrix <- matrix(data,ncol=2) dataFrame <- data.frame(matrix) toList(data) toList(matrix) toList(dataFrame)
data <- c(1:10) matrix <- matrix(data,ncol=2) dataFrame <- data.frame(matrix) toList(data) toList(matrix) toList(dataFrame)
To explain how to transform data
into list.
toList.details(data)
toList.details(data)
data |
could be a numeric vector, a matrix or a numeric data frame. |
This function is part of the agglomerative hierarchical clusterization method. The function initializes
data
content as a list.
In agglomerative algorithm, it adds a TRUE
flag to each element, which indicates that the cluster is not grouped.
A list with cñlusters. Explanation.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
data <- c(1:10) matrix <- matrix(data,ncol=2) dataFrame <- data.frame(matrix) toList(data) toList(matrix) toList(dataFrame)
data <- c(1:10) matrix <- matrix(data,ncol=2) dataFrame <- data.frame(matrix) toList(data) toList(matrix) toList(dataFrame)
To transform data
into list.
toListDivisive(data)
toListDivisive(data)
data |
could be a numeric vector, a matrix or a numeric data frame. |
This function is part of the divisive hierarchical clusterization method. The function initializes
data
content as a list.
a list with clusters.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
data <- c(1:10) matrix <- matrix(data,ncol=2) dataFrame <- data.frame(matrix) toListDivisive(data) toListDivisive(matrix) toListDivisive(dataFrame)
data <- c(1:10) matrix <- matrix(data,ncol=2) dataFrame <- data.frame(matrix) toListDivisive(data) toListDivisive(matrix) toListDivisive(dataFrame)
To explain how to transform data
into list.
toListDivisive.details(data)
toListDivisive.details(data)
data |
could be a numeric vector, a matrix or a numeric data frame. |
This function is part of the divisive hierarchical clusterization method. The function initializes
data
content as a list.
A list with clusters. Explanation.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
data <- c(1:10) matrix <- matrix(data,ncol=2) dataFrame <- data.frame(matrix) toListDivisive.details(data) toListDivisive.details(matrix) toListDivisive.details(dataFrame)
data <- c(1:10) matrix <- matrix(data,ncol=2) dataFrame <- data.frame(matrix) toListDivisive.details(data) toListDivisive.details(matrix) toListDivisive.details(dataFrame)
To delete the clusters already used to create a new one.
usefulClusters(list)
usefulClusters(list)
list |
is a list of clusters. |
This function is part of the hierarchical clusterization method. The function updates the cluster list with the clusters used after to calculate de matrix distance.
A list of clusters.
Roberto Alcántara [email protected]
Juan José Cuadrado [email protected]
Universidad de Alcalá de Henares
data <- c(1:10) list <- toList(data) usefulClusters(list)
data <- c(1:10) list <- toList(data) usefulClusters(list)