本文整理汇总了C#中IMLDataSet类的典型用法代码示例。如果您正苦于以下问题:C# IMLDataSet类的具体用法?C# IMLDataSet怎么用?C# IMLDataSet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IMLDataSet类属于命名空间,在下文中一共展示了IMLDataSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: JacobianChainRule
public JacobianChainRule(BasicNetwork network, IMLDataSet indexableTraining)
{
BasicMLData data;
BasicMLData data2;
if (0 == 0)
{
goto Label_0055;
}
Label_0009:
this._x61830ac74d65acc3 = new BasicMLDataPair(data, data2);
return;
Label_0055:
this._xb12276308f0fa6d9 = indexableTraining;
if (0 == 0)
{
}
this._x87a7fc6a72741c2e = network;
this._xabb126b401219ba2 = network.Structure.CalculateSize();
this._x530ae94d583e0ea1 = (int) this._xb12276308f0fa6d9.Count;
this._xbdeab667c25bbc32 = EngineArray.AllocateDouble2D(this._x530ae94d583e0ea1, this._xabb126b401219ba2);
this._xc8a462f994253347 = new double[this._x530ae94d583e0ea1];
data = new BasicMLData(this._xb12276308f0fa6d9.InputSize);
data2 = new BasicMLData(this._xb12276308f0fa6d9.IdealSize);
if (-2147483648 != 0)
{
goto Label_0009;
}
goto Label_0055;
}
示例3: QuickPropagation
public QuickPropagation(IContainsFlat network, IMLDataSet training, double learnRate)
: base(network, training)
{
ValidateNetwork.ValidateMethodToData(network, training);
TrainFlatNetworkQPROP kqprop = new TrainFlatNetworkQPROP(network.Flat, this.Training, learnRate);
base.FlatTraining = kqprop;
}
示例4: TrainAdaline
public TrainAdaline(BasicNetwork network, IMLDataSet training, double learningRate)
: base(TrainingImplementationType.Iterative)
{
if (((uint) learningRate) > uint.MaxValue)
{
goto Label_003B;
}
Label_0009:
if (network.LayerCount > 2)
{
goto Label_003B;
}
Label_0012:
this._x87a7fc6a72741c2e = network;
this._x823a2b9c8bf459c5 = training;
this._x9b481c22b6706459 = learningRate;
return;
Label_003B:
throw new NeuralNetworkError("An ADALINE network only has two layers.");
if (0x7fffffff == 0)
{
goto Label_0009;
}
goto Label_0012;
}
示例5: SVMSearchTrain
public SVMSearchTrain(SupportVectorMachine method, IMLDataSet training)
: base(TrainingImplementationType.Iterative)
{
this._x9425fdc2df7bcafc = 0;
this._x2350dfd8c7639ed6 = -5.0;
this._x38c942a9bdfcbac4 = 2.0;
while (true)
{
if (3 != 0)
{
this._xdee5cbd981b6d49e = 15.0;
if (0 == 0)
{
this._xec9380575da42aee = -10.0;
}
}
this._xd522fee165affb59 = 10.0;
this._x441f2c3a7d69c688 = 1.0;
this._x87a7fc6a72741c2e = method;
this.Training = training;
this._x9eeb587621db687c = false;
if (0 == 0)
{
if (0 == 0)
{
this._xab248fa87e95a7df = false;
this._x1e074b5762f8595b = new SVMTrain(this._x87a7fc6a72741c2e, training);
return;
}
return;
}
}
}
示例6: QuickPropagation
/// <summary>
/// Construct a QPROP trainer for flat networks.
/// </summary>
/// <param name="network">The network to train.</param>
/// <param name="training">The training data.</param>
/// <param name="learnRate">The learning rate. 2 is a good suggestion as
/// a learning rate to start with. If it fails to converge,
/// then drop it. Just like backprop, except QPROP can
/// take higher learning rates.</param>
public QuickPropagation(BasicNetwork network,
IMLDataSet training, double learnRate)
: base(network, training)
{
ValidateNetwork.ValidateMethodToData(network, training);
LearningRate = learnRate;
}
示例7: PruneIncremental
public PruneIncremental(IMLDataSet training, INeuralNetworkPattern pattern, int iterations, int weightTries, int numTopResults, IStatusReportable report)
: base(report)
{
goto Label_008E;
Label_0031:
this._x7890c8b3a33b26e2 = new double[numTopResults];
return;
Label_008E:
this._x0b03741e8f17a9f7 = false;
this._xab3ddaff42dd298a = new List<HiddenLayerParams>();
this._x823a2b9c8bf459c5 = training;
if ((((uint) numTopResults) - ((uint) weightTries)) < 0)
{
goto Label_0031;
}
this._x49d5b7c4ad0e0bdd = pattern;
if ((((uint) iterations) - ((uint) iterations)) <= uint.MaxValue)
{
this._xdbf51c857aeb8093 = iterations;
this._x64343a0786fb9a3f = report;
this._xe009ad1bd0a8245a = weightTries;
this._xc5f756e0b4a83af0 = new BasicNetwork[numTopResults];
goto Label_0031;
}
goto Label_008E;
}
示例8: TrainBayesian
/// <summary>
/// Construct a Bayesian trainer. Use K2 to search, and the SimpleEstimator
/// to estimate probability. Init as Naive Bayes
/// </summary>
/// <param name="theNetwork">The network to train.</param>
/// <param name="theData">The data to train.</param>
/// <param name="theMaximumParents">The max number of parents.</param>
public TrainBayesian(BayesianNetwork theNetwork, IMLDataSet theData,
int theMaximumParents)
: this(theNetwork, theData, theMaximumParents,
BayesianInit.InitNaiveBayes, new SearchK2(),
new SimpleEstimator())
{
}
示例9: TrainFlatNetworkBackPropagation
public TrainFlatNetworkBackPropagation(FlatNetwork network, IMLDataSet training, double theLearningRate, double theMomentum)
: base(network, training)
{
this._xef52c16be8e501c9 = theMomentum;
this._x9b481c22b6706459 = theLearningRate;
this._xe4def4d471bbc130 = new double[network.Weights.Length];
}
示例10: ScaledConjugateGradient
/// <summary>
/// Construct a training class.
/// </summary>
///
/// <param name="network">The network to train.</param>
/// <param name="training">The training data.</param>
public ScaledConjugateGradient(IContainsFlat network,
IMLDataSet training) : base(network, training)
{
var rpropFlat = new TrainFlatNetworkSCG(
network.Flat, Training);
FlatTraining = rpropFlat;
}
示例11: Init
/// <inheritdoc />
public override void Init(BasicNetwork theNetwork, IMLDataSet theTraining)
{
base.Init(theNetwork, theTraining);
int weightCount = theNetwork.Structure.Flat.Weights.Length;
_training = theTraining;
_network = theNetwork;
_hessianMatrix = new Matrix(weightCount, weightCount);
_hessian = _hessianMatrix.Data;
// create worker(s)
var determine = new DetermineWorkload(
ThreadCount, _training.Count);
_workers = new ChainRuleWorker[determine.ThreadCount];
int index = 0;
// handle CPU
foreach (IntRange r in determine.CalculateWorkers())
{
_workers[index++] = new ChainRuleWorker((FlatNetwork) _flat.Clone(),
_training.OpenAdditional(), r.Low,
r.High);
}
}
示例12: evaluateNetwork
public static void evaluateNetwork(BasicNetwork network, IMLDataSet training)
{
double total = 0;
int seed = 0;
int completed = 0;
Stopwatch sw = new Stopwatch();
sw.Start();
while (completed < SAMPLE_SIZE)
{
new ConsistentRandomizer(-1, 1, seed).Randomize(network);
int iter = Evaluate(network, training);
if (iter == -1)
{
seed++;
}
else
{
total += iter;
seed++;
completed++;
}
}
sw.Stop();
Console.WriteLine(network.GetActivation(1).GetType().Name + ": time="
+ Format.FormatInteger((int)sw.ElapsedMilliseconds)
+ "ms, Avg Iterations: "
+ Format.FormatInteger((int)(total / SAMPLE_SIZE)));
}
示例13: 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;
}
}
}
示例14: EstimateXi
public override double[][][] EstimateXi(IMLDataSet sequence,
ForwardBackwardCalculator fbc, HiddenMarkovModel hmm)
{
if (sequence.Count <= 1)
{
throw new EncogError(
"Must have more than one observation");
}
double[][][] xi = EngineArray.AllocDouble3D((int)sequence.Count - 1, hmm
.StateCount, hmm.StateCount);
for (int t = 0; t < (sequence.Count - 1); t++)
{
IMLDataPair observation = sequence[t+1];
for (int i = 0; i < hmm.StateCount; i++)
{
for (int j = 0; j < hmm.StateCount; j++)
{
xi[t][i][j] = fbc.AlphaElement(t, i)
* hmm.TransitionProbability[i][j]
* hmm.StateDistributions[j].Probability(
observation) * fbc.BetaElement(t + 1, j);
}
}
}
return xi;
}
示例15: Backpropagation
public Backpropagation(IContainsFlat network, IMLDataSet training, double learnRate, double momentum)
: base(network, training)
{
ValidateNetwork.ValidateMethodToData(network, training);
TrainFlatNetworkBackPropagation propagation = new TrainFlatNetworkBackPropagation(network.Flat, this.Training, learnRate, momentum);
base.FlatTraining = propagation;
}