/// <summary> /// Initializes a new instance of the <see cref="Teacher" /> class. /// </summary> /// <param name="traingingCollection">The trainging collection.</param> /// <param name="minDelta">The minimum delta.</param> /// <param name="maxEra">The maximum era.</param> /// <param name="maxIterationCount">The maximum iteration count.</param> public Teacher(TrainingCollection traingingCollection, double minDelta, int maxEra, int maxIterationCount) { TrainingCollection = traingingCollection; MinDelta = minDelta; MaxEra = maxEra; MaxIterationCount = maxIterationCount; }
/// <summary> /// Changes the training data. /// </summary> /// <param name="traingingCollection">The trainging collection.</param> public void ChangeTrainingData(TrainingCollection traingingCollection) { TrainingCollection = traingingCollection; }
/// <summary> /// Loads the standard data from file. /// </summary> /// <returns>Collection with datas</returns> public static TrainingCollection LoadStandardData() { const int HOW_MANY_NUMBERS_TO_LEARN_FROM_FILE = 1000; TrainingCollection collection = new TrainingCollection(HOW_MANY_NUMBERS_TO_LEARN_FROM_FILE); GiveItemsFromFile itemReturner = new GiveItemsFromFile(); sbyte[,] expectedResultFromFile = itemReturner.GiveArrayOfExpectedResults(); sbyte[,] trainDataFromFile = itemReturner.GiveArrayOfTrainData(); const int NUMBER_OF_RESULTS = 10; const int SIZE_OF_IMAGE = 28 * 28; for (int numberCounter = 0; numberCounter < HOW_MANY_NUMBERS_TO_LEARN_FROM_FILE; numberCounter++) { double[] expectedResult = new double[NUMBER_OF_RESULTS]; int whatNumber = -1; for (int i = 0; i < NUMBER_OF_RESULTS; i++) { expectedResult[i] = expectedResultFromFile[numberCounter, i]; if (expectedResult[i] == 1) whatNumber = i; } double[] trainData = new double[SIZE_OF_IMAGE]; for (int i = 0; i < SIZE_OF_IMAGE; i++) { trainData[i] = trainDataFromFile[numberCounter, i]; } TrainingSet trainingSet = new TrainingSet(); trainingSet.Input = trainData; trainingSet.Response = expectedResult; trainingSet.Value = whatNumber; collection.Values.Add(trainingSet); } return collection; }