Index: /branches/2904_CalculateImpacts/3.4/Implementation/Classification/ClassificationSolutionVariableImpactsCalculator.cs
===================================================================
--- /branches/2904_CalculateImpacts/3.4/Implementation/Classification/ClassificationSolutionVariableImpactsCalculator.cs	(revision 16040)
+++ /branches/2904_CalculateImpacts/3.4/Implementation/Classification/ClassificationSolutionVariableImpactsCalculator.cs	(revision 16041)
@@ -131,5 +131,5 @@
      ReplacementMethodEnum replacementMethod = ReplacementMethodEnum.Shuffle,
      FactorReplacementMethodEnum factorReplacementMethod = FactorReplacementMethodEnum.Best) {
-      //Calculate original quality-values (via calculator, default is Accuracy)
+      //Calculate original quality-values (via calculator, default is Accuracy)    
       OnlineCalculatorError error;
       IEnumerable<double> targetValuesPartition = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, rows);
@@ -144,5 +144,9 @@
 
       foreach (var inputVariable in allowedInputVariables) {
-        impacts[inputVariable] = CalculateImpact(inputVariable, model, modifiableDataset, rows, targetValuesPartition, originalCalculatorValue, replacementMethod, factorReplacementMethod);
+        if (model.VariablesUsedForPrediction.Contains(inputVariable)) {
+          impacts[inputVariable] = CalculateImpact(inputVariable, model, modifiableDataset, rows, targetValuesPartition, originalCalculatorValue, replacementMethod, factorReplacementMethod);
+        } else {
+          impacts[inputVariable] = 0;
+        }
       }
 
Index: /branches/2904_CalculateImpacts/3.4/Implementation/Regression/RegressionSolutionVariableImpactsCalculator.cs
===================================================================
--- /branches/2904_CalculateImpacts/3.4/Implementation/Regression/RegressionSolutionVariableImpactsCalculator.cs	(revision 16040)
+++ /branches/2904_CalculateImpacts/3.4/Implementation/Regression/RegressionSolutionVariableImpactsCalculator.cs	(revision 16041)
@@ -110,16 +110,7 @@
       FactorReplacementMethodEnum factorReplacementMethod = FactorReplacementMethodEnum.Best,
       DataPartitionEnum dataPartition = DataPartitionEnum.Training) {
-      return CalculateImpacts(solution.Model, solution.ProblemData, solution.EstimatedValues, replacementMethod, factorReplacementMethod, dataPartition);
-    }
-
-    public static IEnumerable<Tuple<string, double>> CalculateImpacts(
-      IRegressionModel model,
-      IRegressionProblemData problemData,
-      IEnumerable<double> estimatedValues,
-      ReplacementMethodEnum replacementMethod = ReplacementMethodEnum.Shuffle,
-      FactorReplacementMethodEnum factorReplacementMethod = FactorReplacementMethodEnum.Best,
-      DataPartitionEnum dataPartition = DataPartitionEnum.Training) {
-      IEnumerable<int> rows = GetPartitionRows(dataPartition, problemData);
-      return CalculateImpacts(model, problemData, estimatedValues, rows, replacementMethod, factorReplacementMethod);
+      IEnumerable<int> rows = (GetPartitionRows(dataPartition, solution.ProblemData));
+      IEnumerable<double> estimatedValues = solution.GetEstimatedValues(rows);
+      return CalculateImpacts(solution.Model, solution.ProblemData, estimatedValues, rows, replacementMethod, factorReplacementMethod);
     }
 
@@ -133,7 +124,6 @@
       //Calculate original quality-values (via calculator, default is R²)
       OnlineCalculatorError error;
-      IEnumerable<double> targetValuesPartition = rows.Select(v => problemData.TargetVariableValues.ElementAt(v));
-      IEnumerable<double> estimatedValuesPartition = rows.Select(v => estimatedValues.ElementAt(v));
-      var originalCalculatorValue = CalculateVariableImpact(targetValuesPartition, estimatedValuesPartition, out error);
+      IEnumerable<double> targetValues = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, rows);
+      var originalCalculatorValue = CalculateVariableImpact(targetValues, estimatedValues, out error);
       if (error != OnlineCalculatorError.None) throw new InvalidOperationException("Error during calculation.");
 
@@ -143,6 +133,11 @@
       var modifiableDataset = ((Dataset)(problemData.Dataset).Clone()).ToModifiable();
 
