Index: /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/DoubleArrayExtensions.cs
===================================================================
--- /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/DoubleArrayExtensions.cs	(revision 16158)
+++ /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/DoubleArrayExtensions.cs	(revision 16158)
@@ -0,0 +1,12 @@
+﻿namespace HeuristicLab.Algorithms.DataAnalysis {
+  public static class DoubleArrayExtensions {
+    public static bool ContainsNanOrInfinity(this double[,] array) {
+      foreach (var entry in array) {
+        if (double.IsNaN(entry) || double.IsInfinity(entry)) {
+          return true;
+        }
+      }
+      return false;
+    }
+  }
+}
Index: /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/GBM/GradientBoostingRegressionAlgorithm.cs
===================================================================
--- /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/GBM/GradientBoostingRegressionAlgorithm.cs	(revision 16157)
+++ /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/GBM/GradientBoostingRegressionAlgorithm.cs	(revision 16158)
@@ -210,5 +210,5 @@
     protected override void Run(CancellationToken cancellationToken) {
       // Set up the algorithm
-      if (SetSeedRandomly) Seed = new System.Random().Next();
+      if (SetSeedRandomly) Seed = RandomSeedGenerator.GetSeed();
       var rand = new MersenneTwister((uint)Seed);
 
@@ -258,5 +258,5 @@
 
           modifiableDataset.RemoveVariable(targetVarName);
-          modifiableDataset.AddVariable(targetVarName, curY.Concat(curYTest));
+          modifiableDataset.AddVariable(targetVarName, curY.Concat(curYTest).ToList());
 
           SampleTrainingData(rand, modifiableDataset, rRows, problemData.Dataset, curY, problemData.TargetVariable, problemData.TrainingIndices); // all training indices from the original problem data are allowed 
Index: /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/GradientBoostedTreesAlgorithm.cs
===================================================================
--- /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/GradientBoostedTreesAlgorithm.cs	(revision 16157)
+++ /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/GradientBoostedTreesAlgorithm.cs	(revision 16158)
@@ -223,5 +223,5 @@
     protected override void Run(CancellationToken cancellationToken) {
       // Set up the algorithm
-      if (SetSeedRandomly) Seed = new System.Random().Next();
+      if (SetSeedRandomly) Seed = Random.RandomSeedGenerator.GetSeed();
 
       // Set up the results display
Index: /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/HeuristicLab.Algorithms.DataAnalysis-3.4.csproj
===================================================================
--- /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/HeuristicLab.Algorithms.DataAnalysis-3.4.csproj	(revision 16157)
+++ /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/HeuristicLab.Algorithms.DataAnalysis-3.4.csproj	(revision 16158)
@@ -223,4 +223,5 @@
       <SubType>Code</SubType>
     </Compile>
+    <Compile Include="DoubleArrayExtensions.cs" />
     <Compile Include="FixedDataAnalysisAlgorithm.cs" />
     <Compile Include="GaussianProcess\CovarianceFunctions\CovarianceSpectralMixture.cs" />
Index: /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/LinearDiscriminantAnalysis.cs
===================================================================
--- /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/LinearDiscriminantAnalysis.cs	(revision 16157)
+++ /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/LinearDiscriminantAnalysis.cs	(revision 16158)
@@ -80,5 +80,5 @@
       inputMatrix = factorMatrix.HorzCat(inputMatrix);
 
-      if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x)))
+      if (inputMatrix.ContainsNanOrInfinity())
         throw new NotSupportedException("Linear discriminant analysis does not support NaN or infinity values in the input dataset.");
 
Index: /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/LinearRegression.cs
===================================================================
--- /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/LinearRegression.cs	(revision 16157)
+++ /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/LinearRegression.cs	(revision 16158)
@@ -80,5 +80,5 @@
       var inputMatrix = binaryMatrix.HorzCat(doubleVarMatrix);
 
-      if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x)))
+      if (inputMatrix.ContainsNanOrInfinity())
         throw new NotSupportedException("Linear regression does not support NaN or infinity values in the input dataset.");
 
@@ -100,7 +100,7 @@
       int nVarCoeff = doubleVariables.Count();
       var tree = LinearModelToTreeConverter.CreateTree(factorVariables, coefficients.Take(nFactorCoeff).ToArray(),
-        doubleVariables.ToArray(), coefficients.Skip(nFactorCoeff).Take(nVarCoeff).ToArray(), 
+        doubleVariables.ToArray(), coefficients.Skip(nFactorCoeff).Take(nVarCoeff).ToArray(),
         @const: coefficients[nFeatures]);
