Changeset 7842 for branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis/3.4/Implementation
- Timestamp:
- 05/16/12 16:28:49 (13 years ago)
- Location:
- branches/HeuristicLab.TimeSeries
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.TimeSeries
- Property svn:mergeinfo changed
-
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis
- Property svn:mergeinfo changed
-
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationProblem.cs
r7268 r7842 40 40 ProblemData = new ClassificationProblemData(); 41 41 } 42 43 public override void ImportProblemDataFromFile(string fileName) {44 ClassificationProblemData problemData = ClassificationProblemData.ImportFromFile(fileName);45 ProblemData = problemData;46 }47 42 } 48 43 } -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationProblemData.cs
r7268 r7842 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.IO;25 24 using System.Linq; 26 25 using HeuristicLab.Common; … … 403 402 } 404 403 #endregion 405 406 #region Import from file407 public static ClassificationProblemData ImportFromFile(string fileName) {408 TableFileParser csvFileParser = new TableFileParser();409 csvFileParser.Parse(fileName);410 411 Dataset dataset = new Dataset(csvFileParser.VariableNames, csvFileParser.Values);412 dataset.Name = Path.GetFileName(fileName);413 414 ClassificationProblemData problemData = new ClassificationProblemData(dataset, dataset.DoubleVariables.Skip(1), dataset.DoubleVariables.First());415 problemData.Name = "Data imported from " + Path.GetFileName(fileName);416 return problemData;417 }418 #endregion419 404 } 420 405 } -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Clustering/ClusteringProblem.cs
r7268 r7842 38 38 ProblemData = new ClusteringProblemData(); 39 39 } 40 41 public override void ImportProblemDataFromFile(string fileName) {42 ClusteringProblemData problemData = ClusteringProblemData.ImportFromFile(fileName);43 ProblemData = problemData;44 }45 40 } 46 41 } -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Clustering/ClusteringProblemData.cs
r7268 r7842 21 21 22 22 using System.Collections.Generic; 23 using System.IO;24 23 using HeuristicLab.Common; 25 24 using HeuristicLab.Core; … … 90 89 : base(dataset, allowedInputVariables) { 91 90 } 92 93 94 #region Import from file95 public static ClusteringProblemData ImportFromFile(string fileName) {96 TableFileParser csvFileParser = new TableFileParser();97 csvFileParser.Parse(fileName);98 99 Dataset dataset = new Dataset(csvFileParser.VariableNames, csvFileParser.Values);100 dataset.Name = Path.GetFileName(fileName);101 102 ClusteringProblemData problemData = new ClusteringProblemData(dataset, dataset.DoubleVariables);103 problemData.Name = "Data imported from " + Path.GetFileName(fileName);104 return problemData;105 }106 #endregion107 91 } 108 92 } -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/DataAnalysisProblem.cs
r7268 r7842 26 26 using HeuristicLab.Parameters; 27 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 using HeuristicLab.Problems.Instances; 28 29 29 30 namespace HeuristicLab.Problems.DataAnalysis { 30 31 [StorableClass] 31 public abstract class DataAnalysisProblem<T> : Problem, 32 I DataAnalysisProblem<T>32 public abstract class DataAnalysisProblem<T> : Problem, IDataAnalysisProblem<T>, 33 IProblemInstanceConsumer<T>, IProblemInstanceExporter<T> 33 34 where T : class, IDataAnalysisProblemData { 34 35 private const string ProblemDataParameterName = "ProblemData"; … … 91 92 } 92 93 93 public abstract void ImportProblemDataFromFile(string fileName); 94 #region Import & Export 95 public void Load(T data) { 96 Name = data.Name; 97 Description = data.Description; 98 ProblemData = data; 99 OnReset(); 100 } 101 102 public T Export() { 103 return ProblemData; 104 } 105 #endregion 94 106 } 95 107 } -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionEnsembleSolution.cs
r7268 r7842 97 97 98 98 RegisterRegressionSolutionsEventHandler(); 99 } 100 101 public RegressionEnsembleSolution(IRegressionProblemData problemData) 102 : this(Enumerable.Empty<IRegressionModel>(), problemData) { 99 103 } 100 104 -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionProblem.cs
r7268 r7842 40 40 ProblemData = new RegressionProblemData(); 41 41 } 42 43 public override void ImportProblemDataFromFile(string fileName) {44 RegressionProblemData problemData = RegressionProblemData.ImportFromFile(fileName);45 ProblemData = problemData;46 }47 42 } 48 43 } -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionProblemData.cs
r7268 r7842 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.IO;25 24 using System.Linq; 26 25 using HeuristicLab.Common; … … 136 135 OnChanged(); 137 136 } 138 139 #region Import from file140 public static RegressionProblemData ImportFromFile(string fileName) {141 TableFileParser csvFileParser = new TableFileParser();142 csvFileParser.Parse(fileName);143 144 Dataset dataset = new Dataset(csvFileParser.VariableNames, csvFileParser.Values);145 dataset.Name = Path.GetFileName(fileName);146 147 RegressionProblemData problemData = new RegressionProblemData(dataset, dataset.DoubleVariables.Skip(1), dataset.DoubleVariables.First());148 problemData.Name = "Data imported from " + Path.GetFileName(fileName);149 return problemData;150 }151 #endregion152 137 } 153 138 } -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionSolution.cs
r7268 r7842 44 44 protected RegressionSolution(IRegressionModel model, IRegressionProblemData problemData) 45 45 : base(model, problemData) { 46 evaluationCache = new Dictionary<int, double>( );46 evaluationCache = new Dictionary<int, double>(problemData.Dataset.Rows); 47 47 } 48 48 -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionSolutionBase.cs
r7460 r7842 21 21 22 22 using System.Collections.Generic; 23 using System.Linq;24 23 using HeuristicLab.Common; 25 24 using HeuristicLab.Data; … … 166 165 167 166 protected void CalculateResults() { 168 double[] estimatedTrainingValues = EstimatedTrainingValues.ToArray(); // cache values169 double[] originalTrainingValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndizes).ToArray();170 double[] estimatedTestValues = EstimatedTestValues.ToArray(); // cache values171 double[] originalTestValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TestIndizes).ToArray();167 IEnumerable<double> estimatedTrainingValues = EstimatedTrainingValues; // cache values 168 IEnumerable<double> originalTrainingValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndizes); 169 IEnumerable<double> estimatedTestValues = EstimatedTestValues; // cache values 170 IEnumerable<double> originalTestValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TestIndizes); 172 171 173 172 OnlineCalculatorError errorState;
Note: See TracChangeset
for help on using the changeset viewer.