+
       foreach (var inputVariable in allowedInputVariables) {
-        impacts[inputVariable] = CalculateImpact(inputVariable, model, modifiableDataset, rows, targetValuesPartition, originalCalculatorValue, replacementMethod, factorReplacementMethod);
+        if (model.VariablesUsedForPrediction.Contains(inputVariable)) {
+          impacts[inputVariable] = CalculateImpact(inputVariable, model, modifiableDataset, rows, targetValues, originalCalculatorValue, replacementMethod, factorReplacementMethod);
+        } else {
+          impacts[inputVariable] = 0;
+        }
       }
 
Index: /branches/2904_CalculateImpacts/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationSolutionVariableImpactsView.cs
===================================================================
--- /branches/2904_CalculateImpacts/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationSolutionVariableImpactsView.cs	(revision 16040)
+++ /branches/2904_CalculateImpacts/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationSolutionVariableImpactsView.cs	(revision 16041)
@@ -168,5 +168,5 @@
       OnlineCalculatorError error;
       IEnumerable<double> targetValuesPartition = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, rows);
-      IEnumerable<double> estimatedValuesPartition = rows.Select(v => estimatedValues.ElementAt(v));
+      IEnumerable<double> estimatedValuesPartition = Content.GetEstimatedClassValues(rows);
       var originalCalculatorValue = ClassificationSolutionVariableImpactsCalculator.CalculateVariableImpact(targetValuesPartition, estimatedValuesPartition, out error);
       if (error != OnlineCalculatorError.None) throw new InvalidOperationException("Error during calculation.");
@@ -177,5 +177,9 @@
         progress.Status = string.Format("Calculating impact for variable {0} ({1} of {2})", variableName, i, count);
 
-        double impact = ClassificationSolutionVariableImpactsCalculator.CalculateImpact(variableName, model, modifiableDataset, rows, targetValuesPartition, originalCalculatorValue, replMethod, factorReplMethod);
+        double impact = 0;
+        //If the variable isn't used for prediction, it has zero impact.
+        if (model.VariablesUsedForPrediction.Contains(variableName)) {
+          impact = ClassificationSolutionVariableImpactsCalculator.CalculateImpact(variableName, model, modifiableDataset, rows, targetValuesPartition, originalCalculatorValue, replMethod, factorReplMethod);
+        }
         impacts.Add(new Tuple<string, double>(variableName, impact));
       }
Index: /branches/2904_CalculateImpacts/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionVariableImpactsView.cs
===================================================================
--- /branches/2904_CalculateImpacts/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionVariableImpactsView.cs	(revision 16040)
+++ /branches/2904_CalculateImpacts/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionVariableImpactsView.cs	(revision 16041)
@@ -165,6 +165,7 @@
       //Calculate original quality-values (via calculator, default is R²)
       OnlineCalculatorError error;
-      IEnumerable<double> targetValuesPartition = rows.Select(v => problemData.TargetVariableValues.ElementAt(v));
-      IEnumerable<double> estimatedValuesPartition = rows.Select(v => estimatedValues.ElementAt(v));
+      IEnumerable<double> targetValuesPartition = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, rows);
+      IEnumerable<double> estimatedValuesPartition = Content.GetEstimatedValues(rows);
+
       var originalCalculatorValue = RegressionSolutionVariableImpactsCalculator.CalculateVariableImpact(targetValuesPartition, estimatedValuesPartition, out error);
       if (error != OnlineCalculatorError.None) throw new InvalidOperationException("Error during calculation.");
@@ -175,5 +176,9 @@
         progress.Status = string.Format("Calculating impact for variable {0} ({1} of {2})", variableName, i, count);
 
-        double impact = RegressionSolutionVariableImpactsCalculator.CalculateImpact(variableName, model, modifiableDataset, rows, targetValuesPartition, originalCalculatorValue, replMethod, factorReplMethod);
+        double impact = 0;
+        //If the variable isn't used for prediction, it has zero impact.
+        if (model.VariablesUsedForPrediction.Contains(variableName)) {
+          impact = RegressionSolutionVariableImpactsCalculator.CalculateImpact(variableName, model, modifiableDataset, rows, targetValuesPartition, originalCalculatorValue, replMethod, factorReplMethod);
+        }
         impacts.Add(new Tuple<string, double>(variableName, impact));
       }
