• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# CSV.CSVFormat类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Encog.Util.CSV.CSVFormat的典型用法代码示例。如果您正苦于以下问题:C# CSVFormat类的具体用法?C# CSVFormat怎么用?C# CSVFormat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CSVFormat类属于Encog.Util.CSV命名空间,在下文中一共展示了CSVFormat类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: CSVDataSource

 /// <summary>
 ///     Construct a CSV source from a filename. Allows a delimiter character to
 ///     be specified.
 /// </summary>
 /// <param name="file">The filename.</param>
 /// <param name="headers">The headers.</param>
 /// <param name="format">The format.</param>
 public CSVDataSource(string file, bool headers,
     CSVFormat format)
 {
     _file = file;
     _headers = headers;
     _format = format;
 }
开发者ID:johannsutherland,项目名称:encog-dotnet-core,代码行数:14,代码来源:CSVDataSource.cs


示例2: Analyze

 public void Analyze(EncogAnalyst theAnalyst, FileInfo inputFile, bool headers, CSVFormat format)
 {
     base.InputFilename = inputFile;
     if ((((uint) headers) & 0) != 0)
     {
         goto Label_0063;
     }
     Label_005C:
     base.ExpectInputHeaders = headers;
     Label_0063:
     base.InputFormat = format;
     base.Analyzed = true;
     this._x554f16462d8d4675 = theAnalyst;
     base.PerformBasicCounts();
     if (((uint) headers) >= 0)
     {
         this._x146688677da5adf5 = base.InputHeadings.Length;
         this._x1402a42b31a31090 = this._x554f16462d8d4675.DetermineOutputFieldCount();
         this._xc5416b6511261016 = new CSVHeaders(base.InputHeadings);
         this._x7acb8518c8ed6133 = new TimeSeriesUtil(this._x554f16462d8d4675, false, this._xc5416b6511261016.Headers);
         if (0 != 0)
         {
             goto Label_005C;
         }
     }
 }
开发者ID:neismit,项目名称:emds,代码行数:26,代码来源:AnalystEvaluateCSV.cs


示例3: Analyze

        /// <summary>
        ///     Analyze the data. This counts the records and prepares the data to be
        ///     processed.
        /// </summary>
        /// <param name="theAnalyst">The analyst to use.</param>
        /// <param name="inputFile">The input file.</param>
        /// <param name="headers">True if headers are present.</param>
        /// <param name="format">The format the file is in.</param>
        public void Analyze(EncogAnalyst theAnalyst,
                            FileInfo inputFile, bool headers, CSVFormat format)
        {
            InputFilename = inputFile;
            ExpectInputHeaders = headers;
            Format = format;
            _analyst = theAnalyst;

            Analyzed = true;

            PerformBasicCounts();

            _inputCount = _analyst.DetermineInputCount();
            _outputCount = _analyst.DetermineOutputCount();
            _idealCount = InputHeadings.Length - _inputCount;

            if ((InputHeadings.Length != _inputCount)
                && (InputHeadings.Length != (_inputCount + _outputCount)))
            {
                throw new AnalystError("Invalid number of columns("
                                       + InputHeadings.Length + "), must match input("
                                       + _inputCount + ") count or input+output("
                                       + (_inputCount + _outputCount) + ") count.");
            }
        }
开发者ID:jongh0,项目名称:MTree,代码行数:33,代码来源:AnalystEvaluateRawCSV.cs


示例4: CSVDataCODEC

 public CSVDataCODEC(string file, CSVFormat format, bool headers, int inputCount, int idealCount, bool significance)
 {
     if ((((uint) inputCount) - ((uint) significance)) < 0)
     {
     }
     Label_0063:
     if (this._x43f451310e815b76 != 0)
     {
         throw new BufferedDataError("To export CSV, you must use the CSVDataCODEC constructor that does not specify input or ideal sizes.");
     }
     Label_006B:
     this._xb44380e048627945 = file;
     if ((((uint) inputCount) - ((uint) inputCount)) <= uint.MaxValue)
     {
         this._x5786461d089b10a0 = format;
         this._x43f451310e815b76 = inputCount;
         this._xb52d4a98fad404da = idealCount;
         this._x94e6ca5ac178dbd0 = headers;
         this._x2602a84fb5c05ca2 = significance;
         if ((((uint) headers) - ((uint) inputCount)) > uint.MaxValue)
         {
             goto Label_0063;
             if ((((uint) significance) + ((uint) headers)) >= 0)
             {
                 goto Label_006B;
             }
             goto Label_0063;
         }
     }
 }
开发者ID:neismit,项目名称:emds,代码行数:30,代码来源:CSVDataCODEC.cs


