ClusterObjects: IEmSeriesList;
ClusterObjects: Prognoz.Platform.Interop.Modeller.IEmSeriesList;
The ClusterObjects property returns hierarchic cluster analysis objects collection.
If the objects are not specified, correct calculation of the method is not possible.
To execute the example, add links to the Modeller, Stat system assemblies.
Sub ClusterAnalysis;
Var
ExprMod: IExpressModeller;
Ar: Array[6] Of Double;
Series: IEmSeriesList;
Serie: IEmSerie;
Sett: IEmClusterAnalysisSettings;
Begin
ExprMod := New ExpressModeller.Create;
Sett := ExprMod.CreateClusterAnalysisSettings;
// Setting cluster analysis objects
Series := Sett.ClusterObjects;
Ar[0] := 10; Ar[1] := 20; Ar[2] := 30;
Ar[3] := 40; Ar[4] := 50; Ar[5] := 60;
Serie := ExprMod.Series.Add(Ar, "X1", "Data series 1");
Series.Add(Serie);
ar[0] := 12; ar[1] := 23; ar[2] := 34;
ar[3] := 45; ar[4] := 56; ar[5] := 67;
Serie := ExprMod.Series.Add(Ar, "X2", "Data series 2");
Series.Add(Serie);
ar[0] := 1; ar[1] := 2; ar[2] := 3;
ar[3] := 4; ar[4] := 5; ar[5] := 6;
Serie := ExprMod.Series.Add(Ar, "X3", "Data series 3");
Series.Add(Serie);
// Setting link method
Sett.ClusterLink := ClusterLinkType.CompleteLink;
// Setting metrics
Sett.ObjectDistance := ObjectDistanceType.EuclideanSqr;
// Setting indicators standardization mode
Sett.Standartization := StandartizationType.ScaleUser;
// Setting standardization coefficients
Sett.StdValues := Series.ItemByName("X2");
// Setting dendogram orientation
Sett.DendogramOrientation := DendogramOrientationType.North;
// Setting clusters number
Sett.ClusterCount := 2;
// Performing calculation
ExprMod.EvaluateMethod("C:\ClusterAnalysis.html", Sett, True);
End Sub ClusterAnalysis;
Example execution result: the Hierarchical Cluster Analysis method is calculated with set parameters, calculation report is saved to the file C:\ClusterAnalysis.html.
Imports Prognoz.Platform.Interop.Modeller;
Imports Prognoz.Platform.Interop.Stat;
…
Public Shared Sub Main(Params: StartParams);
Var
ExprMod: IExpressModeller;
Ar: Array[6] Of Double;
Series: IEmSeriesList;
Serie: IEmSerie;
Sett: IEmClusterAnalysisSettings;
Begin
ExprMod := New ExpressModeller.Create();
Sett := ExprMod.CreateClusterAnalysisSettings();
// Setting cluster analysis objects
Series := Sett.ClusterObjects;
Ar[0] := 10; Ar[1] := 20; Ar[2] := 30;
Ar[3] := 40; Ar[4] := 50; Ar[5] := 60;
Serie := ExprMod.Series.Add(Ar, "X1", "Data series 1");
Series.Add(Serie);
ar[0] := 12; ar[1] := 23; ar[2] := 34;
ar[3] := 45; ar[4] := 56; ar[5] := 67;
Serie := ExprMod.Series.Add(Ar, "X2", "Data series 2");
Series.Add(Serie);
ar[0] := 1; ar[1] := 2; ar[2] := 3;
ar[3] := 4; ar[4] := 5; ar[5] := 6;
Serie := ExprMod.Series.Add(Ar, "X3", "Data series 3");
Series.Add(Serie);
// Setting link method
Sett.ClusterLink := ClusterLinkType.cltCompleteLink;
// Setting metrics
Sett.ObjectDistance := ObjectDistanceType.odEuclideanSqr;
// Setting indicators standardization mode
Sett.Standartization := StandartizationType.stScaleUser;
// Setting standardization coefficients
Sett.StdValues := Series.ItemByName["X2"];
// Setting dendogram orientation
Sett.DendogramOrientation := DendogramOrientationType.doNorth;
// Setting clusters number
Sett.ClusterCount := 2;
// Performing calculation
ExprMod.EvaluateMethod("C:\ClusterAnalysis.html", Sett, True);
End Sub;
Example execution result: the Hierarchical Cluster Analysis method is calculated with set parameters, calculation report is saved to the file C:\ClusterAnalysis.html.
See also: