Changeset 16016
- Timestamp:
- 07/25/18 18:19:51 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2904_CalculateImpacts/3.4/Implementation/Regression/RegressionSolutionVariableImpactsCalculator.cs
r16002 r16016 161 161 162 162 int curIdx = 0; 163 int count = allowedInputVariables 164 .Where(v => problemData.Dataset.VariableHasType<double>(v) || problemData.Dataset.VariableHasType<string>(v)) 165 .Count(); 163 int count = allowedInputVariables.Count(); 166 164 167 165 foreach (var inputVariable in allowedInputVariables) { … … 198 196 199 197 double impact = 0; 200 var modifiableDataset = ((Dataset) dataset).ToModifiable();198 var modifiableDataset = ((Dataset)(dataset).Clone()).ToModifiable(); 201 199 202 200 // calculate impacts for double variables … … 369 367 private static double CalculateValue(IEnumerable<double> targets, IEnumerable<double> estimates, out OnlineCalculatorError error) { 370 368 calculator.Reset(); 371 if (targets.Count() != estimates.Count()) { 369 370 var targetsEnumerator = targets.GetEnumerator(); 371 var estimatesEnumerator = estimates.GetEnumerator(); 372 373 bool targetsHasNextValue = targetsEnumerator.MoveNext(); 374 bool estimatesHasNextValue = estimatesEnumerator.MoveNext(); 375 376 while (targetsHasNextValue && estimatesHasNextValue) { 377 calculator.Add(targetsEnumerator.Current, estimatesEnumerator.Current); 378 targetsHasNextValue = targetsEnumerator.MoveNext(); 379 estimatesHasNextValue = estimatesEnumerator.MoveNext(); 380 } 381 382 //Check if there is an equal quantity of targets and estimates 383 if (targetsHasNextValue != estimatesHasNextValue) { 372 384 throw new ArgumentException(string.Format("Targets and Estimates must be of equal length ({0},{1})", targets.Count(), estimates.Count())); 373 } 374 foreach (var entry in targets.Zip(estimates, (target, estimate) => new { target, estimate })) { 375 calculator.Add(entry.target, entry.estimate); 376 } 385 386 } 387 377 388 error = calculator.ErrorState; 378 389 return calculator.Value;
Note: See TracChangeset
for help on using the changeset viewer.