-      
+
       SymbolicRegressionSolution solution = new SymbolicRegressionSolution(new SymbolicRegressionModel(problemData.TargetVariable, tree, new SymbolicDataAnalysisExpressionTreeLinearInterpreter()), (IRegressionProblemData)problemData.Clone());
       solution.Model.Name = "Linear Regression Model";
Index: /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/MultinomialLogitClassification.cs
===================================================================
--- /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/MultinomialLogitClassification.cs	(revision 16157)
+++ /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/MultinomialLogitClassification.cs	(revision 16158)
@@ -78,5 +78,5 @@
       inputMatrix = factorMatrix.HorzCat(inputMatrix);
 
-      if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x)))
+      if (inputMatrix.ContainsNanOrInfinity())
         throw new NotSupportedException("Multinomial logit classification does not support NaN or infinity values in the input dataset.");
 
Index: /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/Nca/NcaModel.cs
===================================================================
--- /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/Nca/NcaModel.cs	(revision 16157)
+++ /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/Nca/NcaModel.cs	(revision 16158)
@@ -65,5 +65,5 @@
 
       var ds = ReduceDataset(dataset, rows);
-      nnModel = new NearestNeighbourModel(ds, Enumerable.Range(0, ds.Rows), k, ds.VariableNames.Last(), ds.VariableNames.Take(transformationMatrix.GetLength(1)), classValues);
+      nnModel = new NearestNeighbourModel(ds, Enumerable.Range(0, ds.Rows), k, ds.VariableNames.Last(), ds.VariableNames.Take(transformationMatrix.GetLength(1)), classValues: classValues);
     }
 
Index: /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/NearestNeighbour/NearestNeighbourModel.cs
===================================================================
--- /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/NearestNeighbour/NearestNeighbourModel.cs	(revision 16157)
+++ /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/NearestNeighbour/NearestNeighbourModel.cs	(revision 16158)
@@ -130,5 +130,8 @@
           // automatic determination of weights (all features should have variance = 1)
           this.weights = this.allowedInputVariables
-            .Select(name => 1.0 / dataset.GetDoubleValues(name, rows).StandardDeviationPop())
+            .Select(name => {
+              var pop = dataset.GetDoubleValues(name, rows).StandardDeviationPop();
+              return  pop.IsAlmost(0) ? 1.0 : 1.0/pop;
+            })
             .Concat(new double[] { 1.0 }) // no scaling for target variable
             .ToArray();
@@ -142,5 +145,5 @@
       }
 
-      if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x)))
+      if (inputMatrix.ContainsNanOrInfinity())
         throw new NotSupportedException(
           "Nearest neighbour model does not support NaN or infinity values in the input dataset.");
Index: /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkClassification.cs
===================================================================
--- /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkClassification.cs	(revision 16157)
+++ /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkClassification.cs	(revision 16158)
@@ -115,7 +115,7 @@
     public NeuralNetworkClassification()
       : base() {
-      var validHiddenLayerValues = new ItemSet<IntValue>(new IntValue[] { 
-        (IntValue)new IntValue(0).AsReadOnly(), 
-        (IntValue)new IntValue(1).AsReadOnly(), 
+      var validHiddenLayerValues = new ItemSet<IntValue>(new IntValue[] {
+        (IntValue)new IntValue(0).AsReadOnly(),
+        (IntValue)new IntValue(1).AsReadOnly(),
         (IntValue)new IntValue(2).AsReadOnly() });
       var selectedHiddenLayerValue = (from v in validHiddenLayerValues
@@ -185,5 +185,5 @@
       IEnumerable<int> rows = problemData.TrainingIndices;
       double[,] inputMatrix = dataset.ToArray(allowedInputVariables.Concat(new string[] { targetVariable }), rows);
-      if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x)))
+      if (inputMatrix.ContainsNanOrInfinity())
         throw new NotSupportedException("Neural network classification does not support NaN or infinity values in the input dataset.");
 
Index: /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkEnsembleClassification.cs
===================================================================
--- /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkEnsembleClassification.cs	(revision 16157)
+++ /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkEnsembleClassification.cs	(revision 16158)
@@ -171,5 +171,5 @@
       IEnumerable<int> rows = problemData.TrainingIndices;
       double[,] inputMatrix = dataset.ToArray(allowedInputVariables.Concat(new string[] { targetVariable }), rows);
-      if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x)))
+      if (inputMatrix.ContainsNanOrInfinity())
         throw new NotSupportedException("Neural network ensemble classification does not support NaN or infinity values in the input dataset.");
 
