Esempio n. 1
0
        public Network(HyperParameters hyperParameters, params int[] nodeCounts)
        {
            mParameters = hyperParameters;
            switch (mParameters.CostFunctionName)
            {
            case "QuadraticCost":
                mCostFunction = new QuadraticCost();
                break;

            case "CrossEntropyCost":
                mCostFunction = new CrossEntropyCost();
                break;

            default:
                throw new ArgumentException(string.Format("Invalid cost function name:'{0}'", mParameters.CostFunctionName));
            }
            if (nodeCounts == null || nodeCounts.Length == 0)
            {
                return;
            }
            mLayers = new Layer[nodeCounts.Length];
            for (int i = 0; i < mLayers.Length; i++)
            {
                mLayers[i] = new Layer(nodeCounts[i], i == 0 ? 0 : nodeCounts[i - 1]);
            }
        }
Esempio n. 2
0
 public void Train(HyperParameters parameters, List <(Vector <double> Image, Vector <double> Label)> data, Func <Vector <double>, Vector <double>, bool> areEqual, List <(Vector <double> Image, Vector <double> Label)> testData = null)