示例5: ReadCSV

 public ReadCSV(string filename, bool headers, CSVFormat format)
 {
     this._x44b48f93f08f9199 = new List<string>();
     this._x26c511b92db96554 = new Dictionary<string, int>();
     this._xe134235b3526fa75 = new StreamReader(filename);
     this.x5e9e6297e1dda8c2(headers, format);
 }
开发者ID:neismit,项目名称:emds,代码行数:7,代码来源:ReadCSV.cs


示例6: FromListInt

        /// <summary>
        /// Get an array of ints's from a string of comma separated text.
        /// </summary>
        /// <param name="format">The way to format this list.</param>
        /// <param name="str">The string that contains a list of numbers.</param>
        /// <returns>An array of ints parsed from the string.</returns>
        public static int[] FromListInt(CSVFormat format, String str)
        {
            if (str.Trim().Length == 0)
            {
                return new int[0];
            }
            // first count the numbers

            String[] tok = str.Split(format.Separator);
            int count = tok.Length;

            // now allocate an object to hold that many numbers
            var result = new int[count];

            // and finally parse the numbers
            for (int index = 0; index < tok.Length; index++)
            {
                try
                {
                    String num = tok[index];
                    int value = int.Parse(num);
                    result[index] = value;
                }
                catch (Exception e)
                {
                    throw new PersistError(e);
                }
            }

            return result;
        }
开发者ID:encog,项目名称:encog-silverlight-core,代码行数:37,代码来源:NumberList.cs


示例7: FromList

        /// <summary>
        /// Get an array of double's from a string of comma separated text.
        /// </summary>
        /// <param name="format">The way to format this list.</param>
        /// <param name="str">The string that contains a list of numbers.</param>
        /// <returns>An array of doubles parsed from the string.</returns>
        public static double[] FromList(CSVFormat format, String str)
        {
            // first count the numbers

            String[] tok = str.Split(format.Separator);
            int count = tok.Length;

            // now allocate an object to hold that many numbers
            double[] result = new double[count];

            // and finally parse the numbers
            for (int index = 0; index < tok.Length; index++)
            {
                try
                {
                    String num = tok[index];
                    double value = format.Parse(num);
                    result[index] = value;
                }
                catch (Exception e)
                {
                    throw new PersistError(e);
                }

            }

            return result;
        }
开发者ID:OperatorOverload,项目名称:encog-cs,代码行数:34,代码来源:NumberList.cs


示例8: LoadCSVTOMemory

        /// <summary>
        /// Load a CSV file into a memory dataset.  
        /// </summary>
        ///
        /// <param name="format">The CSV format to use.</param>
        /// <param name="filename">The filename to load.</param>
        /// <param name="headers">True if there is a header line.</param>
        /// <param name="inputSize">The input size.  Input always comes first in a file.</param>
        /// <param name="idealSize">The ideal size, 0 for unsupervised.</param>
        /// <returns>A NeuralDataSet that holds the contents of the CSV file.</returns>
        public static IMLDataSet LoadCSVTOMemory(CSVFormat format, String filename,
                                                bool headers, int inputSize, int idealSize)
        {
            var result = new BasicMLDataSet();
            var csv = new ReadCSV(filename, headers, format);
            while (csv.Next())
            {
                BasicMLData ideal = null;
                int index = 0;

                var input = new BasicMLData(inputSize);
                for (int i = 0; i < inputSize; i++)
                {
                    double d = csv.GetDouble(index++);
                    input[i] = d;
                }

                if (idealSize > 0)
                {
                    ideal = new BasicMLData(idealSize);
                    for (int i = 0; i < idealSize; i++)
                    {
                        double d = csv.GetDouble(index++);
                        ideal[i] = d;
                    }
                }

                IMLDataPair pair = new BasicMLDataPair(input, ideal);
                result.Add(pair);
            }

            return result;
        }
开发者ID:jongh0,项目名称:MTree,代码行数:43,代码来源:TrainingSetUtil.cs


示例9: ReadCSV

 /// <summary>
 /// Construct a CSV reader from an input stream.
 /// </summary>
 /// <param name="istream">The InputStream to read from.</param>
 /// <param name="headers">Are headers present?</param>
 /// <param name="delim">What is the delimiter.</param>
 public ReadCSV(Stream istream, bool headers,
     char delim)
 {
     var format = new CSVFormat(CSVFormat.DecimalCharacter, delim);
     _reader = new StreamReader(istream);
     _delim = delim;
     Begin(headers, format);
 }
开发者ID:Romiko,项目名称:encog-dotnet-core,代码行数:14,代码来源:ReadCSV.cs


