Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/30/15 12:07:37 (9 years ago)
Author:
gkronber
Message:

#2071: removed cloning of values in dataset (TODO: review data preprocessing)

File:
1 edited

Legend:

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

    r12509 r13419  
    5252    }
    5353
     54    /// <summary>
     55    /// Creates a new dataset. The variableValues are not cloned.
     56    /// </summary>
     57    /// <param name="variableNames">The names of the variables in the dataset</param>
     58    /// <param name="variableValues">The values for the variables (column-oriented storage). Values are not cloned!</param>
    5459    public Dataset(IEnumerable<string> variableNames, IEnumerable<IList> variableValues)
    5560      : base() {
     
    7580      for (int i = 0; i < this.variableNames.Count; i++) {
    7681        var values = variableValues.ElementAt(i);
    77         IList clonedValues = null;
    78         if (values is IList<double>)
    79           clonedValues = new List<double>(values.Cast<double>());
    80         else if (values is IList<string>)
    81           clonedValues = new List<string>(values.Cast<string>());
    82         else if (values is IList<DateTime>)
    83           clonedValues = new List<DateTime>(values.Cast<DateTime>());
    84         else {
    85           this.variableNames = new List<string>();
    86           this.variableValues = new Dictionary<string, IList>();
    87           throw new ArgumentException("The variable values must be of type IList<double>, IList<string> or IList<DateTime>");
    88         }
    89         this.variableValues.Add(this.variableNames[i], clonedValues);
     82        this.variableValues.Add(this.variableNames[i], values);
    9083      }
    9184    }
Note: See TracChangeset for help on using the changeset viewer.