Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dictionary<double, List<bool?>>[] scores = new Dictionary<double, List<bool?>>[neuralNetworks.Length];
- for (int i = 0; i < scores.Length; i++)
- scores[i] = new Dictionary<double, List<bool?>>();
- /*
- for (int j = 0; j < neuralNetworks.Length; j++)
- {
- trimmedOutputs[i] = GetOutputScore(scores[i], outputs[i]) >= threshould
- ? outputs[i]
- : 0.0;
- }
- */
- private double GetScore(Dictionary<double, List<bool?>> score, double output)
- {
- double outputKey = Math.Round(output, 1);
- if (!score.ContainsKey(outputKey))
- return 1.0;
- bool[] statistics = score[outputKey].Where(stats => stats != null).Cast<bool>().ToArray();
- if (statistics.Length == 0)
- return 1.0;
- return (double)statistics.Where(stats => stats).Count() / statistics.Length;
- }
- private void AddScore(Dictionary<double, List<bool?>> score, double output, double exactOutput)
- {
- double outputKey = Math.Round(output, 1);
- bool isCorrectOutput = output >= 0.0 && exactOutput >= 0.0
- || output <= 0.0 && exactOutput <= 0.0;
- bool handled = false;
- foreach (double key in score.Keys)
- {
- if (key == outputKey)
- {
- score[key].Insert(0, isCorrectOutput);
- handled = true;
- }
- else
- score[key].Insert(0, null);
- if (score[key].Count > 600)
- score[key] = score[key].Take(600).ToList();
- }
- if (!handled)
- {
- score[outputKey] = new List<bool?>();
- score[outputKey].Insert(0, null);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement