GetRecord() public method

Read an individual record.
public GetRecord ( long index, IMLDataPair pair ) : void
index long The zero-based index. Specify 0 for the first record, 1 for /// the second, and so on.
pair IMLDataPair The data to read.
return void
        /// <summary>
        /// Move to the next element.
        /// </summary>
        /// <returns>True if there are more elements to read.</returns>
        public bool MoveNext()
        {
            try
            {
                if (_current >= _data.Count)
                {
                    return(false);
                }

                _currentRecord = BasicMLDataPair.CreatePair(_data
                                                            .InputSize, _data.IdealSize);
                _data.GetRecord(_current++, _currentRecord);
                return(true);
            }
            catch (EndOfStreamException)
            {
                return(false);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Evaluate disk.
        /// </summary>
        private void EvalBinary()
        {
            FileInfo file = FileUtil.CombinePath( new FileInfo(Path.GetTempPath()), "temp.egb" );

            BasicMLDataSet training = RandomTrainingFactory.Generate(
                1000, 10000, 10, 10, -1, 1);

            // create the binary file

            if (file.Exists)
            {
                file.Delete();
            }

            var training2 = new BufferedMLDataSet(file.ToString());
            training2.Load(training);

            const long stop = (10*Evaluate.Milis);
            int record = 0;

            IMLDataPair pair = BasicMLDataPair.CreatePair(10, 10);

            var watch = new Stopwatch();
            watch.Start();

            int iterations = 0;
            while (watch.ElapsedMilliseconds < stop)
            {
                iterations++;
                training2.GetRecord(record++, pair);
                if (record >= training2.Count)
                    record = 0;
            }

            training2.Close();

            iterations /= 100000;

            _report.Report(Steps, Step3,
                          "Disk(binary) dataset, result: "
                          + Format.FormatInteger(iterations));

            if (file.Exists)
            {
                file.Delete();
            }
            _binaryScore = iterations;
        }