Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions nextorch/bo.py
Original file line number Diff line number Diff line change
Expand Up @@ -1175,7 +1175,8 @@ def predict(self,

def predict_real(self,
X_test: MatrixLike2d,
show_confidence: Optional[bool] = False
show_confidence: Optional[bool] = False,
scale_X: bool = True
) -> Union[Matrix, Tuple[Matrix, Matrix, Matrix]]:
"""Use GP model for prediction at X_test

Expand All @@ -1188,6 +1189,8 @@ def predict_real(self,
show_confidence : Optional[bool], optional
by default False, only return posterior mean
If True, return the mean, and lower, upper confidence interval
scale_X: bool, optional
by default True, convert X to unit scale if not scaled already.

Returns
-------
Expand All @@ -1198,7 +1201,7 @@ def predict_real(self,
Y_test_upper_real: numpy matrix
The upper confidence interval in a real scale
"""
X_test_real = ut.unitscale_X(X_test, self.X_ranges)
X_test_real = ut.unitscale_X(X_test, self.X_ranges) if scale_X else X_test
Y_real, Y_lower_real, Y_upper_real = model_predict_real(self.model,
X_test_real,
self.Y_mean,
Expand Down
4 changes: 2 additions & 2 deletions nextorch/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -1443,8 +1443,8 @@ def response_heatmap_exp(
baseline=baseline,
mesh_size=mesh_size)

# Make prediction using the GP model
Y_test = Exp.predict_real(X_test)
# Make prediction using the GP model, don't scale X as it's already scaled
Y_test = Exp.predict_real(X_test, scale_X=False)
Y_test_2d = transform_Y_mesh_2d(Y_test, mesh_size=mesh_size)
# select the sample points
X_train = None
Expand Down