ISmBinning.Settings

Syntax

Settings: IBinningSettings;

Description

The Settings property returns parameters of the Binning procedure.

Comments

To get calculation results, use the ISmBinning.Categories property.

Example

Add a link to the Stat system assembly.

Sub UserProc;
Var
    Bin: SmBinning;
    arr: Array Of Double;
    Categories: Array Of Integer;
    i, res: Integer;
    Settings: IBinningSettings;
    Clusters: IClustersType;
    Cl: IClusterType;
Begin
    // Create object to execute the Binning procedure
    Bin := New SmBinning.Create;
    // Set array of initial vectors
    arr := New Double[14];
    arr[0] := 27; arr[7] := 36;
    arr[1] := 11; arr[8] := 26;
    arr[2] := Double.Nan; arr[9] := 26;
    arr[3] := 36; arr[10] := 9;
    arr[4] := 35; arr[11] := Double.Nan;
    arr[5] := Double.Nan; arr[12] := 27;
    arr[6] := 11; arr[13] := 10;
    Bin.Values.Value := arr;
    // Get procedure settings
    Settings := Bin.Settings;
    // Set binning method
    Settings.Method := BinningMethod.KMeansClustering;
    // Set number of resulting categories
    Settings.NumOfCategories := 4;
    // Specify missing data as a particular category
    Settings.TreatNanAsCategory := True;
    // Set maximum number of iterations
    Settings.MaxIt := 9;
    // Execute the Binning procedure
    res := Bin.Execute;
    // If executing does not contain any errors, display the result to the console window
    If res = 0 Then
        // Display categories
        Debug.WriteLine("Categories");
        Categories := Bin.Categories;
        Debug.Indent;
        For i := 0 To Categories.Length - 1 Do
            Debug.WriteLine(i.ToString + ": " + Categories[i].ToString);
        End For;
        Debug.Unindent;
        Debug.WriteLine("");
        // Display clusters
        Debug.WriteLine("Clusters");
        Clusters := Settings.Clusters;
        Debug.Indent;
        For i := 0 To Clusters.Count - 1 Do
            Cl := Clusters.Item(i);
            Debug.WriteLine("№ " + i.ToString);
            Debug.Indent;
            Debug.WriteLine(((i = 0)? "[" : "(") + Cl.LowerBound[0].ToString + ";" + Cl.UpperBound[0].ToString + "]");
            Debug.WriteLine("center: " + Cl.Center[0].ToString);
            Debug.WriteLine("number of objects: " + Cl.Size.ToString);
            Debug.Unindent;
        End For;
        Debug.Unindent;
    End If;
End Sub UserProc;

After executing the example the Binning procedure will be executed for the specified array. Results are displayed in console window.

See also:

ISmBinning