Changeset 9131 for trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/RealWorld
- Timestamp:
- 01/09/13 10:50:08 (12 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/RealWorld
- Files:
-
- 3 added
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/RealWorld/RealWorldRegressionInstanceProvider.cs
r9129 r9131 21 21 22 22 using System; 23 using System.Collections.Generic; 24 using System.IO; 25 using System.Linq; 26 using HeuristicLab.Problems.DataAnalysis; 27 using ICSharpCode.SharpZipLib.Zip; 23 28 24 29 namespace HeuristicLab.Problems.Instances.DataAnalysis { … … 40 45 41 46 protected override string FileName { get { return "RegressionRealWorld"; } } 47 48 public override IEnumerable<IDataDescriptor> GetDataDescriptors() { 49 List<IRealWorldRegressionDataDescriptor> descriptorList = new List<IRealWorldRegressionDataDescriptor>(); 50 descriptorList.Add(new Tower()); 51 var solutionsArchiveName = GetResourceName(FileName + @"\.zip"); 52 if (!String.IsNullOrEmpty(solutionsArchiveName)) { 53 using (var solutionsZipFile = new ZipInputStream(GetType().Assembly.GetManifestResourceStream(solutionsArchiveName))) { 54 IList<string> entries = new List<string>(); 55 ZipEntry curEntry; 56 while ((curEntry = solutionsZipFile.GetNextEntry()) != null) { 57 entries.Add(curEntry.Name); 58 } 59 foreach (var entry in entries.OrderBy(x => x)) { 60 string prettyName = Path.GetFileNameWithoutExtension(entry); 61 IRealWorldRegressionDataDescriptor desc = descriptorList.Where(x => x.Name.Equals(prettyName)).FirstOrDefault(); 62 if (desc != null) { 63 yield return new RealWorldResourceRegressionDataDescriptor(prettyName, desc.Description, entry, desc.Training, desc.Test); 64 } else 65 yield return new ResourceRegressionDataDescriptor(prettyName, Description, entry); 66 } 67 } 68 } 69 } 70 71 public override IRegressionProblemData LoadData(IDataDescriptor id) { 72 var problem = base.LoadData(id); 73 74 var descriptor = id as RealWorldResourceRegressionDataDescriptor; 75 76 if (descriptor == null) { 77 return problem; 78 } 79 80 problem.TrainingPartition.Start = descriptor.Training.Start; 81 problem.TrainingPartition.End = descriptor.Training.End; 82 problem.TestPartition.Start = descriptor.Test.Start; 83 problem.TestPartition.End = descriptor.Test.End; 84 85 return problem; 86 } 42 87 } 43 88 }
Note: See TracChangeset
for help on using the changeset viewer.