Skip to content

Commit

Permalink
np.square replacement
Browse files Browse the repository at this point in the history
  • Loading branch information
Gscorreia89 committed Nov 27, 2017
1 parent a426f15 commit ed0ff05
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pyChemometrics/ChemometricsPCA.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,14 +474,14 @@ def cross_validation(self, x, cv_method=KFold(7, True), outputdist=False, press_
press_testset = 0
for column in range(0, x[xtest, :].shape[1]):
xpred = cv_pipeline.scaler.transform(cv_pipeline._press_impute_pinv(x[xtest, :], column))
press_testset += np.sum((xtest_scaled[:, column] - xpred[:, column]) ** 2)
press_testset += np.sum(np.square(xtest_scaled[:, column] - xpred[:, column]))
cv_varexplained_test.append(1 - (press_testset / tss))
total_press += press_testset
else:
# RSS for row wise cross-validation
pred_scores = cv_pipeline.transform(x[xtest, :])
pred_x = cv_pipeline.scaler.transform(cv_pipeline.inverse_transform(pred_scores))
rss = np.sum((xtest_scaled - pred_x) ** 2)
rss = np.sum(np.square(xtest_scaled - pred_x))
total_press += rss
cv_varexplained_test.append(1 - (rss / tss))

Expand Down

0 comments on commit ed0ff05

Please sign in to comment.