Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/04/10 18:53:55 (14 years ago)
Author:
gkronber
Message:

Implemented import of CSV files for regression problems. #938 (Data types and operators for regression problems)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Dataset.cs

    r3253 r3264  
    4040
    4141    public Dataset()
    42       : this(new double[,] { { 0.0 } }) {
    43     }
    44 
    45     public Dataset(double[,] data)
     42      : this(new string[] { "x" }, new double[,] { { 0.0 } }) {
     43    }
     44
     45    public Dataset(IEnumerable<string> variableNames, double[,] data)
    4646      : base() {
    4747      Name = "-";
     48      if (variableNames.Count() != data.GetLength(1)) {
     49        throw new ArgumentException("Number of variable names doesn't match the number of columns of data");
     50      }
    4851      Data = new DoubleMatrix(data);
    49       string formatString = new StringBuilder().Append('#', (int)Math.Log10(this.data.Columns) + 1).ToString(); // >= 100 variables => ###
    50       this.variableNames = new StringArray((from col in Enumerable.Range(1, this.data.Columns)
    51                                             select "Var" + col.ToString(formatString)).ToArray());
     52      this.variableNames = new StringArray(variableNames.ToArray());
    5253    }
    5354
Note: See TracChangeset for help on using the changeset viewer.