本文整理汇总了C#中Encog.ML.Data.Specific.BiPolarMLData.SetBoolean方法的典型用法代码示例。如果您正苦于以下问题:C# BiPolarMLData.SetBoolean方法的具体用法?C# BiPolarMLData.SetBoolean怎么用?C# BiPolarMLData.SetBoolean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Encog.ML.Data.Specific.BiPolarMLData
的用法示例。
在下文中一共展示了BiPolarMLData.SetBoolean方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Compute
/// <summary>
/// Note: for Hopfield networks, you will usually want to call the "run"
/// method to compute the output.
/// This method can be used to copy the input data to the current state. A
/// single iteration is then run, and the new current state is returned.
/// </summary>
///
/// <param name="input">The input pattern.</param>
/// <returns>The new current state.</returns>
public override sealed IMLData Compute(IMLData input)
{
var result = new BiPolarMLData(input.Count);
EngineArray.ArrayCopy(input.Data, CurrentState.Data);
Run();
for (int i = 0; i < CurrentState.Count; i++)
{
result.SetBoolean(i,
BiPolarUtil.Double2bipolar(CurrentState[i]));
}
EngineArray.ArrayCopy(CurrentState.Data, result.Data);
return result;
}
示例2: ConvertPattern
public BiPolarMLData ConvertPattern(String[][] data, int index)
{
int resultIndex = 0;
var result = new BiPolarMLData(WIDTH*HEIGHT);
for (int row = 0; row < HEIGHT; row++)
{
for (int col = 0; col < WIDTH; col++)
{
char ch = data[index][row][col];
result.SetBoolean(resultIndex++, ch == 'O');
}
}
return result;
}
示例3: GetOutput
/// <summary>
/// Copy the output from the network to another object.
/// </summary>
///
/// <param name="output">The target object for the output from the network.</param>
private void GetOutput(BiPolarMLData output)
{
for (int i = 0; i < _f2Count; i++)
{
output.SetBoolean(i, _outputF2.GetBoolean(i));
}
}
示例4: Classify
/// <summary>
/// Classify the input data to a class number.
/// </summary>
///
/// <param name="input">The input data.</param>
/// <returns>The class that the data belongs to.</returns>
public int Classify(IMLData input)
{
var input2 = new BiPolarMLData(_f1Count);
var output = new BiPolarMLData(_f2Count);
if (input.Count != input2.Count)
{
throw new NeuralNetworkError("Input array size does not match.");
}
for (int i = 0; i < input2.Count; i++)
{
input2.SetBoolean(i, input[i] > 0);
}
Compute(input2, output);
return HasWinner ? Winner : -1;
}
示例5: Classify
public int Classify(IMLData input)
{
int num;
BiPolarMLData data = new BiPolarMLData(this._f1Count);
BiPolarMLData output = new BiPolarMLData(this._f2Count);
if (input.Count != data.Count)
{
throw new NeuralNetworkError("Input array size does not match.");
}
goto Label_0022;
Label_0013:
return -1;
Label_0022:
num = 0;
while (num < data.Count)
{
data.SetBoolean(num, input[num] > 0.0);
num++;
}
this.Compute(data, output);
if (!this.HasWinner)
{
goto Label_0013;
}
return this.Winner;
if (-1 == 0)
{
goto Label_0013;
}
goto Label_0022;
}
示例6: StringToBipolar
public BiPolarMLData StringToBipolar(String str)
{
var result = new BiPolarMLData(str.Length*BITS_PER_CHAR);
int currentIndex = 0;
for (int i = 0; i < str.Length; i++)
{
char ch = char.ToUpper(str[i]);
int idx = ch - FIRST_CHAR;
int place = 1;
for (int j = 0; j < BITS_PER_CHAR; j++)
{
bool value = (idx & place) > 0;
result.SetBoolean(currentIndex++, value);
place *= 2;
}
}
return result;
}
示例7: Compute
public override sealed IMLData Compute(IMLData input)
{
int num;
BiPolarMLData data = new BiPolarMLData(input.Count);
if (0 == 0)
{
if (((uint) num) <= uint.MaxValue)
{
if (3 == 0)
{
return data;
}
goto Label_0053;
}
}
else
{
goto Label_0053;
}
Label_003B:
EngineArray.ArrayCopy(base.CurrentState.Data, data.Data);
return data;
Label_0053:
EngineArray.ArrayCopy(input.Data, base.CurrentState.Data);
this.Run();
for (num = 0; num < base.CurrentState.Count; num++)
{
data.SetBoolean(num, BiPolarUtil.Double2bipolar(base.CurrentState[num]));
}
goto Label_003B;
}