本文整理汇总了C#中IMLData类的典型用法代码示例。如果您正苦于以下问题:C# IMLData类的具体用法?C# IMLData怎么用?C# IMLData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IMLData类属于命名空间,在下文中一共展示了IMLData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DetermineTreeType
public int DetermineTreeType(OutputEquilateral eqField, IMLData output)
{
int result;
if (eqField != null)
{
result = eqField.Equilateral.Decode(output.Data);
}
else
{
double maxOutput = Double.NegativeInfinity;
result = -1;
for (int i = 0; i < output.Count; i++)
{
if (output[i] > maxOutput)
{
maxOutput = output[i];
result = i;
}
}
}
return result;
}
示例2: Compute
public IMLData Compute(IMLData input)
{
int num;
Matrix col;
Matrix matrix2;
IMLData data = new BasicMLData(this.OutputCount);
if (0 == 0)
{
goto Label_003F;
}
Label_000F:
matrix2 = Matrix.CreateRowMatrix(input.Data);
if (3 == 0)
{
goto Label_003F;
}
data[num] = MatrixMath.DotProduct(matrix2, col);
num++;
Label_0034:
if (num < this.OutputCount)
{
col = this._weights.GetCol(num);
goto Label_000F;
}
return data;
Label_003F:
num = 0;
goto Label_0034;
}
示例3: x3342cd5bc15ae07b
private void x3342cd5bc15ae07b(int x7079b5ea66d0bae1, IMLData xcdaeea7afaf570ff)
{
for (int i = 0; i < this._x87a7fc6a72741c2e.InputCount; i++)
{
this._x87a7fc6a72741c2e.Weights[i, x7079b5ea66d0bae1] = xcdaeea7afaf570ff[i];
}
}
示例4: 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;
}
示例5: CopyInputPattern
/// <summary>
/// Copy the specified input pattern to the weight matrix. This causes an
/// output neuron to learn this pattern "exactly". This is useful when a
/// winner is to be forced.
/// </summary>
///
/// <param name="outputNeuron">The output neuron to set.</param>
/// <param name="input">The input pattern to copy.</param>
private void CopyInputPattern(int outputNeuron, IMLData input)
{
for (int inputNeuron = 0; inputNeuron < _network.InputCount; inputNeuron++)
{
_network.Weights[inputNeuron, outputNeuron] = input[inputNeuron];
}
}
示例6: Classify
/// <summary>
/// Classify the input into one of the output clusters.
/// </summary>
/// <param name="input">The input.</param>
/// <returns>The cluster it was clasified into.</returns>
public int Classify(IMLData input)
{
if (input.Count > InputCount)
{
throw new NeuralNetworkError(
"Can't classify SOM with input size of " + InputCount
+ " with input data of count " + input.Count);
}
double[][] m = _weights.Data;
double minDist = Double.PositiveInfinity;
int result = -1;
for (int i = 0; i < OutputCount; i++)
{
double dist = EngineArray.EuclideanDistance(input, m[i]);
if (dist < minDist)
{
minDist = dist;
result = i;
}
}
return result;
}
示例7: AddPattern
/// <summary>
/// Train the neural network for the specified pattern. The neural network
/// can be trained for more than one pattern. To do this simply call the
/// train method more than once.
/// </summary>
///
/// <param name="pattern">The pattern to train for.</param>
public void AddPattern(IMLData pattern)
{
if (pattern.Count != NeuronCount)
{
throw new NeuralNetworkError("Network with " + NeuronCount
+ " neurons, cannot learn a pattern of size "
+ pattern.Count);
}
// Create a row matrix from the input, convert boolean to bipolar
Matrix m2 = Matrix.CreateRowMatrix(pattern.Data);
// Transpose the matrix and multiply by the original input matrix
Matrix m1 = MatrixMath.Transpose(m2);
Matrix m3 = MatrixMath.Multiply(m1, m2);
// matrix 3 should be square by now, so create an identity
// matrix of the same size.
Matrix identity = MatrixMath.Identity(m3.Rows);
// subtract the identity matrix
Matrix m4 = MatrixMath.Subtract(m3, identity);
// now add the calculated matrix, for this pattern, to the
// existing weight matrix.
ConvertHopfieldMatrix(m4);
}
示例8: CalculateError
/// <inheritdoc/>
public void CalculateError(IMLData ideal, double[] actual, double[] error)
{
for (int i = 0; i < actual.Length; i++)
{
error[i] = ideal[i] - actual[i];
}
}
示例9: CalculateBMU
/// <summary>
/// Calculate the best matching unit (BMU). This is the output neuron that
/// has the lowest Euclidean distance to the input vector.
/// </summary>
///
/// <param name="input">The input vector.</param>
/// <returns>The output neuron number that is the BMU.</returns>
public int CalculateBMU(IMLData input)
{
int result = 0;
// Track the lowest distance so far.
double lowestDistance = Double.MaxValue;
for (int i = 0; i < _som.OutputCount; i++)
{
double distance = CalculateEuclideanDistance(
_som.Weights, input, i);
// Track the lowest distance, this is the BMU.
if (distance < lowestDistance)
{
lowestDistance = distance;
result = i;
}
}
// Track the worst distance, this is the error for the entire network.
if (lowestDistance > _worstDistance)
{
_worstDistance = lowestDistance;
}
return result;
}
示例10: Add
public override void Add(IMLData data)
{
if (!(data is ImageMLData))
{
throw new NeuralNetworkError("This data set only supports ImageNeuralData or Image objects.");
}
base.Add(data);
}
示例11: BasicMLDataPair
public BasicMLDataPair(IMLData input, IMLData ideal, IMLData calced, IMLData error)
{
this._significance = 1.0;
this._input = input;
this._ideal = ideal;
this._calced = calced;
this._error = error;
}
示例12: LoadedRow
/// <summary>
/// Construct a loaded row from an IMLData.
/// </summary>
/// <param name="format">The format to store the numbers in.</param>
/// <param name="data">The data to use.</param>
/// <param name="extra">The extra positions to allocate.</param>
public LoadedRow(CSVFormat format, IMLData data, int extra)
{
int count = data.Count;
_data = new String[count + extra];
for (int i = 0; i < count; i++)
{
_data[i] = format.Format(data[i], 5);
}
}
示例13: DenormalizeColumn
/// <inheritdoc />
public String DenormalizeColumn(ColumnDefinition colDef, IMLData data,
int dataColumn)
{
double value = data[dataColumn];
double result = ((colDef.Low - colDef.High)*value
- _normalizedHigh*colDef.Low + colDef.High
*_normalizedLow)
/(_normalizedLow - _normalizedHigh);
// typically caused by a number that should not have been normalized
// (i.e. normalization or actual range is infinitely small.
if (Double.IsNaN(result))
{
return "" + (((_normalizedHigh - _normalizedLow)/2) + _normalizedLow);
}
return "" + result;
}
示例14: DenormalizeColumn
/// <inheritdoc />
public String DenormalizeColumn(ColumnDefinition colDef, IMLData data,
int dataColumn)
{
double bestValue = Double.NegativeInfinity;
int bestIndex = 0;
for (int i = 0; i < data.Count; i++)
{
double d = data[dataColumn + i];
if (d > bestValue)
{
bestValue = d;
bestIndex = i;
}
}
return colDef.Classes[bestIndex];
}
示例15: BasicMLComplexData
/// <summary>
/// Construct a new BasicMLData object from an existing one. This makes a
/// copy of an array. If MLData is not complex, then only reals will be
/// created.
/// </summary>
/// <param name="d">The object to be copied.</param>
public BasicMLComplexData(IMLData d)
{
if (d is IMLComplexData)
{
var c = (IMLComplexData) d;
for (int i = 0; i < d.Count; i++)
{
_data[i] = new ComplexNumber(c.GetComplexData(i));
}
}
else
{
for (int i = 0; i < d.Count; i++)
{
_data[i] = new ComplexNumber(d[i], 0);
}
}
}