示例10: Analyze

 public void Analyze(FileInfo inputFile, bool headers, CSVFormat format)
 {
     base.InputFilename = inputFile;
     base.ExpectInputHeaders = headers;
     base.InputFormat = format;
     base.Analyzed = true;
     base.PerformBasicCounts();
 }
开发者ID:neismit,项目名称:emds,代码行数:8,代码来源:ShuffleCSV.cs


示例11: LoadedRow

 /// <summary>
 ///     Construct a loaded row from an IMLData.
 /// </summary>
 /// <param name="format">The format to store the numbers in.</param>
 /// <param name="data">The data to use.</param>
 /// <param name="extra">The extra positions to allocate.</param>
 public LoadedRow(CSVFormat format, IMLData data, int extra)
 {
     int count = data.Count;
     _data = new String[count + extra];
     for (int i = 0; i < count; i++)
     {
         _data[i] = format.Format(data[i], 5);
     }
 }
开发者ID:jongh0,项目名称:MTree,代码行数:15,代码来源:LoadedRow.cs


示例12: LoadedRow

 /// <summary>
 /// Construct a loaded row from an array.
 /// </summary>
 /// <param name="format">The format to store the numbers in.</param>
 /// <param name="data">The data to use.</param>
 /// <param name="extra">The extra positions to allocate.</param>
 public LoadedRow(CSVFormat format, double[] data, int extra)
 {
     int count = data.Length;
     _data = new String[count + extra];
     for (int i = 0; i < count; i++)
     {
         _data[i] = format.Format(data[i], 5);
     }
 }
开发者ID:neismit,项目名称:emds,代码行数:15,代码来源:LoadedRow.cs


示例13: Analyze

 public void Analyze(IMLRegression method, FileInfo inputFile, bool headers, CSVFormat format)
 {
     object[] objArray;
     base.InputFilename = inputFile;
     base.ExpectInputHeaders = headers;
     base.InputFormat = format;
     if (((uint) headers) >= 0)
     {
         base.Analyzed = true;
     }
     base.PerformBasicCounts();
     this._x43f451310e815b76 = method.InputCount;
     this._x98cf41c6b0eaf6ab = method.OutputCount;
     this._xb52d4a98fad404da = Math.Max(base.InputHeadings.Length - this._x43f451310e815b76, 0);
     if (0x7fffffff == 0)
     {
         goto Label_00E0;
     }
     if ((((uint) headers) & 0) != 0)
     {
         goto Label_0084;
     }
     if ((((uint) headers) - ((uint) headers)) >= 0)
     {
         if (base.InputHeadings.Length == this._x43f451310e815b76)
         {
             return;
         }
         if (3 == 0)
         {
             return;
         }
     }
     Label_000C:
     if (base.InputHeadings.Length != (this._x43f451310e815b76 + this._x98cf41c6b0eaf6ab))
     {
         objArray = new object[7];
         goto Label_00E0;
     }
     return;
     Label_0084:
     objArray[3] = this._x43f451310e815b76;
     if ((((uint) headers) + ((uint) headers)) < 0)
     {
         goto Label_000C;
     }
     objArray[4] = ") count or input+output(";
     objArray[5] = this._x43f451310e815b76 + this._x98cf41c6b0eaf6ab;
     objArray[6] = ") count.";
     throw new AnalystError(string.Concat(objArray));
     Label_00E0:
     objArray[0] = "Invalid number of columns(";
     objArray[1] = base.InputHeadings.Length;
     objArray[2] = "), must match input(";
     goto Label_0084;
 }
开发者ID:neismit,项目名称:emds,代码行数:56,代码来源:EvaluateRawCSV.cs


示例14: QuickParseCSV

 /// <summary>
 /// parses one column of a csv and returns an array of doubles.
 /// you can only return one double array with this method.
 /// </summary>
 /// <param name="file">The file.</param>
 /// <param name="formatused">The formatused.</param>
 /// <param name="Name">The name of the column to parse..</param>
 /// <returns></returns>
 public static List<double> QuickParseCSV(string file, CSVFormat formatused, string Name)
 {
     List<double> returnedArrays = new List<double>();
     ReadCSV csv = new ReadCSV(file, true, formatused);
     while (csv.Next())
     {
         returnedArrays.Add(csv.GetDouble(Name));
     }
     return returnedArrays;
 }
开发者ID:Romiko,项目名称:encog-dotnet-core,代码行数:18,代码来源:QuickCSVUtils.cs


