Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8685


Ignore:
Timestamp:
09/24/12 09:44:08 (12 years ago)
Author:
abeham
Message:

#1922:

  • Removed list separator in variable names if present
  • Changed export to output all variables in the dataset
Location:
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Classification/CSV/ClassifiactionCSVInstanceProvider.cs

    r8601 r8685  
    131131    public override void ExportData(IClassificationProblemData instance, string path) {
    132132      var strBuilder = new StringBuilder();
    133 
    134       foreach (var variable in instance.InputVariables) {
    135         strBuilder.Append(variable + CultureInfo.CurrentCulture.TextInfo.ListSeparator);
     133      var colSep = CultureInfo.CurrentCulture.TextInfo.ListSeparator;
     134      foreach (var variable in instance.Dataset.VariableNames) {
     135        strBuilder.Append(variable.Replace(colSep, String.Empty) + colSep);
    136136      }
    137       strBuilder.Remove(strBuilder.Length - CultureInfo.CurrentCulture.TextInfo.ListSeparator.Length, CultureInfo.CurrentCulture.TextInfo.ListSeparator.Length);
     137      strBuilder.Remove(strBuilder.Length - colSep.Length, colSep.Length);
    138138      strBuilder.AppendLine();
    139139
     
    142142      for (int i = 0; i < dataset.Rows; i++) {
    143143        for (int j = 0; j < dataset.Columns; j++) {
    144           if (j > 0) strBuilder.Append(CultureInfo.CurrentCulture.TextInfo.ListSeparator);
     144          if (j > 0) strBuilder.Append(colSep);
    145145          strBuilder.Append(dataset.GetValue(i, j));
    146146        }
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Clustering/CSV/ClusteringCSVInstanceProvider.cs

    r8601 r8685  
    130130    public override void ExportData(IClusteringProblemData instance, string path) {
    131131      var strBuilder = new StringBuilder();
    132 
    133       foreach (var variable in instance.InputVariables) {
    134         strBuilder.Append(variable + CultureInfo.CurrentCulture.TextInfo.ListSeparator);
     132      var colSep = CultureInfo.CurrentCulture.TextInfo.ListSeparator;
     133      foreach (var variable in instance.Dataset.VariableNames) {
     134        strBuilder.Append(variable.Replace(colSep, String.Empty) + colSep);
    135135      }
    136       strBuilder.Remove(strBuilder.Length - CultureInfo.CurrentCulture.TextInfo.ListSeparator.Length, CultureInfo.CurrentCulture.TextInfo.ListSeparator.Length);
     136      strBuilder.Remove(strBuilder.Length - colSep.Length, colSep.Length);
    137137      strBuilder.AppendLine();
    138138
     
    141141      for (int i = 0; i < dataset.Rows; i++) {
    142142        for (int j = 0; j < dataset.Columns; j++) {
    143           if (j > 0) strBuilder.Append(CultureInfo.CurrentCulture.TextInfo.ListSeparator);
     143          if (j > 0) strBuilder.Append(colSep);
    144144          strBuilder.Append(dataset.GetValue(i, j));
    145145        }
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/CSV/RegressionCSVInstanceProvider.cs

    r8601 r8685  
    129129    public override void ExportData(IRegressionProblemData instance, string path) {
    130130      var strBuilder = new StringBuilder();
    131 
    132       foreach (var variable in instance.InputVariables) {
    133         strBuilder.Append(variable + CultureInfo.CurrentCulture.TextInfo.ListSeparator);
     131      var colSep = CultureInfo.CurrentCulture.TextInfo.ListSeparator;
     132      foreach (var variable in instance.Dataset.VariableNames) {
     133        strBuilder.Append(variable.Replace(colSep, String.Empty) + colSep);
    134134      }
    135       strBuilder.Remove(strBuilder.Length - CultureInfo.CurrentCulture.TextInfo.ListSeparator.Length, CultureInfo.CurrentCulture.TextInfo.ListSeparator.Length);
     135      strBuilder.Remove(strBuilder.Length - colSep.Length, colSep.Length);
    136136      strBuilder.AppendLine();
    137137
     
    140140      for (int i = 0; i < dataset.Rows; i++) {
    141141        for (int j = 0; j < dataset.Columns; j++) {
    142           if (j > 0) strBuilder.Append(CultureInfo.CurrentCulture.TextInfo.ListSeparator);
     142          if (j > 0) strBuilder.Append(colSep);
    143143          strBuilder.Append(dataset.GetValue(i, j));
    144144        }
Note: See TracChangeset for help on using the changeset viewer.