Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/25/20 07:41:01 (5 years ago)
Author:
pfleck
Message:

#3040 Replaced own Vector with MathNet.Numerics Vector.

Location:
branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Classification/TimeSeries/TimeSeriesInstanceProvider.cs

    r17418 r17448  
    3030using System.Linq;
    3131using HeuristicLab.Problems.DataAnalysis;
     32
     33using DoubleVector = MathNet.Numerics.LinearAlgebra.Vector<double>;
    3234
    3335namespace HeuristicLab.Problems.Instances.DataAnalysis {
     
    160162          var numbers = variable
    161163            .Split(',')
    162             .Select(ParseNumber)
    163             .ToList();
    164           inputsData[i].Add(new DoubleVector(numbers));
     164            .Select(ParseNumber);
     165          inputsData[i].Add(DoubleVector.Build.DenseOfEnumerable(numbers));
    165166        }
    166167
  • branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/HeuristicLab.Problems.Instances.DataAnalysis-3.3.csproj

    r17418 r17448  
    114114      <SpecificVersion>False</SpecificVersion>
    115115      <HintPath>..\..\bin\ALGLIB-3.7.0.dll</HintPath>
     116    </Reference>
     117    <Reference Include="MathNet.Numerics, Version=4.9.0.0, Culture=neutral, processorArchitecture=MSIL">
     118      <SpecificVersion>False</SpecificVersion>
     119      <HintPath>..\..\bin\MathNet.Numerics.dll</HintPath>
    116120    </Reference>
    117121    <Reference Include="System" />
  • branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Plugin.cs.frame

    r17184 r17448  
    3535  [PluginDependency("HeuristicLab.Problems.Instances", "3.3")]
    3636  [PluginDependency("HeuristicLab.Random", "3.3")]
     37  [PluginDependency("HeuristicLab.MathNet.Numerics", "4.9.0")]
    3738  public class HeuristicLabProblemsInstancesDataAnalysisPlugin : PluginBase {
    3839  }
  • branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData/AzzaliBenchmark1.cs

    r17418 r17448  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using System;
    223using System.Collections;
    324using System.Collections.Generic;
     
    728using HeuristicLab.Problems.DataAnalysis;
    829using HeuristicLab.Random;
     30using MathNet.Numerics.Statistics;
     31
     32using DoubleVector = MathNet.Numerics.LinearAlgebra.Vector<double>;
    933
    1034namespace HeuristicLab.Problems.Instances.DataAnalysis {
  • branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData/AzzaliBenchmark2.cs

    r17418 r17448  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using System;
    223using System.Collections;
    324using System.Collections.Generic;
     
    728using HeuristicLab.Problems.DataAnalysis;
    829using HeuristicLab.Random;
     30using MathNet.Numerics.Statistics;
     31
     32using DoubleVector = MathNet.Numerics.LinearAlgebra.Vector<double>;
    933
    1034namespace HeuristicLab.Problems.Instances.DataAnalysis {
    1135  public class AzzaliBenchmark2 : ArtificialRegressionDataDescriptor {
    12     public override string Name { get { return "Azzali Benchmark2 B2 = ((X3 + X1) / mean(X4)) * X2"; } }
     36    public override string Name { get { return "Azzali Benchmark2 B2 = ((X3 + X1) / CumMean(X4)) * X2"; } }
    1337    public override string Description { get { return "I. Azzali, L. Vanneschi, S. Silva, I. Bakurov, and M. Giacobini, “A Vectorial Approach to Genetic Programming,” EuroGP, pp. 213–227, 2019."; } }
    1438
     
    4771        var x4 = rand.NextDoubleVector(-5, +5, 10);
    4872
    49         var b2 = ((x3 + x1) / x4.CumulativeMean()) * x2;
     73        var cumMean = x4.MapIndexed((j, v) => x4.SubVector(0, j + 1).Mean());
     74        var b2 = ((x3 + x1) / cumMean) * x2;
    5075
    5176        x1Column.Add(x1);
  • branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData/AzzaliBenchmark3.cs

    r17418 r17448  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using System;
    223using System.Collections;
    324using System.Collections.Generic;
     
    829using HeuristicLab.Random;
    930
     31using DoubleVector = MathNet.Numerics.LinearAlgebra.Vector<double>;
     32
    1033namespace HeuristicLab.Problems.Instances.DataAnalysis {
    1134  public class AzzaliBenchmark3 : ArtificialRegressionDataDescriptor {
    12     public override string Name { get { return "Azzali Benchmark2 B3 = "; } }
     35    public override string Name { get { return "Azzali Benchmark2 B3 = CumMin[3,3] * (X2 / X3) + X4"; } }
    1336    public override string Description { get { return "I. Azzali, L. Vanneschi, S. Silva, I. Bakurov, and M. Giacobini, “A Vectorial Approach to Genetic Programming,” EuroGP, pp. 213–227, 2019."; } }
    1437
     
    4972        var x5 = rand.NextDouble(0, 1);
    5073
    51         int p = 3, q = 3;
    52         var cumulativeMin = new DoubleVector(
     74        const int p = 3, q = 3;
     75        var cumulativeMin = DoubleVector.Build.DenseOfEnumerable(
    5376          Enumerable.Range(0, x1.Count)
    5477            .Select(idx => Enumerable.Range(idx - p, q)) // build index ranges for each target entry
  • branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData/AzzaliKorns5.cs

    r17418 r17448  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using System;
    223using System.Collections;
    324using System.Collections.Generic;
     
    829using HeuristicLab.Random;
    930
     31using DoubleVector = MathNet.Numerics.LinearAlgebra.Vector<double>;
     32
    1033namespace HeuristicLab.Problems.Instances.DataAnalysis {
    1134  public class AzzaliKorns5 : ArtificialRegressionDataDescriptor {
    12     public override string Name { get { return "Azzali Korns5 K5 ="; } }
     35    public override string Name { get { return "Azzali Korns5 K5 = 3.0 + 2.23 * log(X4)"; } }
    1336    public override string Description { get { return "I. Azzali, L. Vanneschi, S. Silva, I. Bakurov, and M. Giacobini, “A Vectorial Approach to Genetic Programming,” EuroGP, pp. 213–227, 2019."; } }
    1437
     
    4770        var x4 = rand.NextDoubleVector(-50, +50, 10);
    4871
    49         var k5 = 3 + 2.13 * new DoubleVector(x4.Select(d4 => Math.Log(d4)));
     72        var k5 = 3 + 2.13 * x4.PointwiseLog();
    5073
    5174        x1Column.Add(x1);
  • branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData/RandomExtensions.cs

    r17400 r17448  
    1 using HeuristicLab.Core;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using HeuristicLab.Core;
    223using HeuristicLab.Problems.DataAnalysis;
     24
     25using DoubleVector = MathNet.Numerics.LinearAlgebra.Vector<double>;
    326
    427namespace HeuristicLab.Problems.Instances.DataAnalysis {
     
    1235        values[i] = rand.NextDouble(min, max);
    1336      }
    14       return new DoubleVector(values);
     37      return DoubleVector.Build.Dense(values);
    1538    }
    1639  }
  • branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/VectorData/VectorDataTestOne.cs

    r17419 r17448  
    2727using HeuristicLab.Problems.DataAnalysis;
    2828using HeuristicLab.Random;
     29using MathNet.Numerics.Statistics;
     30
     31using DoubleVector = MathNet.Numerics.LinearAlgebra.Vector<double>;
    2932
    3033namespace HeuristicLab.Problems.Instances.DataAnalysis {
  • branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/TableFileParser.cs

    r17414 r17448  
    3030using HeuristicLab.Problems.DataAnalysis;
    3131
     32using DoubleVector = MathNet.Numerics.LinearAlgebra.Vector<double>;
     33
    3234namespace HeuristicLab.Problems.Instances.DataAnalysis {
    3335  public class TableFileParser : Progress<long> { // reports the number of bytes read
     
    272274            var vectorList = new List<DoubleVector>(stringList.Count);
    273275            for (int j = 0; j < doubles.Length; j++) {
    274               vectorList.Add(new DoubleVector(doubles[j]));
     276              vectorList.Add(DoubleVector.Build.Dense(doubles[j]));
    275277            }
    276278
Note: See TracChangeset for help on using the changeset viewer.