本文整理汇总了C#中IMLTrain.Iteration方法的典型用法代码示例。如果您正苦于以下问题:C# IMLTrain.Iteration方法的具体用法?C# IMLTrain.Iteration怎么用?C# IMLTrain.Iteration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMLTrain
的用法示例。
在下文中一共展示了IMLTrain.Iteration方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestTraining
public static void TestTraining(IMLTrain train, double requiredImprove)
{
train.Iteration();
double error1 = train.Error;
for (int i = 0; i < 10; i++)
train.Iteration();
double error2 = train.Error;
double improve = (error1 - error2) / error1;
Assert.IsTrue(improve >= requiredImprove,"Improve rate too low for " + train.GetType().Name +
",Improve=" + improve + ",Needed=" + requiredImprove);
}
示例2: TrainToError
/// <summary>
/// Train to a specific error, using the specified training method, send the
/// output to the console.
/// </summary>
///
/// <param name="train">The training method.</param>
/// <param name="error">The desired error level.</param>
public static void TrainToError(IMLTrain train, double error)
{
int epoch = 1;
Console.Out.WriteLine(@"Beginning training...");
do
{
train.Iteration();
Console.Out.WriteLine(@"Iteration #" + Format.FormatInteger(epoch)
+ @" Error:" + Format.FormatPercent(train.Error)
+ @" Target Error: " + Format.FormatPercent(error));
epoch++;
} while ((train.Error > error) && !train.TrainingDone);
train.FinishTraining();
}
示例3: TrainConsole
/// <summary>
/// Train the network, using the specified training algorithm, and send the
/// output to the console.
/// </summary>
/// <param name="train">The training method to use.</param>
/// <param name="network">The network to train.</param>
/// <param name="trainingSet">The training set.</param>
/// <param name="minutes">The number of minutes to train for.</param>
public static void TrainConsole(IMLTrain train,
BasicNetwork network, IMLDataSet trainingSet,
int minutes)
{
int epoch = 1;
long remaining;
Console.WriteLine(@"Beginning training...");
long start = Environment.TickCount;
do
{
train.Iteration();
long current = Environment.TickCount;
long elapsed = (current - start)/1000;
remaining = minutes - elapsed/60;
Console.WriteLine(@"Iteration #" + Format.FormatInteger(epoch)
+ @" Error:" + Format.FormatPercent(train.Error)
+ @" elapsed time = " + Format.FormatTimeSpan((int) elapsed)
+ @" time left = "
+ Format.FormatTimeSpan((int) remaining*60));
epoch++;
} while (remaining > 0 && !train.TrainingDone);
train.FinishTraining();
}
示例4: PerformTraining
/// <summary>
/// Perform the training.
/// </summary>
/// <param name="train">The training method.</param>
/// <param name="method">The ML method.</param>
/// <param name="trainingSet">The training set.</param>
private void PerformTraining(IMLTrain train, IMLMethod method,
IMLDataSet trainingSet)
{
ValidateNetwork.ValidateMethodToData(method, trainingSet);
double targetError = Prop.GetPropertyDouble(
ScriptProperties.MlTrainTargetError);
Analyst.ReportTrainingBegin();
int maxIteration = Analyst.MaxIteration;
if (train.ImplementationType == TrainingImplementationType.OnePass)
{
train.Iteration();
Analyst.ReportTraining(train);
}
else
{
do
{
train.Iteration();
Analyst.ReportTraining(train);
} while ((train.Error > targetError)
&& !Analyst.ShouldStopCommand()
&& !train.TrainingDone
&& ((maxIteration == -1) || (train.IterationNumber < maxIteration)));
}
train.FinishTraining();
Analyst.ReportTrainingEnd();
}
示例5: x0d87de1eb44df41c
private void x0d87de1eb44df41c(IMLTrain xd87f6a9c53c2ed9f, IMLMethod x1306445c04667cc7, IMLDataSet x1c9e132f434262d8)
{
int maxIteration;
ValidateNetwork.ValidateMethodToData(x1306445c04667cc7, x1c9e132f434262d8);
double propertyDouble = base.Prop.GetPropertyDouble("ML:TRAIN_targetError");
base.Analyst.ReportTrainingBegin();
if ((((uint) maxIteration) & 0) == 0)
{
if (2 == 0)
{
goto Label_0038;
}
maxIteration = base.Analyst.MaxIteration;
if (0xff != 0)
{
goto Label_0038;
}
}
Label_001B:
if (!xd87f6a9c53c2ed9f.TrainingDone && ((maxIteration == -1) || (xd87f6a9c53c2ed9f.IterationNumber < maxIteration)))
{
goto Label_0038;
}
Label_0023:
xd87f6a9c53c2ed9f.FinishTraining();
base.Analyst.ReportTrainingEnd();
return;
Label_0038:
xd87f6a9c53c2ed9f.Iteration();
base.Analyst.ReportTraining(xd87f6a9c53c2ed9f);
if ((xd87f6a9c53c2ed9f.Error <= propertyDouble) || base.Analyst.ShouldStopCommand())
{
goto Label_0023;
}
goto Label_001B;
}
示例6: TrainToError
public static void TrainToError(IMLTrain train, IMLDataSet trainingSet, double error)
{
string[] strArray;
int i = 1;
if ((((uint) i) - ((uint) error)) <= uint.MaxValue)
{
goto Label_00AF;
}
goto Label_0050;
Label_0037:
if ((train.Error > error) && !train.TrainingDone)
{
goto Label_00B9;
}
train.FinishTraining();
if ((((uint) i) | 3) != 0)
{
return;
}
goto Label_00AF;
Label_0050:
strArray[1] = Format.FormatInteger(i);
do
{
if (0 != 0)
{
goto Label_0037;
}
strArray[2] = " Error:";
}
while ((((uint) error) + ((uint) i)) > uint.MaxValue);
strArray[3] = Format.FormatPercent(train.Error);
strArray[4] = " Target Error: ";
strArray[5] = Format.FormatPercent(error);
Console.WriteLine(string.Concat(strArray));
i++;
goto Label_0037;
Label_00AF:
Console.WriteLine("Beginning training...");
Label_00B9:
train.Iteration();
strArray = new string[6];
strArray[0] = "Iteration #";
goto Label_0050;
}
示例7: TrainConsole
public static void TrainConsole(IMLTrain train, BasicNetwork network, IMLDataSet trainingSet, int minutes)
{
long num2;
long num4;
long num5;
int i = 1;
Console.WriteLine("Beginning training...");
long tickCount = Environment.TickCount;
goto Label_018E;
Label_0025:
train.FinishTraining();
if ((((uint) num5) & 0) != 0)
{
goto Label_018E;
}
return;
Label_003A:
if (((((uint) minutes) - ((uint) tickCount)) >= 0) && (0 == 0))
{
goto Label_0025;
}
Label_0052:
if (num2 > 0L)
{
if (!train.TrainingDone)
{
goto Label_018E;
}
goto Label_003A;
}
goto Label_0025;
Label_018E:
train.Iteration();
Label_0194:
num4 = Environment.TickCount;
num5 = (num4 - tickCount) / 0x3e8L;
num2 = minutes - (num5 / 60L);
while (true)
{
string[] strArray = new string[8];
if ((((uint) num5) | 4) == 0)
{
goto Label_0194;
}
strArray[0] = "Iteration #";
strArray[1] = Format.FormatInteger(i);
strArray[2] = " Error:";
strArray[3] = Format.FormatPercent(train.Error);
strArray[4] = " elapsed time = ";
if ((((uint) i) + ((uint) i)) >= 0)
{
if ((((uint) num4) & 0) == 0)
{
if ((((uint) minutes) + ((uint) minutes)) > uint.MaxValue)
{
goto Label_0025;
}
if (((uint) num5) > uint.MaxValue)
{
goto Label_003A;
}
strArray[5] = Format.FormatTimeSpan((int) num5);
strArray[6] = " time left = ";
}
strArray[7] = Format.FormatTimeSpan(((int) num2) * 60);
Console.WriteLine(string.Concat(strArray));
i++;
goto Label_0052;
}
}
}