Data: ISlSeries;
Data: Prognoz.Platform.Interop.Stat.ISlSeries;
The Data property determines source data.
Use the ISmHighlightExceptions.ExceptionLevels and ISmHighlightExceptions.Indexes properties to get analysis results.
To execute the example, add a link to the Stat system assembly.
Sub UserHighlEx;
Var
method: SmHighlightExceptions;
status, gender, income: Array[20] Of Double;
Data: ISlSeries;
i, res: Integer;
Excep: Array Of Double;
Ind: Array Of Integer;
s: String;
Begin
// Source data
status[0] := 1; gender[0] := 1; income[0] := 1;
status[1] := 1; gender[1] := 0; income[1] := 0;
status[2] := 1; gender[2] := 0; income[2] := 2;
status[3] := 0; gender[3] := 0; income[3] := 2;
status[4] := 0; gender[4] := 0; income[4] := 0;
status[5] := 1; gender[5] := 1; income[5] := 0;
status[6] := 0; gender[6] := 0; income[6] := 2;
status[7] := 1; gender[7] := 0; income[7] := 1;
status[8] := 1; gender[8] := 0; income[8] := 0;
status[9] := 1; gender[9] := 0; income[9] := 0;
status[10] := 1; gender[10] := 1; income[10] := 0;
status[11] := 0; gender[11] := 1; income[11] := 2;
status[12] := 1; gender[12] := 0; income[12] := 2;
status[13] := 1; gender[13] := 0; income[13] := 1;
status[14] := 0; gender[14] := 0; income[14] := 1;
status[15] := 0; gender[15] := 1; income[15] := 0;
status[16] := 0; gender[16] := 0; income[16] := 0;
status[17] := 1; gender[17] := 1; income[17] := 2;
status[18] := 0; gender[18] := 0; income[18] := 1;
status[19] := 0; gender[19] := 0; income[19] := 0;
// Create a method
method := New SmHighlightExceptions.Create;
// Set analyzed data
Data := method.Data;
Data.Add.Value := status;
Data.Add.Value := gender;
Data.Add.Value := income;
// Missing data treatment method
method.MissingData.Method := MissingDataMethod.Casewise;
// Perform calculation and output results
res := method.Execute;
If (res = 0) Then
Ind := method.Indexes;
Excep := method.ExceptionLevels;
For i := 0 To Ind.Length - 1 Do
If Ind[i] <> -1 Then
s := "Observation '" + i.ToString + "' exceptional";
Debug.WriteLine(s);
s := " - exceptionality level (by all attributes): ";
Debug.WriteLine(s + Excep[i].ToString);
s := " - attribute with maximum exceptionality level: ";
Debug.WriteLine(s + Ind[i].ToString);
Else
Debug.WriteLine("Observation '" + i.ToString + "' is not exceptional");
End If;
End For;
End If;
End Sub UserHighlEx;
Result of procedure execution: exceptions are searched for in the initial data; the results are displayed to the console window.
Imports Prognoz.Platform.Interop.Stat;
…
Public Shared Sub UserHighlEx();
Var
method: SmHighlightExceptions;
status, gender, income: Array[20] Of Double;
Data: ISlSeries;
i, res: Integer;
Excep, Ind: System.Array;
s: String;
Begin
// Source data
status[0] := -1; gender[0] := 1; income[0] := 1;
status[1] := -1; gender[1] := 0; income[1] := 0;
status[2] := -1; gender[2] := 0; income[2] := 2;
status[3] := 0; gender[3] := 0; income[3] := 2;
status[4] := 0; gender[4] := 0; income[4] := 0;
status[5] := -1; gender[5] := 1; income[5] := 0;
status[6] := 0; gender[6] := 0; income[6] := 2;
status[7] := -1; gender[7] := 0; income[7] := Double.Nan;
status[8] := -1; gender[8] := 0; income[8] := 0;
status[9] := -1; gender[9] := 0; income[9] := 0;
status[10] := -1; gender[10] := 1; income[10] := 0;
status[11] := 0; gender[11] := 1; income[11] := 2;
status[12] := -1; gender[12] := 0; income[12] := 2;
status[13] := -1; gender[13] := 0; income[13] := 1;
status[14] := 0; gender[14] := 0; income[14] := 1;
status[15] := 0; gender[15] := 1; income[15] := 0;
status[16] := 0; gender[16] := 0; income[16] := 0;
status[17] := 1; gender[17] := 1; income[17] := Double.Nan;
status[18] := 0; gender[18] := 0; income[18] := 1;
status[19] := 0; gender[19] := 0; income[19] := 0;
// Create a method
method := New SmHighlightExceptions.Create();
// Set analyzed data
Data := method.Data;
Data.Add().Value := status;
Data.Add().Value := gender;
Data.Add().Value := income;
// Missing data treatment method
method.MissingData.Method := MissingDataMethod.mdmCasewise;
// Perform calculation and output
results
res := method.Execute();
If (res = 0) Then
Ind := method.Indexes;
Excep := method.ExceptionLevels;
For i := 0 To Ind.Length - 1 Do
If Ind[i] As integer <> -1 Then
s := "Observation '" + i.ToString() + "' is exceptional";
System.Diagnostics.Debug.WriteLine(s);
s := " - exceptionality level (by all attributes): ";
System.Diagnostics.Debug.WriteLine(s + Excep[i].ToString());
s := " - attribute with maximum exceptionality level: ";
System.Diagnostics.Debug.WriteLine(s + Ind[i].ToString());
Else
System.Diagnostics.Debug.WriteLine("Observation '" + i.ToString() + "' is not exceptional");
End If;
End For;
End If;
End Sub UserHighlEx;
Result of procedure execution: exceptions are searched for in the initial data; the results are displayed to the console window.
See also: