简体   繁体   English

如何在Encog中评估预测神经网络

[英]How To Evaluate Predictive Neural Network in Encog

We're a creating a neural network for predicting typhoon occurrence using several typhoon parameters as input. 我们正在创建一个神经网络,用于预测使用几个台风参数作为输入的台风发生 So far, we have been able to generate data and train the neural network using Encog 3.2 . 到目前为止,我们已经能够使用Encog 3.2生成数据并训练神经网络。 Right now, we need to evaluate the results of the training. 现在,我们需要评估培训结果。

We're using the ForestCover project (in Encog 3.2 examples) as reference, however the said project's Evaluation code is for a classification neural network. 我们使用ForestCover项目(在Encog 3.2示例中)作为参考,但是该项目的评估代码用于分类神经网络。 Thus, we can't evaluate our neural network following said project's code. 因此,我们无法在所述项目代码之后评估我们的神经网络。

We also checked the PredictMarket project (in Encog 3.2 examples) since it is a predictive neural network. 我们还检查了PredictMarket项目(在Encog 3.2示例中),因为它是一个预测神经网络。 But we're having a difficulty in using the MLData. 但是我们在使用MLData方面遇到了困难。

MLData output = network.compute(inputData);

We want to extract the contents of output and compare it to the contents of the evaluation.csv for neural-network evaluation. 我们要提取输出的内容,并将其比作evaluation.csv神经网络评价的内容。

Is there a way we can extract/convert the output variable into a normalized value which we can then compare to the normalized evaluation.csv? 有没有办法可以将输出变量提取/转换为标准化值,然后我们可以将其与标准化的evaluate.csv进行比较?

or 要么

Is there a way we can modify the ForestCover Evaluate.java file to be able to evaluate a predictive neural network? 有没有办法可以修改ForestCover Evaluate.java文件以便能够评估预测神经网络?

Thank you. 谢谢。

Here is a C# example (Java should be similar) which writes out a .csv file (TestResultsFile) with both the de-normalized expected and actual results so you can compare them with an Excel graph. 这是一个C#示例(Java应该类似),它会写出.csv文件(TestResultsFile),其中包含非规范化的预期和实际结果,因此您可以将它们与Excel图形进行比较。

var evaluationSet = (BasicMLDataSet)EncogUtility.LoadCSV2Memory(Config.EvaluationNormalizedFile.ToString(),
    network.InputCount, network.OutputCount, true, CSVFormat.English,
        false);

var analyst = new EncogAnalyst();
analyst.Load(Config.NormalizationAnalystFile);

// Change this to whatever your output field index is
int outputFieldIndex = 29;

using (var resultsFile = new System.IO.StreamWriter(Config.TestResultsFile.ToString()))
{
    foreach (var item in evaluationSet)
    {
        var normalizedActualOuput = (BasicMLData)network.Compute(item.Input);
        var actualOutput = analyst.Script.Normalize.NormalizedFields[outputFieldIndex].DeNormalize(normalizedActualOuput.Data[0]);

        var idealOutput = analyst.Script.Normalize.NormalizedFields[outputFieldIndex].DeNormalize(item.Ideal[0]);


        var resultLine = String.Format("{0},{1}", idealOutput, actualOutput);
        resultsFile.WriteLine(resultLine);

    }
}

Much of this came from ideas from Abishek Kumar's Pluralsight Course 其中大部分来自Abishek Kumar的Pluralsight Course的想法

If you really want to compare Normalized values, just remove the two calls to "Denormalize". 如果您真的想要比较Normalized值,只需删除两个“Denormalize”调用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM