The item distribution performance operator calculates its performance in the sum of squares case very simply. The number of examples in each cluster is divided by the total number of examples in all clusters. This is squared and the values for each cluster are summed.
For example, three clusters containing 1, 2 and 3 items would have an item distribution score of 0.389. This is 1/36 + 4/36 + 9/36 = 14/36 = 0.389.
For a situation where one cluster dominates and the others clusters are very small in comparison, this value will tend to 1. For the opposite situation, where the clusters have equal numbers of examples, the value tends to 1/N where N is the number of clusters.
Search this blog
Sunday, 3 April 2011
Wednesday, 30 March 2011
Renaming attributes with regular expressions
If you have an attribute with this name
Firstpart_Secondpart_Thirdpart
and you want to rename it to
Thirdpart_Secondpart_Firstpart
Use the 'Rename By Replacing' operator with this
(.*)_(.*)_(.*)
in the 'replace what' field
and
$3_$2_$1
in the 'replace by' field.
The brackets denote what is known as a capturing group so that everything inside that matches can be used later on by the use of the $1, $2 and $3 entries. The '.*' means match 0 or more characters and will continue until the '_' is found. The capturing group brackets mean that everything from the beginning of the string up to the character before the '_' will be placed into capturing group 1.
Firstpart_Secondpart_Thirdpart
and you want to rename it to
Thirdpart_Secondpart_Firstpart
Use the 'Rename By Replacing' operator with this
(.*)_(.*)_(.*)
in the 'replace what' field
and
$3_$2_$1
in the 'replace by' field.
The brackets denote what is known as a capturing group so that everything inside that matches can be used later on by the use of the $1, $2 and $3 entries. The '.*' means match 0 or more characters and will continue until the '_' is found. The capturing group brackets mean that everything from the beginning of the string up to the character before the '_' will be placed into capturing group 1.
Tuesday, 22 March 2011
Counting clusters: part II
Here's an example that uses the k-means clustering algorithm to partition example sets into clusters. It uses the same generated data as here but this time it uses different cluster performance operators to determine how well the clustering works.
Specifically there are examples for
Interpreting the shape of these graphs is complex and the subject for another day. In this case, the "right" answer is 8 and the measures don't contradict this.
As usual, the answer does not appear by magic and clustering requires a human to look at the results but the performance measures give a helping hand to focus attention to important areas.
Specifically there are examples for
- Davies-Bouldin
- Average within centroid distance
- Cluster density
- Sum of squares item distribution
- Gini item distribution
Interpreting the shape of these graphs is complex and the subject for another day. In this case, the "right" answer is 8 and the measures don't contradict this.
As usual, the answer does not appear by magic and clustering requires a human to look at the results but the performance measures give a helping hand to focus attention to important areas.
Subscribe to:
Posts (Atom)
