예제 #1
0
        /// <summary>
        /// Open any datasets that were used by the input layer.
        /// </summary>
        private void OpenDataSet()
        {
            // clear out any data sets already there
            this.readDataSet.Clear();
            this.dataSetFieldMap.Clear();
            this.dataSetIteratorMap.Clear();

            // only add each iterator once
            IDictionary <INeuralDataSet, NeuralDataFieldHolder> uniqueSets = new Dictionary <INeuralDataSet, NeuralDataFieldHolder>();

            // find the unique files
            foreach (IInputField field in this.inputFields)
            {
                if (field is InputFieldNeuralDataSet)
                {
                    InputFieldNeuralDataSet dataSetField = (InputFieldNeuralDataSet)field;
                    INeuralDataSet          dataSet      = dataSetField.NeuralDataSet;
                    if (!uniqueSets.ContainsKey(dataSet))
                    {
                        IEnumerator <INeuralDataPair> iterator = dataSet
                                                                 .GetEnumerator();
                        NeuralDataFieldHolder holder = new NeuralDataFieldHolder(
                            iterator, dataSetField);
                        uniqueSets[dataSet] = holder;
                        this.readDataSet.Add(iterator);
                    }

                    NeuralDataFieldHolder holder2 = uniqueSets[dataSet];

                    this.dataSetFieldMap[dataSetField] = holder2;
                    this.dataSetIteratorMap[holder2.GetEnumerator()] = holder2;
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Obtain the length of the training data. 
        /// </summary>
        /// <param name="training">The training date to check.</param>
        /// <returns>The length of the training data.</returns>
        private static long ObtainTrainingLength(INeuralDataSet training)
        {
            if (training is IIndexable)
            {
                return ((IIndexable)training).Count;
            }

            long result = 0;
            IEnumerator<INeuralDataPair> itr = training.GetEnumerator();

            while (itr.MoveNext())
                result++;

            return result;
        }
예제 #3
0
        /// <summary>
        /// Obtain the length of the training data.
        /// </summary>
        /// <param name="training">The training date to check.</param>
        /// <returns>The length of the training data.</returns>
        private static long ObtainTrainingLength(INeuralDataSet training)
        {
            if (training is IIndexable)
            {
                return(((IIndexable)training).Count);
            }

            long result = 0;
            IEnumerator <INeuralDataPair> itr = training.GetEnumerator();

            while (itr.MoveNext())
            {
                result++;
            }

            return(result);
        }