Free cookie consent management tool by TermsFeed Policy Generator

Changeset 15788


Ignore:
Timestamp:
02/20/18 09:09:32 (7 years ago)
Author:
gkronber
Message:

#2902 merged r15783 and r15786 from trunk to stable

Location:
stable
Files:
15 edited
1 copied

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Algorithms.DataAnalysis

  • stable/HeuristicLab.Algorithms.DataAnalysis/3.4

  • stable/HeuristicLab.Algorithms.DataAnalysis/3.4/DoubleArrayExtensions.cs

    r15783 r15788  
    11namespace HeuristicLab.Algorithms.DataAnalysis {
    22  public static class DoubleArrayExtensions {
    3     public static bool ContainsNanInf(this double[,] array) {
     3    public static bool ContainsNanOrInfinity(this double[,] array) {
    44      foreach (var entry in array) {
    55        if (double.IsNaN(entry) || double.IsInfinity(entry)) {
  • stable/HeuristicLab.Algorithms.DataAnalysis/3.4/HeuristicLab.Algorithms.DataAnalysis-3.4.csproj

    r15571 r15788  
    131131      <SubType>Code</SubType>
    132132    </Compile>
     133    <Compile Include="DoubleArrayExtensions.cs" />
    133134    <Compile Include="FixedDataAnalysisAlgorithm.cs" />
    134135    <Compile Include="GaussianProcess\CovarianceFunctions\CovarianceSpectralMixture.cs" />
     
    320321    <Compile Include="TSNE\Distances\IndexedItemDistance.cs" />
    321322    <Compile Include="TSNE\Distances\ManhattanDistance.cs" />
    322   <Compile Include="TSNE\Distances\WeightedEuclideanDistance.cs" />
     323    <Compile Include="TSNE\Distances\WeightedEuclideanDistance.cs" />
    323324    <Compile Include="TSNE\Distances\IDistance.cs" />
    324325    <Compile Include="TSNE\PriorityQueue.cs" />
  • stable/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/LinearDiscriminantAnalysis.cs

    r15584 r15788  
    8080      inputMatrix = factorMatrix.HorzCat(inputMatrix);
    8181
    82       if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x)))
     82      if (inputMatrix.ContainsNanOrInfinity())
    8383        throw new NotSupportedException("Linear discriminant analysis does not support NaN or infinity values in the input dataset.");
    8484
  • stable/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/LinearRegression.cs

    r15584 r15788  
    8080      var inputMatrix = binaryMatrix.HorzCat(doubleVarMatrix);
    8181
    82       if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x)))
     82      if (inputMatrix.ContainsNanOrInfinity())
    8383        throw new NotSupportedException("Linear regression does not support NaN or infinity values in the input dataset.");
    8484
     
    100100      int nVarCoeff = doubleVariables.Count();
    101101      var tree = LinearModelToTreeConverter.CreateTree(factorVariables, coefficients.Take(nFactorCoeff).ToArray(),
    102         doubleVariables.ToArray(), coefficients.Skip(nFactorCoeff).Take(nVarCoeff).ToArray(), 
     102        doubleVariables.ToArray(), coefficients.Skip(nFactorCoeff).Take(nVarCoeff).ToArray(),
    103103        @const: coefficients[nFeatures]);
    104      
     104
    105105      SymbolicRegressionSolution solution = new SymbolicRegressionSolution(new SymbolicRegressionModel(problemData.TargetVariable, tree, new SymbolicDataAnalysisExpressionTreeLinearInterpreter()), (IRegressionProblemData)problemData.Clone());
    106106      solution.Model.Name = "Linear Regression Model";
  • stable/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/MultinomialLogitClassification.cs

    r15584 r15788  
    7878      inputMatrix = factorMatrix.HorzCat(inputMatrix);
    7979
    80       if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x)))
     80      if (inputMatrix.ContainsNanOrInfinity())
    8181        throw new NotSupportedException("Multinomial logit classification does not support NaN or infinity values in the input dataset.");
    8282
  • stable/HeuristicLab.Algorithms.DataAnalysis/3.4/NearestNeighbour/NearestNeighbourModel.cs

    r15584 r15788  
    142142      }
    143143
    144       if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x)))
     144      if (inputMatrix.ContainsNanOrInfinity())
    145145        throw new NotSupportedException(
    146146          "Nearest neighbour model does not support NaN or infinity values in the input dataset.");
  • stable/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkClassification.cs

    r15584 r15788  
    115115    public NeuralNetworkClassification()
    116116      : base() {
    117       var validHiddenLayerValues = new ItemSet<IntValue>(new IntValue[] { 
    118         (IntValue)new IntValue(0).AsReadOnly(), 
    119         (IntValue)new IntValue(1).AsReadOnly(), 
     117      var validHiddenLayerValues = new ItemSet<IntValue>(new IntValue[] {
     118        (IntValue)new IntValue(0).AsReadOnly(),
     119        (IntValue)new IntValue(1).AsReadOnly(),
    120120        (IntValue)new IntValue(2).AsReadOnly() });
    121121      var selectedHiddenLayerValue = (from v in validHiddenLayerValues
     
    185185      IEnumerable<int> rows = problemData.TrainingIndices;
    186186      double[,] inputMatrix = dataset.ToArray(allowedInputVariables.Concat(new string[] { targetVariable }), rows);
    187       if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x)))
     187      if (inputMatrix.ContainsNanOrInfinity())
    188188        throw new NotSupportedException("Neural network classification does not support NaN or infinity values in the input dataset.");
    189189
  • stable/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkEnsembleClassification.cs

    r15584 r15788  
    171171      IEnumerable<int> rows = problemData.TrainingIndices;
    172172      double[,] inputMatrix = dataset.ToArray(allowedInputVariables.Concat(new string[] { targetVariable }), rows);
    173       if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x)))
     173      if (inputMatrix.ContainsNanOrInfinity())
    174174        throw new NotSupportedException("Neural network ensemble classification does not support NaN or infinity values in the input dataset.");
    175175
  • stable/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkEnsembleRegression.cs

    r15584 r15788  
    125125    public NeuralNetworkEnsembleRegression()
    126126      : base() {
    127       var validHiddenLayerValues = new ItemSet<IntValue>(new IntValue[] { 
    128         (IntValue)new IntValue(0).AsReadOnly(), 
    129         (IntValue)new IntValue(1).AsReadOnly(), 
     127      var validHiddenLayerValues = new ItemSet<IntValue>(new IntValue[] {
     128        (IntValue)new IntValue(0).AsReadOnly(),
     129        (IntValue)new IntValue(1).AsReadOnly(),
    130130        (IntValue)new IntValue(2).AsReadOnly() });
    131131      var selectedHiddenLayerValue = (from v in validHiddenLayerValues
     
    170170      IEnumerable<int> rows = problemData.TrainingIndices;
    171171      double[,] inputMatrix = dataset.ToArray(allowedInputVariables.Concat(new string[] { targetVariable }), rows);
    172       if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x)))
     172      if (inputMatrix.ContainsNanOrInfinity())
    173173        throw new NotSupportedException("Neural network ensemble regression does not support NaN or infinity values in the input dataset.");
    174174
  • stable/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkRegression.cs

    r15584 r15788  
    115115    public NeuralNetworkRegression()
    116116      : base() {
    117       var validHiddenLayerValues = new ItemSet<IntValue>(new IntValue[] { 
    118         (IntValue)new IntValue(0).AsReadOnly(), 
    119         (IntValue)new IntValue(1).AsReadOnly(), 
     117      var validHiddenLayerValues = new ItemSet<IntValue>(new IntValue[] {
     118        (IntValue)new IntValue(0).AsReadOnly(),
     119        (IntValue)new IntValue(1).AsReadOnly(),
    120120        (IntValue)new IntValue(2).AsReadOnly() });
    121121      var selectedHiddenLayerValue = (from v in validHiddenLayerValues
     
    186186      IEnumerable<int> rows = problemData.TrainingIndices;
    187187      double[,] inputMatrix = dataset.ToArray(allowedInputVariables.Concat(new string[] { targetVariable }), rows);
    188       if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x)))
     188      if (inputMatrix.ContainsNanOrInfinity())
    189189        throw new NotSupportedException("Neural network regression does not support NaN or infinity values in the input dataset.");
    190190
  • stable/HeuristicLab.Algorithms.DataAnalysis/3.4/RandomForest/RandomForestModel.cs

    r15584 r15788  
    310310    public static RandomForestModel CreateClassificationModel(IClassificationProblemData problemData, int nTrees, double r, double m, int seed,
    311311      out double rmsError, out double outOfBagRmsError, out double relClassificationError, out double outOfBagRelClassificationError) {
    312       return CreateClassificationModel(problemData, problemData.TrainingIndices, nTrees, r, m, seed, 
     312      return CreateClassificationModel(problemData, problemData.TrainingIndices, nTrees, r, m, seed,
    313313        out rmsError, out outOfBagRmsError, out relClassificationError, out outOfBagRelClassificationError);
    314314    }
     
    370370
    371371    private static void AssertInputMatrix(double[,] inputMatrix) {
    372       if (inputMatrix.Cast<double>().Any(x => Double.IsNaN(x) || Double.IsInfinity(x)))
     372      if (inputMatrix.ContainsNanOrInfinity())
    373373        throw new NotSupportedException("Random forest modeling does not support NaN or infinity values in the input dataset.");
    374374    }
  • stable/HeuristicLab.Algorithms.DataAnalysis/3.4/TimeSeries/AutoregressiveModeling.cs

    r15584 r15788  
    2626using HeuristicLab.Core;
    2727using HeuristicLab.Data;
    28 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2928using HeuristicLab.Optimization;
    3029using HeuristicLab.Parameters;
     
    9796        inputMatrix[i, timeOffset] = targetValues[i + problemData.TrainingPartition.Start];
    9897
    99       if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x)))
     98      if (inputMatrix.ContainsNanOrInfinity())
    10099        throw new NotSupportedException("Linear regression does not support NaN or infinity values in the input dataset.");
    101100
  • stable/HeuristicLab.Algorithms.DataAnalysis/3.4/kMeans/KMeansClustering.cs

    r15584 r15788  
    9191      int[] xyc;
    9292      double[,] inputMatrix = dataset.ToArray(allowedInputVariables, rows);
    93       if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x)))
     93      if (inputMatrix.ContainsNanOrInfinity())
    9494        throw new NotSupportedException("k-Means clustering does not support NaN or infinity values in the input dataset.");
    9595
Note: See TracChangeset for help on using the changeset viewer.