示例15: Process

        /// <summary>
        /// Process, and sort the files.
        /// </summary>
        ///
        /// <param name="inputFile">The input file.</param>
        /// <param name="outputFile">The output file.</param>
        /// <param name="headers">True, if headers are to be used.</param>
        /// <param name="format">The format of the file.</param>
        public void Process(FileInfo inputFile, FileInfo outputFile,
                            bool headers, CSVFormat format)
        {
            InputFilename = inputFile;
            ExpectInputHeaders = headers;
            InputFormat = format;

            ReadInputFile();
            SortData();
            WriteOutputFile(outputFile);
        }
开发者ID:OperatorOverload,项目名称:encog-cs,代码行数:19,代码来源:SortCSV.cs


示例16: Analyze

        /// <summary>
        ///     Analyze the data. This counts the records and prepares the data to be
        ///     processed.
        /// </summary>
        /// <param name="inputFile">The input file to process.</param>
        /// <param name="headers">True, if headers are present.</param>
        /// <param name="format">The format of the CSV file.</param>
        public void Analyze(FileInfo inputFile, bool headers,
                            CSVFormat format)
        {
            InputFilename = inputFile;
            ExpectInputHeaders = headers;
            Format = format;

            Analyzed = true;

            PerformBasicCounts();
        }
开发者ID:benw408701,项目名称:MLHCTransactionPredictor,代码行数:18,代码来源:BalanceCSV.cs


示例17: Analyze

 public void Analyze(FileInfo inputFile, bool headers, CSVFormat format)
 {
     base.InputFilename = inputFile;
     do
     {
         base.ExpectInputHeaders = headers;
         base.InputFormat = format;
     }
     while ((((uint) headers) + ((uint) headers)) < 0);
     base.Analyzed = true;
     base.PerformBasicCounts();
     this.xae1ebc39c039dcb2();
 }
开发者ID:neismit,项目名称:emds,代码行数:13,代码来源:SegregateCSV.cs


示例18: Process

 public void Process(FileInfo inputFile, FileInfo outputFile, bool headers, CSVFormat format)
 {
     base.InputFilename = inputFile;
     base.ExpectInputHeaders = headers;
     base.InputFormat = format;
     this.xcc7d420ca2a80044();
     do
     {
         this.x116e636386480d14();
         this.x64b4cdf32944d344(outputFile);
     }
     while ((((uint) headers) | 1) == 0);
 }
开发者ID:neismit,项目名称:emds,代码行数:13,代码来源:SortCSV.cs


示例19: ConvertCSV2Binary

 /// <summary>
 /// Convert a CSV file to a binary training file.
 /// </summary>
 /// <param name="csvFile">The CSV file.</param>
 /// <param name="format">The format.</param>
 /// <param name="binFile">The binary file.</param>
 /// <param name="inputCount">The number of input values.</param>
 /// <param name="outputCount">The number of output values.</param>
 /// <param name="headers">True, if there are headers on the3 CSV.</param>
 /// <param name="expectSignificance">Should a significance column be expected.</param>
 public static void ConvertCSV2Binary(String csvFile, CSVFormat format,
                                      String binFile, int inputCount, int outputCount,
                                      bool headers, bool  expectSignificance)
 {
     new FileInfo(binFile).Delete();
             
     var csv = new CSVMLDataSet(csvFile,
                                inputCount, outputCount, false, format, expectSignificance);
     var buffer = new BufferedMLDataSet(binFile);
     buffer.BeginLoad(inputCount, outputCount);
     foreach (IMLDataPair pair in csv)
     {
         buffer.Add(pair);
     }
     buffer.EndLoad();
 }
开发者ID:tonyc2a,项目名称:encog-dotnet-core,代码行数:26,代码来源:EncogUtility.cs


示例20: CSVMLDataSet

 public CSVMLDataSet(string filename, int inputSize, int idealSize, bool headers, CSVFormat format, bool expectSignificance)
 {
     this._xb41a802ca5fde63b = filename;
     this._x7e648b416c264559 = inputSize;
     if (-2 != 0)
     {
         this._x08b9e0820ab2b457 = idealSize;
     }
     this._x5786461d089b10a0 = format;
     this._x94e6ca5ac178dbd0 = headers;
     IDataSetCODEC codec = new CSVDataCODEC(filename, format, headers, inputSize, idealSize, expectSignificance);
     MemoryDataLoader loader2 = new MemoryDataLoader(codec) {
         Result = this
     };
     loader2.External2Memory();
 }
开发者ID:neismit,项目名称:emds,代码行数:16,代码来源:CSVMLDataSet.cs



注:本文中的Encog.Util.CSV.CSVFormat类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CSV.ReadCSV类代码示例发布时间:2022-05-24
下一篇:
C# Persist.EncogWriteHelper类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap