Пример #1
0
        /// <param name="checkSuccess">Funcion takes 'expected', 'actual' returns bool wether or not actual can be considerd a success</param>
        public static ValidationResult Validate(Network network, IEnumerable<InputExpectedResult> inputResults, Func<double[], double[], bool> checkSuccess)
        {
            ValidationResult totalResult = null;
            foreach(var cur in inputResults) {
                double[] actual = network.GetInputResult(cur.Input);

                double sse = SumSquaredError(cur.Output, actual);
                bool success = checkSuccess(cur.Output, actual);

                var res = new ValidationResult(sse, success);

                totalResult += res;
            }

            return totalResult;
        }
Пример #2
0
        public static ValidationResult operator +(ValidationResult v1, ValidationResult v2)
        {
            var retVal = new ValidationResult();

            if(v1 != null) {
                retVal.SSEs.AddRange(v1.SSEs);
                retVal.Successes += v1.Successes;
            }
            if(v2 != null) {
                retVal.SSEs.AddRange(v2.SSEs);
                retVal.Successes += v2.Successes;
            }

            return retVal;
        }