FillTarget;
FillTarget();
The FillTarget method unloads missing data treatment results into the data source.
Unloading is available only after method calculation.
Executing the example requires that the repository contains a table with the DATAMINING_DATA identifier. The table must consist of several columns containing only numeric values. The part of values must be missing in the last column.
Add links to the Metabase, Ms, Stat system assemblies.
Sub UserProc;
Var
mb: IMetabase;
TableDS: IDmTableDataSource;
Method: IDmMethod;
BackProp: IDmBackPropagation;
i: Integer;
Attrs: Array Of Integer;
Begin
mb := MetabaseClass.Active;
// Create table data source
TableDS := (New TableDataSource.Create) As IDmTableDataSource;
// Determine source table
TableDS.Table := mb.ItemByID("DATAMINING_DATA").Bind;
// Create calculation method
Method := (New DataMiningMethod.Create) As IDmMethod;
// Specify method type
Method.Kind := DmMethodKind.BackPropagation;
// Set input data source
Method.InputDataSource := TableDS;
// Set data consumer
Method.OutputDataSource := TableDS;
// Set up calculation method parameters
BackProp := Method.Details As IDmBackPropagation;
// Determine column for analysis
BackProp.Target := TableDS.FieldCount - 1;
// Set factors that influence analysis
Attrs := New Integer[TableDS.FieldCount - 2];
For i := 0 To Attrs.Length - 1 Do
Attrs[i] := i + 1;
End For;
BackProp.Attributes := Attrs;
// Perform analysis
Method.Execute;
// Check if results can be unloaded
If TableDS.ReadOnly = False Then
// Unload results into source table
BackProp.FillTarget;
TableDS.Save;
Else
// Display message that unloading is not available
Debug.WriteLine("Data source is read-only. " +
"Saving results to data source is not available." );
End If;
End Sub UserProc
After executing the example missing data is treated in the last column of the DATAMINING_DATA table by means of the back-propagation network. Treatment results are unloaded into the source table.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Ms;
Imports Prognoz.Platform.Interop.Stat;
…
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
TableDS: IDmTableDataSource;
Method: IDmMethod;
BackProp: IDmBackPropagation;
i: Integer;
Attrs: System.Array;
Begin
mb := Params.Metabase;
// Create table data source
TableDS := (New TableDataSource.Create()) As IDmTableDataSource;
// Determine source table
TableDS.Table := mb.ItemByID["DATAMINING_DATA"].Bind();
// Create calculation method
Method := (New DataMiningMethod.Create()) As IDmMethod;
// Specify method type
Method.Kind := DmMethodKind.dmmkBackPropagation;
// Set input data source
Method.InputDataSource := TableDS;
// Set data consumer
Method.OutputDataSource := TableDS;
// Set up calculation method parameters
BackProp := Method.Details As IDmBackPropagation;
// Determine column for analysis
BackProp.Target := TableDS.FieldCount - 1;
// Set factors that influence analysis
Attrs := New Integer[TableDS.FieldCount - 2];
For i := 0 To Attrs.Length - 1 Do
Attrs[i] := i + 1;
End For;
BackProp.Attributes := Attrs;
// Perform analysis
Method.Execute();
// Check if results can be unloaded
If TableDS.@ReadOnly = False Then
// Unload results into source table
BackProp.FillTarget();
TableDS.Save();
Else
// Display message that unloading is not available
System.Diagnostics.Debug.WriteLine("Data source is read-only. " +
"Saving results to data source is not available." );
End If;
End Sub;
See also: