本文整理汇总了C#中IActivationFunction.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# IActivationFunction.GetType方法的具体用法?C# IActivationFunction.GetType怎么用?C# IActivationFunction.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IActivationFunction
的用法示例。
在下文中一共展示了IActivationFunction.GetType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveActivationFunction
/// <summary>
/// Save the activation function.
/// </summary>
/// <param name="activationFunction">The activation function.</param>
/// <param name="xmlOut">The XML.</param>
public static void SaveActivationFunction(
IActivationFunction activationFunction, WriteXML xmlOut)
{
if (activationFunction != null)
{
xmlOut.BeginTag(BasicLayerPersistor.TAG_ACTIVATION);
xmlOut.BeginTag(activationFunction.GetType().Name);
String[] names = activationFunction.ParamNames;
for (int i = 0; i < names.Length; i++)
{
String str = names[i];
double d = activationFunction.Params[i];
xmlOut.AddAttribute(str, "" + CSVFormat.EG_FORMAT.Format(d, 10));
}
xmlOut.EndTag();
xmlOut.EndTag();
}
}
示例2: MakeActivationFunctionString
private String MakeActivationFunctionString(IActivationFunction act)
{
StringBuilder result = new StringBuilder();
result.Append(act.GetType().Name);
for (int i = 0; i < act.Params.Length; i++)
{
result.Append('|');
result.Append(CSVFormat.EgFormat.Format(act.Params[i],
EncogFramework.DefaultPrecision));
}
return result.ToString();
}
示例3: CanItLearnRulesWith
private void CanItLearnRulesWith(IList<IMLDataPair> inputData, IList<IMLDataPair> verfData, int hiddenLayerCount, int neuronCount, IActivationFunction actFunc, double learnRate, double momentum, int batchSize, int maxEpochs)
{
var model = new DbModel();
var funcName = actFunc.GetType().Name;
var tdCount = inputData.Count();
if (model.TicTacToeResult.Any(r => r.HiddenLayerCount == hiddenLayerCount &&
r.NeuronPerLayercount == neuronCount &&
r.ActivationFunction == funcName &&
r.LearningRate == learnRate &&
r.BatchSize == batchSize &&
r.Momentum == momentum &&
r.Name == Name &&
r.Epochs == maxEpochs &&
r.TrainingDataCount == tdCount))
return;
var nn = CreateNetwork(inputData, hiddenLayerCount, neuronCount, actFunc);
var train = new Backpropagation(nn, new BasicMLDataSet(inputData), learnRate, momentum);
train.BatchSize = batchSize;
int epoch = 1;
do
{
train.Iteration();
epoch++;
} while (epoch < maxEpochs);
int good = verfData.Count(verf => { var output = nn.Compute(verf.Input); return Enumerable.Range(0, 9).All(i => Math.Round(output[i]) == Math.Round(verf.Ideal[i])); });
int bad = VerfDataCount - good;
var result = new TicTacToeResult()
{
HiddenLayerCount = hiddenLayerCount,
NeuronPerLayercount = neuronCount,
ActivationFunction = funcName,
Bad = bad,
Good = good,
TrainingDataCount = tdCount,
Momentum = momentum,
LearningRate = learnRate,
BatchSize = batchSize,
Epochs = epoch,
Error = train.Error,
Name = Name,
};
model.TicTacToeResult.Add(result);
model.SaveChanges();
}
示例4: WriteProperty
/// <summary>
/// Write a property as an activation function.
/// </summary>
///
/// <param name="name">The name of the property.</param>
/// <param name="act">The activation function.</param>
public void WriteProperty(String name,
IActivationFunction act)
{
var result = new StringBuilder();
result.Append(act.GetType().Name);
for (int i = 0; i < act.Params.Length; i++)
{
result.Append('|');
result.Append(CSVFormat.EgFormat.Format(act.Params[i],
EncogFramework.DefaultPrecision));
}
WriteProperty(name, result.ToString());
}
示例5: WriteProperty
public void WriteProperty(string name, IActivationFunction act)
{
StringBuilder builder = new StringBuilder();
builder.Append(act.GetType().Name);
int index = 0;
goto Label_0030;
Label_0011:
builder.Append(CSVFormat.EgFormat.Format(act.Params[index], 10));
index++;
Label_0030:
if (index < act.Params.Length)
{
builder.Append('|');
goto Label_0011;
}
if ((((uint) index) | 3) == 0)
{
goto Label_0011;
}
this.WriteProperty(name, builder.ToString());
}