本文整理汇总了C#中IMLMethod类的典型用法代码示例。如果您正苦于以下问题:C# IMLMethod类的具体用法?C# IMLMethod怎么用?C# IMLMethod使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IMLMethod类属于命名空间,在下文中一共展示了IMLMethod类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Create
/// <summary>
/// Create a SVM trainer.
/// </summary>
///
/// <param name="method">The method to use.</param>
/// <param name="training">The training data to use.</param>
/// <param name="argsStr">The arguments to use.</param>
/// <returns>The newly created trainer.</returns>
public IMLTrain Create(IMLMethod method,
IMLDataSet training, String argsStr)
{
if (!(method is SupportVectorMachine))
{
throw new EncogError(
"SVM Train training cannot be used on a method of type: "
+ method.GetType().FullName);
}
double defaultGamma = 1.0d/((SupportVectorMachine) method).InputCount;
double defaultC = 1.0d;
IDictionary<String, String> args = ArchitectureParse.ParseParams(argsStr);
var holder = new ParamsHolder(args);
double gamma = holder.GetDouble(MLTrainFactory.PropertyGamma,
false, defaultGamma);
double c = holder.GetDouble(MLTrainFactory.PropertyC, false,
defaultC);
var result = new SVMTrain((SupportVectorMachine) method, training);
result.Gamma = gamma;
result.C = c;
return result;
}
开发者ID:johannsutherland,项目名称:encog-dotnet-core,代码行数:33,代码来源:SVMFactory.cs
示例2: Create
/// <summary>
/// Create an annealing trainer.
/// </summary>
/// <param name="method">The method to use.</param>
/// <param name="training">The training data to use.</param>
/// <param name="argsStr">The arguments to use.</param>
/// <returns>The newly created trainer.</returns>
public IMLTrain Create(IMLMethod method,
IMLDataSet training, String argsStr)
{
if (!(method is BasicNetwork))
{
throw new TrainingError(
"Invalid method type, requires BasicNetwork");
}
ICalculateScore score = new TrainingSetScore(training);
IDictionary<String, String> args = ArchitectureParse.ParseParams(argsStr);
var holder = new ParamsHolder(args);
int populationSize = holder.GetInt(
MLTrainFactory.PropertyPopulationSize, false, 5000);
IMLTrain train = new MLMethodGeneticAlgorithm( () => {
IMLMethod result = (IMLMethod) ObjectCloner.DeepCopy(method);
((IMLResettable)result).Reset();
return result;
}, score, populationSize);
return train;
}
开发者ID:johannsutherland,项目名称:encog-dotnet-core,代码行数:34,代码来源:GeneticFactory.cs
示例3: Create
/// <summary>
/// Create an annealing trainer.
/// </summary>
///
/// <param name="method">The method to use.</param>
/// <param name="training">The training data to use.</param>
/// <param name="argsStr">The arguments to use.</param>
/// <returns>The newly created trainer.</returns>
public IMLTrain Create(IMLMethod method,
IMLDataSet training, String argsStr)
{
if (!(method is BasicNetwork))
{
throw new TrainingError(
"Invalid method type, requires BasicNetwork");
}
ICalculateScore score = new TrainingSetScore(training);
IDictionary<String, String> args = ArchitectureParse.ParseParams(argsStr);
var holder = new ParamsHolder(args);
int populationSize = holder.GetInt(
MLTrainFactory.PropertyPopulationSize, false, 5000);
double mutation = holder.GetDouble(
MLTrainFactory.PropertyMutation, false, 0.1d);
double mate = holder.GetDouble(MLTrainFactory.PropertyMate,
false, 0.25d);
IMLTrain train = new NeuralGeneticAlgorithm((BasicNetwork) method,
new RangeRandomizer(-1, 1), score, populationSize, mutation,
mate);
return train;
}
开发者ID:neismit,项目名称:emds,代码行数:34,代码来源:GeneticFactory.cs
示例4: Randomize
public override sealed void Randomize(IMLMethod method)
{
if (!(method is BasicNetwork))
{
throw new EncogError("Ngyyen Widrow only works on BasicNetwork.");
}
BasicNetwork network = (BasicNetwork) method;
Label_00B3:
new RangeRandomizer(base.Min, base.Max).Randomize(network);
int num = 0;
int l = 1;
while (true)
{
if (l >= (network.LayerCount - 1))
{
if ((num >= 1) && ((((uint) num) + ((uint) l)) <= uint.MaxValue))
{
this._x43f451310e815b76 = network.InputCount;
this._xd7d571ecee49d1e4 = 0.7 * Math.Pow((double) num, 1.0 / ((double) network.InputCount));
base.Randomize(network);
return;
}
return;
}
num += network.GetLayerTotalNeuronCount(l);
if (((uint) l) < 0)
{
goto Label_00B3;
}
l++;
}
}
开发者ID:neismit,项目名称:emds,代码行数:32,代码来源:NguyenWidrowRandomizer.cs
示例5: CrossTraining
/// <summary>
/// Construct a cross trainer.
/// </summary>
///
/// <param name="network">The network.</param>
/// <param name="training">The training data.</param>
protected CrossTraining(IMLMethod network, FoldedDataSet training)
: base(TrainingImplementationType.Iterative)
{
_network = network;
Training = training;
_folded = training;
}
开发者ID:CreativelyMe,项目名称:encog-dotnet-core,代码行数:13,代码来源:CrossTraining.cs
示例6: Randomize
/// <summary>
/// The Nguyen-Widrow initialization algorithm is the following :
///
/// 1. Initialize all weight of hidden layers with (ranged) random values
/// 2. For each hidden layer
/// 2.1 calculate beta value, 0.7/// Nth(#neurons of input layer) root of
/// #neurons of current layer
/// 2.2 for each synapse
/// 2.1.1 for each weight
/// 2.1.2 Adjust weight by dividing by norm of weight for neuron and
/// multiplying by beta value
/// </summary>
/// <param name="method">The network to randomize.</param>
public override sealed void Randomize(IMLMethod method)
{
if (!(method is BasicNetwork))
{
throw new EncogError("Ngyyen Widrow only works on BasicNetwork.");
}
var network = (BasicNetwork) method;
new RangeRandomizer(Min, Max).Randomize(network);
int hiddenNeurons = 0;
for (int i = 1; i < network.LayerCount - 1; i++)
{
hiddenNeurons += network.GetLayerTotalNeuronCount(i);
}
// can't really do much, use regular randomization
if (hiddenNeurons < 1)
{
return;
}
_inputCount = network.InputCount;
_beta = 0.7d*Math.Pow(hiddenNeurons, 1.0d/network.InputCount);
base.Randomize(network);
}
开发者ID:OperatorOverload,项目名称:encog-cs,代码行数:42,代码来源:NguyenWidrowRandomizer.cs
示例7: Encode
public IGenome Encode(IMLMethod phenotype)
{
var rbfNet = (RBFNetwork) phenotype;
var result = new DoubleArrayGenome(Size);
Array.Copy(rbfNet.LongTermMemory, 0, result.Data, 0, _size);
return result;
}
开发者ID:Raghavendra1509,项目名称:aifh,代码行数:7,代码来源:RBFNetworkGenomeCODEC.cs
示例8: Create
public IMLTrain Create(IMLMethod method, IMLDataSet training, string argsStr)
{
if (!(method is SupportVectorMachine))
{
throw new EncogError("SVM Train training cannot be used on a method of type: " + method.GetType().FullName);
}
double defaultValue = 1.0 / ((double) ((SupportVectorMachine) method).InputCount);
while (true)
{
double num4;
SVMTrain train;
double num2 = 1.0;
IDictionary<string, string> theParams = ArchitectureParse.ParseParams(argsStr);
ParamsHolder holder = new ParamsHolder(theParams);
double num3 = holder.GetDouble("GAMMA", false, defaultValue);
do
{
num4 = holder.GetDouble("C", false, num2);
train = new SVMTrain((SupportVectorMachine) method, training) {
Gamma = num3
};
}
while (((uint) defaultValue) > uint.MaxValue);
if ((((uint) num2) + ((uint) num3)) <= uint.MaxValue)
{
train.C = num4;
return train;
}
}
}
开发者ID:neismit,项目名称:emds,代码行数:30,代码来源:SVMFactory.cs
示例9: CalculateScore
public double CalculateScore(IMLMethod network)
{
var pilot = new NeuralRobot((BasicNetwork)network, false, RobotContol.SourceLocation, RobotContol.DestLocation);
int score = pilot.ScorePilot();
//RobotContol.Scores.Add(score);
return score;
}
开发者ID:tmassey,项目名称:mtos,代码行数:7,代码来源:RobotScore.cs
示例10: CrossTraining
protected CrossTraining(IMLMethod network, FoldedDataSet training)
: base(TrainingImplementationType.Iterative)
{
this._x87a7fc6a72741c2e = network;
this.Training = training;
this._x3952df2eab48841c = training;
}
开发者ID:neismit,项目名称:emds,代码行数:7,代码来源:CrossTraining.cs
示例11: Create
/// <summary>
/// Create an annealing trainer.
/// </summary>
///
/// <param name="method">The method to use.</param>
/// <param name="training">The training data to use.</param>
/// <param name="argsStr">The arguments to use.</param>
/// <returns>The newly created trainer.</returns>
public IMLTrain Create(IMLMethod method,
IMLDataSet training, String argsStr)
{
if (!(method is BasicNetwork))
{
throw new TrainingError(
"Invalid method type, requires BasicNetwork");
}
ICalculateScore score = new TrainingSetScore(training);
IDictionary<String, String> args = ArchitectureParse.ParseParams(argsStr);
var holder = new ParamsHolder(args);
double startTemp = holder.GetDouble(
MLTrainFactory.PropertyTemperatureStart, false, 10);
double stopTemp = holder.GetDouble(
MLTrainFactory.PropertyTemperatureStop, false, 2);
int cycles = holder.GetInt(MLTrainFactory.Cycles, false, 100);
IMLTrain train = new NeuralSimulatedAnnealing(
(BasicNetwork) method, score, startTemp, stopTemp, cycles);
return train;
}
开发者ID:OperatorOverload,项目名称:encog-cs,代码行数:33,代码来源:AnnealFactory.cs
示例12: Create
public IMLTrain Create(IMLMethod method, IMLDataSet training, string args)
{
if (!(method is RBFNetwork))
{
throw new EncogError("RBF-SVD training cannot be used on a method of type: " + method.GetType().FullName);
}
return new SVDTraining((RBFNetwork) method, training);
}
开发者ID:neismit,项目名称:emds,代码行数:8,代码来源:RBFSVDFactory.cs
示例13: NetworkSize
public static int NetworkSize(IMLMethod network)
{
if (!(network is IMLEncodable))
{
throw new NeuralNetworkError("This machine learning method cannot be encoded:" + network.GetType().FullName);
}
return ((IMLEncodable) network).EncodedArrayLength();
}
开发者ID:neismit,项目名称:emds,代码行数:8,代码来源:NetworkCODEC.cs
示例14: ArrayToNetwork
public static void ArrayToNetwork(double[] array, IMLMethod network)
{
if (!(network is IMLEncodable))
{
throw new NeuralNetworkError("This machine learning method cannot be encoded:" + network.GetType().FullName);
}
((IMLEncodable) network).DecodeFromArray(array);
}
开发者ID:neismit,项目名称:emds,代码行数:8,代码来源:NetworkCODEC.cs
示例15: CalculateScore
/// <inheritdoc />
public double CalculateScore(IMLMethod genome)
{
var prg = (EncogProgram) genome;
var pop = (PrgPopulation) prg.Population;
IMLData inputData = new BasicMLData(pop.Context.DefinedVariables.Count);
prg.Compute(inputData);
return 0;
}
开发者ID:benw408701,项目名称:MLHCTransactionPredictor,代码行数:9,代码来源:ZeroEvalScoreFunction.cs
示例16: CalculateScore
public override double CalculateScore(IMLMethod network)
{
gameManager.Player2 = new NeuralColorPlayer(gameManager.Rules as VanDerWaerdenGameRules) { Network = network as BasicNetwork };
var scores = new int[NGames];
for (int i = 0; i < NGames; i++)
scores[i] = gameManager.PlayGame();
return CalculateScore(scores);
}
开发者ID:JGrzybowski,项目名称:VanDerWaerdenGame,代码行数:8,代码来源:PlayersTrainer.cs
示例17: Create
public IMLTrain Create(IMLMethod method, IMLDataSet training, string args)
{
if (!(method is BasicNetwork))
{
throw new EncogError("SCG training cannot be used on a method of type: " + method.GetType().FullName);
}
return new ScaledConjugateGradient((BasicNetwork) method, training);
}
开发者ID:neismit,项目名称:emds,代码行数:8,代码来源:SCGFactory.cs
示例18: Create
public IMLTrain Create(IMLMethod method, IMLDataSet training, string argsStr)
{
if (!(method is SOMNetwork))
{
throw new EncogError("Cluster SOM training cannot be used on a method of type: " + method.GetType().FullName);
}
return new SOMClusterCopyTraining((SOMNetwork) method, training);
}
开发者ID:neismit,项目名称:emds,代码行数:8,代码来源:ClusterSOMFactory.cs
示例19: Create
/// <summary>
/// Create an NEAT GA trainer.
/// </summary>
/// <param name="method">The method to use.</param>
/// <param name="training">The training data to use.</param>
/// <param name="argsStr">The arguments to use.</param>
/// <returns>The newly created trainer.</returns>
public IMLTrain Create(IMLMethod method,
IMLDataSet training, String argsStr)
{
ICalculateScore score = new TrainingSetScore(training);
TrainEA train = NEATUtil.ConstructNEATTrainer((NEATPopulation)method, score);
return train;
}
开发者ID:CreativelyMe,项目名称:encog-dotnet-core,代码行数:15,代码来源:NEATGAFactory.cs
示例20: Create
public IMLTrain Create(IMLMethod method, IMLDataSet training, string args)
{
if (!(method is BasicPNN))
{
throw new EncogError("PNN training cannot be used on a method of type: " + method.GetType().FullName);
}
return new TrainBasicPNN((BasicPNN) method, training);
}
开发者ID:neismit,项目名称:emds,代码行数:8,代码来源:PNNTrainFactory.cs
注:本文中的IMLMethod类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论