本文整理汇总了C#中IMLDataSet.GetEnumerator方法的典型用法代码示例。如果您正苦于以下问题:C# IMLDataSet.GetEnumerator方法的具体用法?C# IMLDataSet.GetEnumerator怎么用?C# IMLDataSet.GetEnumerator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMLDataSet
的用法示例。
在下文中一共展示了IMLDataSet.GetEnumerator方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CalculateClassificationError
public static double CalculateClassificationError(IMLClassification method, IMLDataSet data)
{
int num = 0;
int num2 = 0;
using (IEnumerator<IMLDataPair> enumerator = data.GetEnumerator())
{
int num3;
int num4;
goto Label_001B;
Label_000E:
if (num4 != num3)
{
goto Label_0017;
}
Label_0013:
num2++;
Label_0017:
num++;
Label_001B:
if (!enumerator.MoveNext())
{
if (((uint) num2) > uint.MaxValue)
{
goto Label_0013;
}
}
else
{
IMLDataPair current = enumerator.Current;
num3 = (int) current.Ideal[0];
num4 = method.Classify(current.Input);
goto Label_000E;
}
}
return (((double) (num - num2)) / ((double) num));
}
示例2: Probability
public double Probability(IMLDataSet seq, int[] states)
{
if ((seq.Count != states.Length) || (seq.Count < 1))
{
new EncogError("Invalid count");
}
double probability = GetPi(states[0]);
IEnumerator<IMLDataPair> oseqIterator = seq.GetEnumerator();
for (int i = 0; i < (states.Length - 1); i++)
{
oseqIterator.MoveNext();
probability *= _stateDistributions[i].Probability(
oseqIterator.Current)
*_transitionProbability[states[i]][states[i + 1]];
}
return probability
*_stateDistributions[states.Length - 1].Probability(
seq[states.Length - 1]);
}
示例3: ComputeAlpha
/// <summary>
/// Compute alpha.
/// </summary>
/// <param name="hmm">The HMM.</param>
/// <param name="seq">The sequence.</param>
protected void ComputeAlpha(HiddenMarkovModel hmm,
IMLDataSet seq)
{
Alpha = EngineArray.AllocateDouble2D((int) seq.Count, hmm.StateCount);
for (int i = 0; i < hmm.StateCount; i++)
{
ComputeAlphaInit(hmm, seq[0], i);
}
Scale(_ctFactors, Alpha, 0);
IEnumerator<IMLDataPair> seqIterator = seq.GetEnumerator();
if (seqIterator.MoveNext())
{
for (int t = 1; t < seq.Count; t++)
{
seqIterator.MoveNext();
IMLDataPair observation = seqIterator.Current;
for (int i = 0; i < hmm.StateCount; i++)
{
ComputeAlphaStep(hmm, observation, t, i);
}
Scale(_ctFactors, Alpha, t);
}
}
}
示例4: SaveCSV
public static void SaveCSV(FileInfo targetFile, CSVFormat format, IMLDataSet set)
{
try
{
StreamWriter writer = new StreamWriter(targetFile.ToString());
using (IEnumerator<IMLDataPair> enumerator = set.GetEnumerator())
{
IMLDataPair pair;
StringBuilder builder;
int num;
double num2;
int num3;
double num4;
goto Label_002E;
Label_0016:
if ((((uint) num2) + ((uint) num2)) >= 0)
{
}
Label_002E:
if (enumerator.MoveNext())
{
goto Label_00F5;
}
goto Label_012F;
Label_003F:
writer.WriteLine(builder);
goto Label_0117;
Label_004B:
BasicFile.AppendSeparator(builder, format);
builder.Append(format.Format(num4, 10));
num3++;
Label_0069:
if (num3 >= pair.Ideal.Count)
{
if (3 != 0)
{
goto Label_003F;
}
}
else
{
num4 = pair.Ideal[num3];
goto Label_004B;
}
Label_0094:
BasicFile.AppendSeparator(builder, format);
builder.Append(format.Format(num2, 10));
num++;
Label_00B0:
if (num < pair.Input.Count)
{
goto Label_0107;
}
num3 = 0;
goto Label_0069;
Label_00CF:
if (15 == 0)
{
goto Label_0069;
}
if ((((uint) num3) | 0xff) != 0)
{
goto Label_0094;
}
Label_00F5:
pair = enumerator.Current;
builder = new StringBuilder();
num = 0;
goto Label_00B0;
Label_0107:
num2 = pair.Input[num];
goto Label_00CF;
Label_0117:
if (-2147483648 != 0)
{
goto Label_0016;
}
}
Label_012F:
writer.Close();
}
catch (IOException exception)
{
throw new EncogError(exception);
}
}
示例5: Evaluate
public static void Evaluate(IMLRegression network, IMLDataSet training)
{
using (IEnumerator<IMLDataPair> enumerator = training.GetEnumerator())
{
IMLDataPair pair;
IMLData data;
string[] strArray;
Label_0009:
if (!enumerator.MoveNext())
{
if (2 == 0)
{
goto Label_005B;
}
if (0 == 0)
{
return;
}
}
goto Label_0095;
Label_0026:
strArray[4] = ", Ideal=";
Label_002E:
strArray[5] = x8d742ff2b6748ce6(pair.Ideal);
Console.WriteLine(string.Concat(strArray));
if (0 == 0)
{
goto Label_00A3;
}
goto Label_0095;
Label_004C:
strArray = new string[6];
strArray[0] = "Input=";
Label_005B:
strArray[1] = x8d742ff2b6748ce6(pair.Input);
strArray[2] = ", Actual=";
strArray[3] = x8d742ff2b6748ce6(data);
goto Label_0026;
Label_007C:
if (0 != 0)
{
goto Label_002E;
}
data = network.Compute(pair.Input);
if (1 != 0)
{
goto Label_004C;
}
goto Label_0026;
Label_0095:
pair = enumerator.Current;
goto Label_007C;
Label_00A3:
if (0xff != 0)
{
goto Label_0009;
}
}
}
示例6: Encode
public static svm_problem Encode(IMLDataSet training, int outputIndex)
{
svm_problem _problem3;
try
{
svm_problem _problem;
int num;
int num2;
svm_problem _problem2 = new svm_problem();
goto Label_0158;
Label_000C:
if (1 == 0)
{
return _problem3;
}
if ((((uint) num2) + ((uint) num2)) < 0)
{
goto Label_018B;
}
Label_0031:
if (num >= _problem.l)
{
num2 = 0;
using (IEnumerator<IMLDataPair> enumerator = training.GetEnumerator())
{
IMLDataPair pair;
IMLData input;
IMLData data2;
int num3;
svm_node _node;
goto Label_0083;
Label_0049:
num3++;
Label_004F:
if (num3 < input.Count)
{
goto Label_00CA;
}
_problem.y[num2] = data2[outputIndex];
if (((uint) outputIndex) < 0)
{
return _problem;
}
num2++;
Label_0083:
if (enumerator.MoveNext())
{
goto Label_0100;
}
return _problem;
Label_008E:
data2 = pair.Ideal;
if ((((uint) num3) + ((uint) num2)) >= 0)
{
_problem.x[num2] = new svm_node[input.Count];
num3 = 0;
goto Label_004F;
}
Label_00CA:
_node = new svm_node();
_node.index = num3 + 1;
_node.value_Renamed = input[num3];
_problem.x[num2][num3] = _node;
goto Label_0049;
Label_0100:
pair = enumerator.Current;
input = pair.Input;
goto Label_008E;
}
}
_problem.x[num] = new svm_node[training.InputSize];
num++;
if ((((uint) outputIndex) & 0) == 0)
{
goto Label_000C;
}
return _problem3;
Label_0158:
_problem2.l = (int) training.Count;
_problem = _problem2;
_problem.y = new double[_problem.l];
_problem.x = new svm_node[_problem.l][];
Label_018B:
num = 0;
goto Label_0031;
}
catch (OutOfMemoryException)
{
throw new EncogError("SVM Model - Out of Memory");
}
return _problem3;
}