/// <summary> /// Add only input data, for an unsupervised dataset. /// </summary> /// <param name="data1">The data to be added.</param> public void Add(IMLData data1) { if (!_loading) { throw new IMLDataError(ErrorAdd); } _egb.Write(data1); _egb.Write(1.0); }
/// <summary> /// Add only input data, for an unsupervised dataset. /// </summary> /// <param name="data1">The data to be added.</param> public void Add(IMLData data1) { if (!loading) { throw new IMLDataError(ERROR_ADD); } egb.Write(data1.Data); egb.Write(1.0); }
/// <summary> /// Convert an external file format, such as CSV, to the Encog binary /// training format. /// </summary> /// <param name="binaryFile">The binary file to create.</param> public void External2Binary(String binaryFile) { Status.Report(0, 0, "Importing to binary file: " + binaryFile); var egb = new EncogEGBFile(binaryFile); egb.Create(_codec.InputSize, _codec.IdealSize); var input = new double[_codec.InputSize]; var ideal = new double[_codec.IdealSize]; _codec.PrepareRead(); int currentRecord = 0; int lastUpdate = 0; double significance = 0; while (_codec.Read(input, ideal, ref significance)) { egb.Write(input); egb.Write(ideal); currentRecord++; lastUpdate++; if (lastUpdate >= 10000) { lastUpdate = 0; Status.Report(0, currentRecord, "Importing..."); } egb.Write(significance); } egb.Close(); _codec.Close(); Status.Report(0, 0, "Done importing to binary file: " + binaryFile); }