Index: /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkEnsembleModel.cs
===================================================================
--- /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkEnsembleModel.cs	(revision 16157)
+++ /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkEnsembleModel.cs	(revision 16158)
@@ -102,5 +102,8 @@
           x[column] = inputData[row, column];
         }
-        alglib.mlpeprocess(mlpEnsemble, x, ref y);
+        // mlpeprocess writes data in mlpEnsemble and is therefore not thread-safe
+        lock (mlpEnsemble) {
+          alglib.mlpeprocess(mlpEnsemble, x, ref y);
+        }
         yield return y[0];
       }
@@ -119,5 +122,8 @@
           x[column] = inputData[row, column];
         }
-        alglib.mlpeprocess(mlpEnsemble, x, ref y);
+        // mlpeprocess writes data in mlpEnsemble and is therefore not thread-safe
+        lock (mlpEnsemble) {
+          alglib.mlpeprocess(mlpEnsemble, x, ref y);
+        }
         // find class for with the largest probability value
         int maxProbClassIndex = 0;
Index: /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkEnsembleRegression.cs
===================================================================
--- /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkEnsembleRegression.cs	(revision 16157)
+++ /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkEnsembleRegression.cs	(revision 16158)
@@ -125,7 +125,7 @@
     public NeuralNetworkEnsembleRegression()
       : base() {
-      var validHiddenLayerValues = new ItemSet<IntValue>(new IntValue[] { 
-        (IntValue)new IntValue(0).AsReadOnly(), 
-        (IntValue)new IntValue(1).AsReadOnly(), 
+      var validHiddenLayerValues = new ItemSet<IntValue>(new IntValue[] {
+        (IntValue)new IntValue(0).AsReadOnly(),
+        (IntValue)new IntValue(1).AsReadOnly(),
         (IntValue)new IntValue(2).AsReadOnly() });
       var selectedHiddenLayerValue = (from v in validHiddenLayerValues
@@ -170,5 +170,5 @@
       IEnumerable<int> rows = problemData.TrainingIndices;
       double[,] inputMatrix = dataset.ToArray(allowedInputVariables.Concat(new string[] { targetVariable }), rows);
-      if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x)))
+      if (inputMatrix.ContainsNanOrInfinity())
         throw new NotSupportedException("Neural network ensemble regression does not support NaN or infinity values in the input dataset.");
 
Index: /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkModel.cs
===================================================================
--- /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkModel.cs	(revision 16157)
+++ /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkModel.cs	(revision 16158)
@@ -106,5 +106,8 @@
           x[column] = inputData[row, column];
         }
-        alglib.mlpprocess(multiLayerPerceptron, x, ref y);
+        // NOTE: mlpprocess changes data in multiLayerPerceptron and is therefore not thread-save!
+        lock (multiLayerPerceptron) {
+          alglib.mlpprocess(multiLayerPerceptron, x, ref y);
+        }
         yield return y[0];
       }
@@ -112,5 +115,5 @@
 
     public override IEnumerable<double> GetEstimatedClassValues(IDataset dataset, IEnumerable<int> rows) {
-      double[,] inputData = dataset.ToArray( allowedInputVariables, rows);
+      double[,] inputData = dataset.ToArray(allowedInputVariables, rows);
 
       int n = inputData.GetLength(0);
@@ -123,5 +126,8 @@
           x[column] = inputData[row, column];
         }
-        alglib.mlpprocess(multiLayerPerceptron, x, ref y);
+        // NOTE: mlpprocess changes data in multiLayerPerceptron and is therefore not thread-save!
+        lock (multiLayerPerceptron) {
+          alglib.mlpprocess(multiLayerPerceptron, x, ref y);
+        }
         // find class for with the largest probability value
         int maxProbClassIndex = 0;
