- Timestamp:
- 07/02/12 16:07:35 (13 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3
- Files:
-
- 6 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 -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Classification/ClassificationInstanceProvider.cs
r7965 r8180 20 20 #endregion 21 21 22 using System;23 22 using System.Collections; 24 23 using System.Collections.Generic; 25 using System.IO;26 24 using System.Linq; 27 using System.Text;28 25 using HeuristicLab.Problems.DataAnalysis; 29 26 30 27 namespace HeuristicLab.Problems.Instances.DataAnalysis { 31 public abstract class ClassificationInstanceProvider : IProblemInstanceProvider<IClassificationProblemData> {32 public IClassificationProblemData LoadData(string path) {28 public abstract class ClassificationInstanceProvider : ProblemInstanceProvider<IClassificationProblemData> { 29 public override IClassificationProblemData LoadData(string path) { 33 30 TableFileParser csvFileParser = new TableFileParser(); 34 31 … … 56 53 return claData; 57 54 } 58 59 public void SaveData(IClassificationProblemData instance, string path) {60 StringBuilder strBuilder = new StringBuilder();61 62 foreach (var variable in instance.InputVariables) {63 strBuilder.Append(variable + ";");64 }65 strBuilder.Remove(strBuilder.Length - 1, 1);66 strBuilder.AppendLine();67 68 Dataset dataset = instance.Dataset;69 70 for (int i = 0; i < dataset.Rows; i++) {71 for (int j = 0; j < dataset.Columns; j++) {72 strBuilder.Append(dataset.GetValue(i, j) + ";");73 }74 strBuilder.Remove(strBuilder.Length - 1, 1);75 strBuilder.AppendLine();76 }77 78 using (StreamWriter writer = new StreamWriter(path)) {79 writer.Write(strBuilder);80 }81 }82 83 public abstract IEnumerable<IDataDescriptor> GetDataDescriptors();84 public abstract IClassificationProblemData LoadData(IDataDescriptor descriptor);85 86 public abstract string Name { get; }87 public abstract string Description { get; }88 public abstract Uri WebLink { get; }89 public abstract string ReferencePublication { get; }90 55 } 91 56 } -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Clustering/CSV/ClusteringCSVInstanceProvider.cs
r8084 r8180 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.IO; 25 using System.Text; 24 26 using HeuristicLab.Problems.DataAnalysis; 25 27 … … 45 47 } 46 48 49 public override bool CanSaveData { 50 get { return true; } 51 } 52 53 public override void SaveData(IClusteringProblemData instance, string path) { 54 var 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 var 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 (var writer = new StreamWriter(path)) { 73 writer.Write(strBuilder); 74 } 75 } 76 47 77 public override IClusteringProblemData LoadData(IDataDescriptor descriptor) { 48 78 throw new NotImplementedException(); -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Clustering/ClusteringInstanceProvider.cs
r8084 r8180 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.IO;25 using System.Text;26 22 using HeuristicLab.Problems.DataAnalysis; 27 23 28 24 namespace HeuristicLab.Problems.Instances.DataAnalysis { 29 public abstract class ClusteringInstanceProvider : IProblemInstanceProvider<IClusteringProblemData> {30 public IClusteringProblemData LoadData(string path) {25 public abstract class ClusteringInstanceProvider : ProblemInstanceProvider<IClusteringProblemData> { 26 public override IClusteringProblemData LoadData(string path) { 31 27 var csvFileParser = new TableFileParser(); 32 28 … … 51 47 return claData; 52 48 } 53 54 public void SaveData(IClusteringProblemData instance, string path) {55 var strBuilder = new StringBuilder();56 57 foreach (var variable in instance.InputVariables) {58 strBuilder.Append(variable + ";");59 }60 strBuilder.Remove(strBuilder.Length - 1, 1);61 strBuilder.AppendLine();62 63 var dataset = instance.Dataset;64 65 for (int i = 0; i < dataset.Rows; i++) {66 for (int j = 0; j < dataset.Columns; j++) {67 strBuilder.Append(dataset.GetValue(i, j) + ";");68 }69 strBuilder.Remove(strBuilder.Length - 1, 1);70 strBuilder.AppendLine();71 }72 73 using (var writer = new StreamWriter(path)) {74 writer.Write(strBuilder);75 }76 }77 78 public abstract IEnumerable<IDataDescriptor> GetDataDescriptors();79 public abstract IClusteringProblemData LoadData(IDataDescriptor descriptor);80 81 public abstract string Name { get; }82 public abstract string Description { get; }83 public abstract Uri WebLink { get; }84 public abstract string ReferencePublication { get; }85 49 } 86 50 } -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/CSV/RegressionCSVInstanceProvider.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(IRegressionProblemData 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 -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/RegressionInstanceProvider.cs
r7965 r8180 20 20 #endregion 21 21 22 using System;23 22 using System.Collections; 24 23 using System.Collections.Generic; 25 using System.IO;26 24 using System.Linq; 27 using System.Text;28 25 using HeuristicLab.Problems.DataAnalysis; 29 26 30 27 namespace HeuristicLab.Problems.Instances.DataAnalysis { 31 public abstract class RegressionInstanceProvider : IProblemInstanceProvider<IRegressionProblemData> {28 public abstract class RegressionInstanceProvider : ProblemInstanceProvider<IRegressionProblemData> { 32 29 33 public IRegressionProblemData LoadData(string path) {30 public override IRegressionProblemData LoadData(string path) { 34 31 TableFileParser csvFileParser = new TableFileParser(); 35 32 csvFileParser.Parse(path); … … 57 54 return regData; 58 55 } 59 60 public void SaveData(IRegressionProblemData instance, string path) {61 StringBuilder strBuilder = new StringBuilder();62 63 foreach (var variable in instance.InputVariables) {64 strBuilder.Append(variable + ";");65 }66 strBuilder.Remove(strBuilder.Length - 1, 1);67 strBuilder.AppendLine();68 69 Dataset dataset = instance.Dataset;70 71 for (int i = 0; i < dataset.Rows; i++) {72 for (int j = 0; j < dataset.Columns; j++) {73 strBuilder.Append(dataset.GetValue(i, j) + ";");74 }75 strBuilder.Remove(strBuilder.Length - 1, 1);76 strBuilder.AppendLine();77 }78 79 using (StreamWriter writer = new StreamWriter(path)) {80 writer.Write(strBuilder);81 }82 }83 84 public abstract IEnumerable<IDataDescriptor> GetDataDescriptors();85 public abstract IRegressionProblemData LoadData(IDataDescriptor descriptor);86 87 public abstract string Name { get; }88 public abstract string Description { get; }89 public abstract Uri WebLink { get; }90 public abstract string ReferencePublication { get; }91 56 } 92 57 }
Note: See TracChangeset
for help on using the changeset viewer.