Changeset 17418
- Timestamp:
- 02/03/20 17:25:38 (5 years ago)
- Location:
- branches/3040_VectorBasedGP
- Files:
-
- 1 deleted
- 11 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/3040_VectorBasedGP/HeuristicLab.DataPreprocessing/3.4/Data/PreprocessingData.cs
r17180 r17418 407 407 } else if (dataset.VariableHasType<DateTime>(variableName)) { 408 408 variableValues.Insert(columnIndex, dataset.GetDateTimeValues(variableName).ToList()); 409 } else if (dataset.VariableHasType<DoubleVector>(variableName)) { 410 variableValues.Insert(columnIndex, dataset.GetDoubleVectorValues(variableName).ToList()); 409 411 } else { 410 412 throw new ArgumentException("The datatype of column " + variableName + " must be of type double, string or DateTime"); … … 681 683 l = 0; 682 684 ir = n - 1; 683 for (; ;) {685 for (; ; ) { 684 686 if (ir <= l + 1) { 685 687 // Active partition contains 1 or 2 elements. … … 706 708 j = ir; 707 709 a = arr[l + 1]; // Partitioning element. 708 for (; ;) { // Beginning of innermost loop.710 for (; ; ) { // Beginning of innermost loop. 709 711 do i++; while (arr[i].CompareTo(a) < 0); // Scan up to find element > a. 710 712 do j--; while (arr[j].CompareTo(a) > 0); // Scan down to find element < a. -
branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Vectors/DoubleVector.cs
r17400 r17418 85 85 86 86 public double Sum() { 87 return values.Sum();87 return Values.Sum(); 88 88 } 89 89 90 90 public double Mean() { 91 return values.Average();91 return Values.Average(); 92 92 } 93 93 94 94 public DoubleVector CumulativeMean() { 95 // todo: zero range average throws exception 95 96 return new DoubleVector( 96 97 Enumerable.Range(0, this.Count) -
branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Vectors/Vector.cs
r17367 r17418 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections; 23 24 using System.Collections.Generic; … … 29 30 public abstract class Vector<T> : IVector<T> { 30 31 [Storable] 31 protected readonly List<T> values;32 protected readonly List<T> Values; 32 33 33 34 protected Vector(IEnumerable<T> values) { 34 this. values = values.ToList();35 this.Values = values.ToList(); 35 36 } 36 37 … … 38 39 protected Vector(StorableConstructorFlag _) { } 39 40 41 public override string ToString() { 42 const int maxCount = 10; 43 string extension = Values.Count > maxCount ? ", ..." : ""; 44 return $"[{string.Join(", ", Values.Cast<object>().Take(Math.Min(Values.Count, maxCount)))}{extension}]"; 45 } 40 46 41 47 #region Interface members 42 48 43 49 public int Count { 44 get { return values.Count; }50 get { return Values.Count; } 45 51 } 46 52 47 53 public T this[int index] { 48 get { return values[index]; }54 get { return Values[index]; } 49 55 } 50 56 51 57 public IEnumerator<T> GetEnumerator() { 52 return values.GetEnumerator();58 return Values.GetEnumerator(); 53 59 } 54 60 -
branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Classification/TimeSeries/TimeSeriesInstanceProvider.cs
r17403 r17418 191 191 192 192 private ZipArchive OpenZipArchive() { 193 var instanceArchiveName = GetResourceName(FileName + @"\.zip"); 194 return new ZipArchive(GetType().Assembly.GetManifestResourceStream(instanceArchiveName), ZipArchiveMode.Read); 193 var instanceArchiveName = Path.Combine("Classification", "Data", FileName + ".zip"); 194 var stream = new FileStream(instanceArchiveName, FileMode.Open, FileAccess.Read, FileShare.Read); 195 return new ZipArchive(stream, ZipArchiveMode.Read); 195 196 } 196 197 -
branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/HeuristicLab.Problems.Instances.DataAnalysis-3.3.csproj
r17415 r17418 257 257 <Compile Include="Regression\VectorData\AzzaliBenchmark1.cs" /> 258 258 <Compile Include="Regression\VectorData\RandomExtensions.cs" /> 259 <Compile Include="Regression\VectorData\V ariousInstanceProvider.cs" />259 <Compile Include="Regression\VectorData\VectorDataInstanceProvider.cs" /> 260 260 <Compile Include="Regression\VectorData\VectorDataTestOne.cs" /> 261 261 <Compile Include="Regression\Vladislavleva\KotanchekFunction.cs" /> … … 275 275 </ItemGroup> 276 276 <ItemGroup> 277 <None Include="Classification\Data\TimeSeriesMultivariate.zip"> 278 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 279 </None> 277 280 <EmbeddedResource Include="Classification\Data\UCI.zip" /> 278 <EmbeddedResource Include="Classification\Data\TimeSeriesMultivariate.zip" /> 279 <EmbeddedResource Include="Classification\Data\TimeSeriesUnivariate.zip" /> 281 <None Include="Classification\Data\TimeSeriesUnivariate.zip"> 282 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 283 </None> 280 284 <None Include="HeuristicLab.snk" /> 281 285 <None Include="Plugin.cs.frame" /> … … 284 288 <EmbeddedResource Include="Regression\Data\MibaFriction.zip" /> 285 289 <EmbeddedResource Include="Regression\Data\PennML.zip" /> 286 <EmbeddedResource Include="Regression\Data\UCITimeSeries.zip" /> 290 <None Include="Regression\Data\UCITimeSeries.zip"> 291 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 292 </None> 287 293 </ItemGroup> 288 294 <ItemGroup> -
branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/ResourceRegressionInstanceProvider.cs
r17414 r17418 36 36 var descriptor = (ResourceRegressionDataDescriptor)id; 37 37 38 var instanceArchiveName = GetResourceName(FileName + @"\.zip"); 39 using (var instancesZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(instanceArchiveName), ZipArchiveMode.Read)) { 38 using (var instancesZipFile = new ZipArchive(OpenResourceStream(FileName), ZipArchiveMode.Read)) { 40 39 var entry = instancesZipFile.GetEntry(descriptor.ResourceName); 41 40 var formatOptions = GetFormatOptions(entry); … … 60 59 } 61 60 61 protected virtual Stream OpenResourceStream(string fileName) { 62 var instanceArchiveName = GetResourceName(FileName + @"\.zip"); 63 return GetType().Assembly.GetManifestResourceStream(instanceArchiveName); 64 } 65 62 66 protected virtual TableFileFormatOptions GetFormatOptions(ZipArchiveEntry entry) { 63 67 using (Stream stream = entry.Open()) { -
branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/UCITimeSeries/UCITimeSeriesProvider.cs
r17415 r17418 23 23 using System.Collections.Generic; 24 24 using System.Globalization; 25 using System.IO; 25 26 using System.IO.Compression; 26 27 … … 56 57 } 57 58 59 protected override Stream OpenResourceStream(string fileName) { 60 var instanceArchiveName = Path.Combine("Regression", "Data", fileName + ".zip"); 61 return new FileStream(instanceArchiveName, FileMode.Open, FileAccess.Read, FileShare.Read); 62 } 63 58 64 protected override TableFileFormatOptions GetFormatOptions(ZipArchiveEntry entry) { 59 65 return new TableFileFormatOptions { -
branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData/AzzaliBenchmark1.cs
r17400 r17418 14 14 15 15 protected override string TargetVariable { get { return "B1"; } } 16 protected override string[] VariableNames { get { return new string[] { "X1", "X2", "X3", "X4" }; } }16 protected override string[] VariableNames { get { return AllowedInputVariables.Concat(new[] { TargetVariable }).ToArray(); } } 17 17 protected override string[] AllowedInputVariables { get { return new string[] { "X1", "X2", "X3", "X4" }; } } 18 18 protected override int TrainingPartitionStart { get { return 0; } } -
branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData/AzzaliBenchmark2.cs
r17400 r17418 14 14 15 15 protected override string TargetVariable { get { return "B2"; } } 16 protected override string[] VariableNames { get { return new string[] { "X1", "X2", "X3", "X4" }; } }16 protected override string[] VariableNames { get { return AllowedInputVariables.Concat(new[] { TargetVariable }).ToArray(); } } 17 17 protected override string[] AllowedInputVariables { get { return new string[] { "X1", "X2", "X3", "X4" }; } } 18 18 protected override int TrainingPartitionStart { get { return 0; } } -
branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData/AzzaliBenchmark3.cs
r17400 r17418 14 14 15 15 protected override string TargetVariable { get { return "B3"; } } 16 protected override string[] VariableNames { get { return new string[] { "X1", "X2", "X3", "X4" }; } }16 protected override string[] VariableNames { get { return AllowedInputVariables.Concat(new[] { TargetVariable }).ToArray(); } } 17 17 protected override string[] AllowedInputVariables { get { return new string[] { "X1", "X2", "X3", "X4" }; } } 18 18 protected override int TrainingPartitionStart { get { return 0; } } -
branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData/AzzaliKorns5.cs
r17400 r17418 14 14 15 15 protected override string TargetVariable { get { return "K5"; } } 16 protected override string[] VariableNames { get { return new string[] { "X1", "X2", "X3", "X4" }; } }16 protected override string[] VariableNames { get { return AllowedInputVariables.Concat(new[] { TargetVariable }).ToArray(); } } 17 17 protected override string[] AllowedInputVariables { get { return new string[] { "X1", "X2", "X3", "X4" }; } } 18 18 protected override int TrainingPartitionStart { get { return 0; } } -
branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData/VectorDataInstanceProvider.cs
r17417 r17418 50 50 var rand = new MersenneTwister((uint)Seed); 51 51 return new List<IDataDescriptor> { 52 new VectorDataTestOne(rand.Next()), 53 new AzzaliKorns5(rand.Next()), 52 new VectorDataTestOneA(rand.Next()), 53 new VectorDataTestOneB(rand.Next()), 54 new VectorDataTestOneC(rand.Next()), 55 new VectorDataTestOneD(rand.Next()), 54 56 new AzzaliBenchmark1(rand.Next()), 55 57 new AzzaliBenchmark2(rand.Next()), 56 new AzzaliBenchmark3(rand.Next()) 58 new AzzaliBenchmark3(rand.Next()), 59 new AzzaliKorns5(rand.Next()) 57 60 }; 58 61 }
Note: See TracChangeset
for help on using the changeset viewer.