IClustersCompositionOrderItem.IndexUpperCluster

Syntax

IndexUpperCluster: Integer;

Description

The IndexUpperCluster property returns number of the cluster connected with IndexLowerCluster.

Example

Sub Main;

Var

hc: SmHierarchicalClusterAnalysis;

Obj: ISlSeries;

x1: Array Of Double;

Dist: ISlDistance;

res, i: Integer;

D: Double;

ClsOrder: IClustersCompositionOrder;

ClOrder: IClustersCompositionOrderItem;

Begin

hc := New SmHierarchicalClusterAnalysis.Create;

x1 := New Double[3];

//add characteristics, in this case 5 objects with 3 characteristics

x1[0] := 1; x1[1] := 1; x1[2] := 1;

Obj := hc.Objects;

Obj.Add.Value := x1;

x1[0] := 2; x1[1] := 3; x1[2] := 2;

Obj.Add.Value := x1;

x1[0] := 3; x1[1] := 6; x1[2] := 3;

Obj.Add.Value := x1;

x1[0] := 4; x1[1] := 8; x1[2] := 10;

Obj.Add.Value := x1;

x1[0] := 5; x1[1] := 8; x1[2] := 0;

Obj.Add.Value := x1;

hc.ClusterLink := ClusterLinkType.Centroid;

hc.ClusterCount := 2;

Dist := hc.Distance;

Dist.Type := ObjectDistanceType.EuclideanSqr;

Dist.Standartization := StandartizationType.ScaleStd;

hc.DendogramOrientation := DendogramOrientationType.East;

res := hc.Execute;

If res <> 0 Then

Debug.WriteLine(hc.Errors);

Else

Debug.WriteLine("Sequence of cluster composition");

ClsOrder := hc.ClustersCompositionOrder;

Debug.WriteLine("Bottom cluster Top cluster Distance");

For i := 0 To ClsOrder.Count - 1 Do

ClOrder := ClsOrder.Item(i);

d := ClOrder.IndexLowerCluster;

Debug.Write(d.ToString + ", ");

d := ClOrder.IndexUpperCluster;

Debug.Write(d.ToString + ", ");

d := ClOrder.ClusterDistance;

Debug.WriteLine(d.ToString);

End For;

End If;

End Sub Main;

After executing the example the console window displays sequence of cluster composition and distance between the cluster at the moment of grouping:

Module execution started

Sequence of cluster composition

Bottom cluster. Top cluster. Distance

1, 2, 0.87606540153654211

3, 5, 2.5856195416639305

3, 4, 4.705003611530632

1, 3, 5.9437403783716745

Module execution finished

See also:

IClustersCompositionOrderItem