Index: /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkRegression.cs
===================================================================
--- /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkRegression.cs	(revision 16157)
+++ /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkRegression.cs	(revision 16158)
@@ -115,7 +115,7 @@
     public NeuralNetworkRegression()
       : base() {
-      var validHiddenLayerValues = new ItemSet<IntValue>(new IntValue[] { 
-        (IntValue)new IntValue(0).AsReadOnly(), 
-        (IntValue)new IntValue(1).AsReadOnly(), 
+      var validHiddenLayerValues = new ItemSet<IntValue>(new IntValue[] {
+        (IntValue)new IntValue(0).AsReadOnly(),
+        (IntValue)new IntValue(1).AsReadOnly(),
         (IntValue)new IntValue(2).AsReadOnly() });
       var selectedHiddenLayerValue = (from v in validHiddenLayerValues
@@ -186,5 +186,5 @@
       IEnumerable<int> rows = problemData.TrainingIndices;
       double[,] inputMatrix = dataset.ToArray(allowedInputVariables.Concat(new string[] { targetVariable }), rows);
-      if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x)))
+      if (inputMatrix.ContainsNanOrInfinity())
         throw new NotSupportedException("Neural network regression does not support NaN or infinity values in the input dataset.");
 
Index: /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/NonlinearRegression/NonlinearRegression.cs
===================================================================
--- /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/NonlinearRegression/NonlinearRegression.cs	(revision 16157)
+++ /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/NonlinearRegression/NonlinearRegression.cs	(revision 16158)
@@ -186,5 +186,5 @@
         qualityTable.Rows.Add(testRMSERow);
         Results.Add(new Result(qualityTable.Name, qualityTable.Name + " for all restarts", qualityTable));
-        if (SetSeedRandomly) Seed = (new System.Random()).Next();
+        if (SetSeedRandomly) Seed = RandomSeedGenerator.GetSeed();
         var rand = new MersenneTwister((uint)Seed);
         bestSolution = CreateRegressionSolution(Problem.ProblemData, ModelStructure, Iterations, ApplyLinearScaling, rand);
Index: anches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/Plugin.cs
===================================================================
--- /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/Plugin.cs	(revision 16157)
+++ 	(revision )
@@ -1,56 +1,0 @@
-#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
- */
-#endregion
-
-using HeuristicLab.PluginInfrastructure;
-
-namespace HeuristicLab.Algorithms.DataAnalysis {
-  /// <summary>
-  /// Plugin class for HeuristicLab.Algorithms.DataAnalysis plugin.
-  /// </summary>
-  [Plugin("HeuristicLab.Algorithms.DataAnalysis", "Provides wrappers for data analysis algorithms implemented in external libraries (linear regression, linear discriminant analysis, k-means clustering, support vector classification and regression)", "3.4.11.15679")]
-  [PluginFile("HeuristicLab.Algorithms.DataAnalysis-3.4.dll", PluginFileType.Assembly)]
-  [PluginDependency("HeuristicLab.ALGLIB", "3.7.0")]
-  [PluginDependency("HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm", "3.3")] // for GBM
-  [PluginDependency("HeuristicLab.Algorithms.GradientDescent", "3.3")]
-  [PluginDependency("HeuristicLab.Analysis", "3.3")]
-  [PluginDependency("HeuristicLab.Collections", "3.3")]
-  [PluginDependency("HeuristicLab.Common", "3.3")]
-  [PluginDependency("HeuristicLab.Common.Resources", "3.3")]
-  [PluginDependency("HeuristicLab.Core", "3.3")]
-  [PluginDependency("HeuristicLab.Data", "3.3")]
-  [PluginDependency("HeuristicLab.Encodings.RealVectorEncoding", "3.3")]
-  [PluginDependency("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding", "3.4")]
-  [PluginDependency("HeuristicLab.Operators", "3.3")]
-  [PluginDependency("HeuristicLab.Optimization", "3.3")]
-  [PluginDependency("HeuristicLab.Parameters", "3.3")]
-  [PluginDependency("HeuristicLab.Persistence", "3.3")]
-  [PluginDependency("HeuristicLab.Problems.DataAnalysis", "3.4")]
-  [PluginDependency("HeuristicLab.Problems.DataAnalysis.Symbolic", "3.4")]
-  [PluginDependency("HeuristicLab.Problems.DataAnalysis.Symbolic.Classification", "3.4")]
-  [PluginDependency("HeuristicLab.Problems.DataAnalysis.Symbolic.Regression", "3.4")]
-  [PluginDependency("HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis", "3.4")]
-  [PluginDependency("HeuristicLab.Problems.Instances", "3.3")]
-  [PluginDependency("HeuristicLab.LibSVM", "3.12")]
-  [PluginDependency("HeuristicLab.Random", "3.3")]
-  [PluginDependency("HeuristicLab.Selection", "3.3")]
-  public class HeuristicLabAlgorithmsDataAnalysisPlugin : PluginBase {
-  }
-}
Index: /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/RandomForest/RandomForestClassification.cs
===================================================================
--- /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/RandomForest/RandomForestClassification.cs	(revision 16157)
+++ /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/RandomForest/RandomForestClassification.cs	(revision 16158)
@@ -135,5 +135,5 @@
     protected override void Run(CancellationToken cancellationToken) {
       double rmsError, relClassificationError, outOfBagRmsError, outOfBagRelClassificationError;
-      if (SetSeedRandomly) Seed = new System.Random().Next();
+      if (SetSeedRandomly) Seed = Random.RandomSeedGenerator.GetSeed();
 
       var model = CreateRandomForestClassificationModel(Problem.ProblemData, NumberOfTrees, R, M, Seed, out rmsError, out relClassificationError, out outOfBagRmsError, out outOfBagRelClassificationError);
Index: /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/RandomForest/RandomForestModel.cs
===================================================================
--- /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/RandomForest/RandomForestModel.cs	(revision 16157)
+++ /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/RandomForest/RandomForestModel.cs	(revision 16158)
@@ -310,5 +310,5 @@
     public static RandomForestModel CreateClassificationModel(IClassificationProblemData problemData, int nTrees, double r, double m, int seed,
       out double rmsError, out double outOfBagRmsError, out double relClassificationError, out double outOfBagRelClassificationError) {
-      return CreateClassificationModel(problemData, problemData.TrainingIndices, nTrees, r, m, seed, 
+      return CreateClassificationModel(problemData, problemData.TrainingIndices, nTrees, r, m, seed,
         out rmsError, out outOfBagRmsError, out relClassificationError, out outOfBagRelClassificationError);
     }
@@ -370,5 +370,5 @@
 
     private static void AssertInputMatrix(double[,] inputMatrix) {
-      if (inputMatrix.Cast<double>().Any(x => Double.IsNaN(x) || Double.IsInfinity(x)))
+      if (inputMatrix.ContainsNanOrInfinity())
         throw new NotSupportedException("Random forest modeling does not support NaN or infinity values in the input dataset.");
     }
Index: /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/RandomForest/RandomForestRegression.cs
===================================================================
--- /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/RandomForest/RandomForestRegression.cs	(revision 16157)
+++ /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/RandomForest/RandomForestRegression.cs	(revision 16158)
@@ -134,5 +134,5 @@
     protected override void Run(CancellationToken cancellationToken) {
       double rmsError, avgRelError, outOfBagRmsError, outOfBagAvgRelError;
-      if (SetSeedRandomly) Seed = new System.Random().Next();
+      if (SetSeedRandomly) Seed = Random.RandomSeedGenerator.GetSeed();
       var model = CreateRandomForestRegressionModel(Problem.ProblemData, NumberOfTrees, R, M, Seed,
         out rmsError, out avgRelError, out outOfBagRmsError, out outOfBagAvgRelError);
Index: /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorMachineModel.cs
===================================================================
--- /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorMachineModel.cs	(revision 16157)
+++ /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorMachineModel.cs	(revision 16158)
@@ -155,5 +155,5 @@
     private IEnumerable<double> GetEstimatedValuesHelper(IDataset dataset, IEnumerable<int> rows) {
       // calculate predictions for the currently requested rows
-      svm_problem problem = SupportVectorMachineUtil.CreateSvmProblem(dataset, TargetVariable, allowedInputVariables, rows);
+      svm_problem problem = SupportVectorMachineUtil.CreateSvmProblem(dataset, allowedInputVariables, rows);
       svm_problem scaledProblem = rangeTransform.Scale(problem);
 
Index: /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorMachineUtil.cs
===================================================================
--- /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorMachineUtil.cs	(revision 16157)
+++ /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorMachineUtil.cs	(revision 16158)
@@ -35,12 +35,21 @@
   public class SupportVectorMachineUtil {
     /// <summary>
-    /// Transforms <paramref name="problemData"/> into a data structure as needed by libSVM.
-    /// </summary>
-    /// <param name="problemData">The problem data to transform</param>
+    /// Transforms <paramref name="dataset"/> into a data structure as needed by libSVM.
+    /// </summary>
+    /// <param name="dataset">The source dataset</param>
+    /// <param name="targetVariable">The target variable</param>
+    /// <param name="inputVariables">The selected input variables to include in the svm_problem.</param>
     /// <param name="rowIndices">The rows of the dataset that should be contained in the resulting SVM-problem</param>
     /// <returns>A problem data type that can be used to train a support vector machine.</returns>
     public static svm_problem CreateSvmProblem(IDataset dataset, string targetVariable, IEnumerable<string> inputVariables, IEnumerable<int> rowIndices) {
-      double[] targetVector = dataset.GetDoubleValues(targetVariable, rowIndices).ToArray();
-      svm_node[][] nodes = new svm_node[targetVector.Length][];
+      double[] targetVector ;
+      var nRows = rowIndices.Count();
+      if (string.IsNullOrEmpty(targetVariable)) {
+        // if the target variable is not set (e.g. for prediction of a trained model) we just use a zero vector
+        targetVector = new double[nRows];
+      } else {
+        targetVector = dataset.GetDoubleValues(targetVariable, rowIndices).ToArray();
+      }
+      svm_node[][] nodes = new svm_node[nRows][];
       int maxNodeIndex = 0;
       int svmProblemRowIndex = 0;
@@ -66,4 +75,16 @@
 
     /// <summary>
+    /// Transforms <paramref name="dataset"/> into a data structure as needed by libSVM for prediction.
+    /// </summary>
+    /// <param name="dataset">The problem data to transform</param>
+    /// <param name="inputVariables">The selected input variables to include in the svm_problem.</param>
+    /// <param name="rowIndices">The rows of the dataset that should be contained in the resulting SVM-problem</param>
+    /// <returns>A problem data type that can be used for prediction with a trained support vector machine.</returns>
+    public static svm_problem CreateSvmProblem(IDataset dataset, IEnumerable<string> inputVariables, IEnumerable<int> rowIndices) {
+      // for prediction we don't need a target variable
+      return CreateSvmProblem(dataset, string.Empty, inputVariables, rowIndices);
+    }
+
+    /// <summary>
     /// Instantiate and return a svm_parameter object with default values.
     /// </summary>
Index: /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/TSNE/TSNEAlgorithm.cs
===================================================================
--- /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/TSNE/TSNEAlgorithm.cs	(revision 16157)
+++ /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/TSNE/TSNEAlgorithm.cs	(revision 16158)
@@ -275,5 +275,5 @@
       if (wdist != null) wdist.Initialize(problemData);
       if (state == null) {
-        if (SetSeedRandomly) Seed = new System.Random().Next();
+        if (SetSeedRandomly) Seed = RandomSeedGenerator.GetSeed();
         var random = new MersenneTwister((uint)Seed);
         var dataset = problemData.Dataset;
Index: /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/TimeSeries/AutoregressiveModeling.cs
===================================================================
--- /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/TimeSeries/AutoregressiveModeling.cs	(revision 16157)
+++ /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/TimeSeries/AutoregressiveModeling.cs	(revision 16158)
@@ -26,5 +26,4 @@
 using HeuristicLab.Core;
 using HeuristicLab.Data;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
@@ -97,5 +96,5 @@
         inputMatrix[i, timeOffset] = targetValues[i + problemData.TrainingPartition.Start];
 
-      if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x)))
+      if (inputMatrix.ContainsNanOrInfinity())
         throw new NotSupportedException("Linear regression does not support NaN or infinity values in the input dataset.");
 
Index: /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/kMeans/KMeansClustering.cs
===================================================================
--- /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/kMeans/KMeansClustering.cs	(revision 16157)
+++ /branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/kMeans/KMeansClustering.cs	(revision 16158)
@@ -91,5 +91,5 @@
       int[] xyc;
       double[,] inputMatrix = dataset.ToArray(allowedInputVariables, rows);
-      if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x)))
+      if (inputMatrix.ContainsNanOrInfinity())
         throw new NotSupportedException("k-Means clustering does not support NaN or infinity values in the input dataset.");
 
