本文整理汇总了C#中Encog.Persist.EncogWriteHelper.AddSubSection方法的典型用法代码示例。如果您正苦于以下问题:C# EncogWriteHelper.AddSubSection方法的具体用法?C# EncogWriteHelper.AddSubSection怎么用?C# EncogWriteHelper.AddSubSection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Encog.Persist.EncogWriteHelper
的用法示例。
在下文中一共展示了EncogWriteHelper.AddSubSection方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Save
public void Save(Stream os, object obj)
{
SupportVectorMachine machine;
EncogWriteHelper helper = new EncogWriteHelper(os);
if (8 != 0)
{
}
Label_026A:
machine = (SupportVectorMachine) obj;
helper.AddSection("SVM");
if (0 == 0)
{
while (true)
{
helper.AddSubSection("PARAMS");
helper.AddProperties(machine.Properties);
helper.AddSubSection("SVM-PARAM");
helper.WriteProperty("inputCount", machine.InputCount);
helper.WriteProperty("C", machine.Params.C);
if (0 == 0)
{
helper.WriteProperty("cacheSize", machine.Params.cache_size);
if (-2 == 0)
{
goto Label_026A;
}
helper.WriteProperty("coef0", machine.Params.coef0);
helper.WriteProperty("degree", machine.Params.degree);
helper.WriteProperty("eps", machine.Params.eps);
helper.WriteProperty("gamma", machine.Params.gamma);
helper.WriteProperty("kernelType", machine.Params.kernel_type);
}
helper.WriteProperty("nrWeight", machine.Params.nr_weight);
if (1 != 0)
{
helper.WriteProperty("nu", machine.Params.nu);
helper.WriteProperty("p", machine.Params.p);
helper.WriteProperty("probability", machine.Params.probability);
helper.WriteProperty("shrinking", machine.Params.shrinking);
helper.WriteProperty("svmType", machine.Params.svm_type);
helper.WriteProperty("weight", machine.Params.weight);
helper.WriteProperty("weightLabel", machine.Params.weight_label);
break;
}
}
}
Label_0092:
while (machine.Model != null)
{
helper.AddSubSection("SVM-MODEL");
try
{
StreamWriter writer;
ASCIIEncoding encoding;
MemoryStream stream = new MemoryStream();
if (1 != 0)
{
goto Label_005F;
}
Label_003E:
helper.Write(encoding.GetString(stream.ToArray()));
writer.Close();
stream.Close();
break;
Label_005F:
writer = new StreamWriter(stream);
if (0 == 0)
{
svm.svm_save_model(writer, machine.Model);
}
encoding = new ASCIIEncoding();
goto Label_003E;
}
catch (IOException exception)
{
throw new PersistError(exception);
}
}
while (true)
{
helper.Flush();
if (-2147483648 != 0)
{
return;
}
if (0 != 0)
{
goto Label_0092;
}
}
}
示例2: Save
public void Save(Stream os, object obj)
{
CPNNetwork network;
EncogWriteHelper helper = new EncogWriteHelper(os);
if (0 == 0)
{
network = (CPNNetwork) obj;
goto Label_00A8;
}
Label_000D:
helper.WriteProperty("inputToInstar", network.WeightsInputToInstar);
helper.WriteProperty("instarToInput", network.WeightsInstarToOutstar);
helper.WriteProperty("winnerCount", network.WinnerCount);
if (-1 != 0)
{
helper.Flush();
return;
}
Label_0052:
helper.AddProperties(network.Properties);
if (0 == 0)
{
helper.AddSubSection("NETWORK");
helper.WriteProperty("inputCount", network.InputCount);
helper.WriteProperty("instar", network.InstarCount);
helper.WriteProperty("outputCount", network.OutputCount);
goto Label_00C5;
}
Label_00A8:
helper.AddSection("CPN");
helper.AddSubSection("PARAMS");
if (15 != 0)
{
goto Label_0052;
}
Label_00C5:
if (0 == 0)
{
goto Label_000D;
}
}
示例3: Save
/// <inheritdoc/>
public void Save(Stream os, Object obj)
{
var xout = new EncogWriteHelper(os);
var svm2 = (SupportVectorMachine) obj;
xout.AddSection("SVM");
xout.AddSubSection("PARAMS");
xout.AddProperties(svm2.Properties);
xout.AddSubSection("SVM-PARAM");
xout.WriteProperty(PersistConst.InputCount, svm2.InputCount);
xout.WriteProperty(ParamC, svm2.Params.C);
xout.WriteProperty(ParamCacheSize,
svm2.Params.cache_size);
xout.WriteProperty(ParamCoef0, svm2.Params.coef0);
xout.WriteProperty(ParamDegree, svm2.Params.degree);
xout.WriteProperty(ParamEps, svm2.Params.eps);
xout.WriteProperty(ParamGamma, svm2.Params.gamma);
xout.WriteProperty(ParamKernelType,
svm2.Params.kernel_type);
xout.WriteProperty(ParamNumWeight,
svm2.Params.nr_weight);
xout.WriteProperty(ParamNu, svm2.Params.nu);
xout.WriteProperty(ParamP, svm2.Params.p);
xout.WriteProperty(ParamProbability,
svm2.Params.probability);
xout.WriteProperty(ParamShrinking,
svm2.Params.shrinking);
/* xout.WriteProperty(PersistSVM.PARAM_START_ITERATIONS,
svm2.Params.statIterations); */
xout.WriteProperty(ParamSVMType, svm2.Params.svm_type);
xout.WriteProperty(ParamWeight, svm2.Params.weight);
xout.WriteProperty(ParamWeightLabel,
svm2.Params.weight_label);
if (svm2.Model != null)
{
xout.AddSubSection("SVM-MODEL");
try
{
var ba = new MemoryStream();
var w = new StreamWriter(ba);
svm.svm_save_model(w, svm2.Model);
var enc = new ASCIIEncoding();
xout.Write(enc.GetString(ba.ToArray()));
w.Close();
ba.Close();
}
catch (IOException ex)
{
throw new PersistError(ex);
}
}
xout.Flush();
}
示例4: SaveSegregate
/// <summary>
/// Save segregate info.
/// </summary>
///
/// <param name="xout">The output file.</param>
private void SaveSegregate(EncogWriteHelper xout)
{
SaveSubSection(xout, "SEGREGATE", "CONFIG");
xout.AddSubSection("FILES");
xout.AddColumn("file");
xout.AddColumn("percent");
xout.WriteLine();
foreach (AnalystSegregateTarget target in _script.Segregate.SegregateTargets)
{
xout.AddColumn(target.File);
xout.AddColumn(target.Percent);
xout.WriteLine();
}
}
示例5: SaveTasks
/// <summary>
/// Save the tasks.
/// </summary>
///
/// <param name="xout">The output file.</param>
private void SaveTasks(EncogWriteHelper xout)
{
xout.AddSection("TASKS");
var list = _script.Tasks.Keys.ToList();
list.Sort();
foreach (String key in list)
{
AnalystTask task = _script.GetTask(key);
xout.AddSubSection(task.Name);
foreach (String line in task.Lines)
{
xout.AddLine(line);
}
}
}
示例6: Save
public virtual void Save(Stream os, object obj)
{
EncogWriteHelper xout = new EncogWriteHelper(os);
NEATNetwork network = (NEATNetwork) obj;
xout.AddSection("NEAT");
xout.AddSubSection("PARAMS");
xout.AddProperties(network.Properties);
xout.AddSubSection("NETWORK");
if (8 != 0)
{
}
xout.WriteProperty("inputCount", network.InputCount);
xout.WriteProperty("outputCount", network.OutputCount);
xout.WriteProperty("activationFunction", network.ActivationFunction);
xout.WriteProperty("outAct", network.OutputActivationFunction);
xout.WriteProperty("depth", network.NetworkDepth);
Label_0087:
xout.WriteProperty("snapshot", network.Snapshot);
xout.AddSubSection("NEURONS");
using (IEnumerator<NEATNeuron> enumerator = network.Neurons.GetEnumerator())
{
NEATNeuron current;
goto Label_00E3;
Label_00B2:
if (8 == 0)
{
goto Label_00F6;
}
xout.AddColumn(current.ActivationResponse);
xout.AddColumn(current.SplitX);
xout.AddColumn(current.SplitY);
xout.WriteLine();
Label_00E3:
if (!enumerator.MoveNext())
{
goto Label_0124;
}
current = enumerator.Current;
Label_00F6:
xout.AddColumn((int) current.NeuronID);
xout.AddColumn(PersistNEATPopulation.NeuronTypeToString(current.NeuronType));
goto Label_00B2;
}
Label_0124:
xout.AddSubSection("LINKS");
foreach (NEATNeuron neuron2 in network.Neurons)
{
foreach (NEATLink link in neuron2.OutputboundLinks)
{
WriteLink(xout, link);
}
}
xout.Flush();
if (-1 != 0)
{
return;
}
goto Label_0087;
}
示例7: SaveData
/// <summary>
/// Save the data fields.
/// </summary>
///
/// <param name="xout">The output file.</param>
private void SaveData(EncogWriteHelper xout)
{
SaveSubSection(xout, "DATA", "CONFIG");
xout.AddSubSection("STATS");
xout.AddColumn("name");
xout.AddColumn("isclass");
xout.AddColumn("iscomplete");
xout.AddColumn("isint");
xout.AddColumn("isreal");
xout.AddColumn("amax");
xout.AddColumn("amin");
xout.AddColumn("mean");
xout.AddColumn("sdev");
xout.WriteLine();
foreach (DataField field in _script.Fields)
{
xout.AddColumn(field.Name);
xout.AddColumn(field.Class);
xout.AddColumn(field.Complete);
xout.AddColumn(field.Integer);
xout.AddColumn(field.Real);
xout.AddColumn(field.Max);
xout.AddColumn(field.Min);
xout.AddColumn(field.Mean);
xout.AddColumn(field.StandardDeviation);
xout.WriteLine();
}
xout.Flush();
xout.AddSubSection("CLASSES");
xout.AddColumn("field");
xout.AddColumn("code");
xout.AddColumn("name");
xout.WriteLine();
foreach (DataField field in _script.Fields)
{
if (field.Class)
{
foreach (AnalystClassItem col in field.ClassMembers)
{
xout.AddColumn(field.Name);
xout.AddColumn(col.Code);
xout.AddColumn(col.Name);
xout.AddColumn(col.Count);
xout.WriteLine();
}
}
}
}
示例8: Save
/**
* {@inheritDoc}
*/
public void Save(Stream os, Object obj)
{
var writer = new EncogWriteHelper(os);
var som = (SOMNetwork) obj;
writer.AddSection("SOM");
writer.AddSubSection("PARAMS");
writer.AddProperties(som.Properties);
writer.AddSubSection("NETWORK");
writer.WriteProperty(PersistConst.Weights, som.Weights);
writer.WriteProperty(PersistConst.InputCount, som.InputCount);
writer.WriteProperty(PersistConst.OutputCount, som.OutputCount);
writer.Flush();
}
示例9: Save
public void Save(Stream os, object obj)
{
EncogWriteHelper helper = new EncogWriteHelper(os);
BoltzmannMachine machine = (BoltzmannMachine) obj;
helper.AddSection("BOLTZMANN");
Label_00C6:
helper.AddSubSection("PARAMS");
Label_00D1:
helper.AddProperties(machine.Properties);
if (0 != 0)
{
return;
}
Label_0094:
helper.AddSubSection("NETWORK");
helper.WriteProperty("weights", machine.Weights);
helper.WriteProperty("output", machine.CurrentState.Data);
if (0 == 0)
{
helper.WriteProperty("neurons", machine.NeuronCount);
helper.WriteProperty("thresholds", machine.Threshold);
helper.WriteProperty("annealCycles", machine.AnnealCycles);
helper.WriteProperty("runCycles", machine.RunCycles);
helper.WriteProperty("temperature", machine.Temperature);
helper.Flush();
if (0 != 0)
{
goto Label_00D1;
}
if (0 == 0)
{
return;
}
goto Label_0094;
}
goto Label_00C6;
}
示例10: Save
/// <inheritdoc/>
public void Save(Stream os, Object obj)
{
var xout = new EncogWriteHelper(os);
var art1 = (ART1) obj;
xout.AddSection("ART1");
xout.AddSubSection("PARAMS");
xout.AddProperties(art1.Properties);
xout.AddSubSection("NETWORK");
xout.WriteProperty(BasicART.PropertyA1, art1.A1);
xout.WriteProperty(BasicART.PropertyB1, art1.B1);
xout.WriteProperty(BasicART.PropertyC1, art1.C1);
xout.WriteProperty(BasicART.PropertyD1, art1.D1);
xout.WriteProperty(PersistConst.PropertyF1Count, art1.F1Count);
xout.WriteProperty(PersistConst.PropertyF2Count, art1.F2Count);
xout.WriteProperty(BasicART.PropertyNoWinner, art1.NoWinner);
xout.WriteProperty(BasicART.PropertyL, art1.L);
xout.WriteProperty(BasicART.PropertyVigilance, art1.Vigilance);
xout.WriteProperty(PersistConst.PropertyWeightsF1F2,
art1.WeightsF1ToF2);
xout.WriteProperty(PersistConst.PropertyWeightsF2F1,
art1.WeightsF2ToF1);
xout.Flush();
}
示例11: Save
/// <summary>
/// Save the object.
/// </summary>
/// <param name="os">The output stream.</param>
/// <param name="obj">The object to save.</param>
public virtual void Save(Stream os, Object obj)
{
var xout = new EncogWriteHelper(os);
var neat = (NEATNetwork) obj;
xout.AddSection("NEAT");
xout.AddSubSection("PARAMS");
xout.AddProperties(neat.Properties);
xout.AddSubSection("NETWORK");
xout.WriteProperty(PersistConst.InputCount, neat.InputCount);
xout.WriteProperty(PersistConst.OutputCount, neat.OutputCount);
xout.WriteProperty(PersistConst.ActivationFunction,
neat.ActivationFunction);
xout.WriteProperty(NEATPopulation.PropertyOutputActivation,
neat.OutputActivationFunction);
xout.WriteProperty(PersistConst.Depth, neat.NetworkDepth);
xout.WriteProperty(PersistConst.Snapshot, neat.Snapshot);
xout.AddSubSection("NEURONS");
foreach (NEATNeuron neatNeuron in neat.Neurons)
{
xout.AddColumn((int)neatNeuron.NeuronID);
xout.AddColumn(PersistNEATPopulation.NeuronTypeToString(neatNeuron.NeuronType));
xout.AddColumn(neatNeuron.ActivationResponse);
xout.AddColumn(neatNeuron.SplitX);
xout.AddColumn(neatNeuron.SplitY);
xout.WriteLine();
}
xout.AddSubSection("LINKS");
foreach (NEATNeuron neatNeuron in neat.Neurons)
{
foreach (NEATLink link in neatNeuron.OutputboundLinks)
{
WriteLink(xout, link);
}
}
xout.Flush();
}
示例12: Save
public void Save(Stream os, object obj)
{
HopfieldNetwork network;
EncogWriteHelper helper = new EncogWriteHelper(os);
goto Label_00A2;
Label_0028:
helper.WriteProperty("neurons", network.NeuronCount);
helper.Flush();
if (4 != 0)
{
return;
}
if (4 != 0)
{
goto Label_00A2;
}
goto Label_0064;
Label_004C:
helper.WriteProperty("output", network.CurrentState.Data);
goto Label_0028;
Label_0064:
helper.AddSection("HOPFIELD");
helper.AddSubSection("PARAMS");
if (2 == 0)
{
goto Label_004C;
}
helper.AddProperties(network.Properties);
helper.AddSubSection("NETWORK");
if (0 == 0)
{
helper.WriteProperty("weights", network.Weights);
goto Label_004C;
}
goto Label_0028;
Label_00A2:
network = (HopfieldNetwork) obj;
goto Label_0064;
}
示例13: Save
public virtual void Save(Stream os, object obj)
{
NEATPopulation population;
EncogWriteHelper helper = new EncogWriteHelper(os);
if (0 == 0)
{
population = (NEATPopulation) obj;
if (-2147483648 != 0)
{
goto Label_05B6;
}
}
Label_000D:
helper.Flush();
return;
Label_0018:
using (IEnumerator<ISpecies> enumerator5 = population.Species.GetEnumerator())
{
ISpecies species;
goto Label_0049;
Label_0027:
helper.AddColumn(species.Leader.GenomeID);
if (-2 == 0)
{
goto Label_000D;
}
helper.WriteLine();
Label_0049:
if (enumerator5.MoveNext())
{
goto Label_00A2;
}
goto Label_000D;
Label_0054:
helper.AddColumn(species.BestScore);
helper.AddColumn(species.GensNoImprovement);
helper.AddColumn(species.NumToSpawn);
helper.AddColumn(species.SpawnsRequired);
goto Label_0027;
Label_008C:
helper.AddColumn(species.Age);
if (0x7fffffff != 0)
{
goto Label_0054;
}
goto Label_000D;
Label_00A2:
species = enumerator5.Current;
helper.AddColumn(species.SpeciesID);
goto Label_008C;
}
Label_00D2:
if (population.Innovations != null)
{
goto Label_03B2;
}
Label_00DD:
helper.AddSubSection("GENOMES");
using (IEnumerator<IGenome> enumerator2 = population.Genomes.GetEnumerator())
{
IGenome genome;
NEATGenome genome2;
goto Label_01E0;
Label_00FA:
using (List<IGene>.Enumerator enumerator4 = genome2.Links.Genes.GetEnumerator())
{
IGene gene3;
NEATLinkGene gene4;
goto Label_0129;
Label_010F:
if (2 == 0)
{
goto Label_016F;
}
helper.AddColumn(gene4.InnovationId);
helper.WriteLine();
Label_0129:
if (enumerator4.MoveNext())
{
goto Label_01C4;
}
goto Label_01E0;
Label_013A:
helper.AddColumn(gene4.Weight);
goto Label_010F;
Label_014C:
helper.AddColumn(gene4.ToNeuronID);
if (4 != 0)
{
goto Label_013A;
}
goto Label_018C;
Label_0162:
helper.AddColumn(gene4.Enabled);
Label_016F:
helper.AddColumn(gene4.Recurrent);
helper.AddColumn(gene4.FromNeuronID);
if (0 == 0)
{
goto Label_014C;
//.........这里部分代码省略.........
示例14: Save
/// <summary>
///
/// </summary>
///
public void Save(Stream os, Object obj)
{
var xout = new EncogWriteHelper(os);
var bam = (BAMNetwork) obj;
xout.AddSection("BAM");
xout.AddSubSection("PARAMS");
xout.AddProperties(bam.Properties);
xout.AddSubSection("NETWORK");
xout.WriteProperty(PersistConst.PropertyF1Count, bam.F1Count);
xout.WriteProperty(PersistConst.PropertyF2Count, bam.F2Count);
xout.WriteProperty(PersistConst.PropertyWeightsF1F2,
bam.WeightsF1ToF2);
xout.WriteProperty(PersistConst.PropertyWeightsF2F1,
bam.WeightsF2ToF1);
xout.Flush();
}
示例15: Save
/// <summary>
///
/// </summary>
///
public void Save(Stream os, Object obj)
{
var xout = new EncogWriteHelper(os);
var pnn = (BasicPNN) obj;
xout.AddSection("PNN");
xout.AddSubSection("PARAMS");
xout.AddProperties(pnn.Properties);
xout.AddSubSection("NETWORK");
xout.WriteProperty(PersistConst.Error, pnn.Error);
xout.WriteProperty(PersistConst.InputCount, pnn.InputCount);
xout.WriteProperty(PersistConst.Kernel,
KernelToString(pnn.Kernel));
xout.WriteProperty(PersistConst.OutputCount, pnn.OutputCount);
xout.WriteProperty(PropertyOutputMode,
OutputModeToString(pnn.OutputMode));
xout.WriteProperty(PersistConst.Sigma, pnn.Sigma);
xout.AddSubSection("SAMPLES");
if (pnn.Samples != null)
{
foreach (IMLDataPair pair in pnn.Samples)
{
for (int i = 0; i < pair.Input.Count; i++)
{
xout.AddColumn(pair.Input[i]);
}
for (int i = 0; i < pair.Ideal.Count; i++)
{
xout.AddColumn(pair.Ideal[i]);
}
xout.WriteLine();
}
}
xout.Flush();
}