Changeset 8180 for trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Classification/CSV
- Timestamp:
- 07/02/12 16:07:35 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Classification/CSV/ClassifiactionCSVInstanceProvider.cs
r7860 r8180 23 23 using System; 24 24 using System.Collections.Generic; 25 using System.IO; 26 using System.Text; 25 27 using HeuristicLab.Problems.DataAnalysis; 26 28 namespace HeuristicLab.Problems.Instances.DataAnalysis { … … 41 43 } 42 44 45 public override bool CanSaveData { 46 get { return true; } 47 } 48 43 49 public override IEnumerable<IDataDescriptor> GetDataDescriptors() { 44 50 return new List<IDataDescriptor>(); 51 } 52 53 public override void SaveData(IClassificationProblemData instance, string path) { 54 StringBuilder strBuilder = new StringBuilder(); 55 56 foreach (var variable in instance.InputVariables) { 57 strBuilder.Append(variable + ";"); 58 } 59 strBuilder.Remove(strBuilder.Length - 1, 1); 60 strBuilder.AppendLine(); 61 62 Dataset dataset = instance.Dataset; 63 64 for (int i = 0; i < dataset.Rows; i++) { 65 for (int j = 0; j < dataset.Columns; j++) { 66 strBuilder.Append(dataset.GetValue(i, j) + ";"); 67 } 68 strBuilder.Remove(strBuilder.Length - 1, 1); 69 strBuilder.AppendLine(); 70 } 71 72 using (StreamWriter writer = new StreamWriter(path)) { 73 writer.Write(strBuilder); 74 } 45 75 } 46 76
Note: See TracChangeset
for help on using the changeset viewer.