TL_GPRSM.models package¶
Submodules¶
TL_GPRSM.models.GPRSM module¶
- class TL_GPRSM.models.GPRSM.GPRSM(train_x, train_y, kernel_name='Matern52', is_ard=True, normalizer='standardization')¶
Bases:
object
- get_ard_contribution(normalized=True)¶
get ARD contribution
- Parameters:
normalized (bool, optional) – whether normalized or not. Defaults to True.
- Returns:
ARD contributions
- Return type:
np.array
- get_part_contribution()¶
get contribution of each part
- Returns:
contribution of common part, source part, target part (%)
- Return type:
Tuple[float, float, float]
- get_transfer_learning_effect()¶
get transfer learning effect
- Returns:
effect of transfer learning (%)
- Return type:
float
- inverse_normalize(pred_y)¶
inverse normalize predicted data y
- Parameters:
pred_y (np.array) – normalized predicted data y (number of samples x 1)
- Returns:
inverse normalized predicted data y
- Return type:
np.array
- static load_model(path)¶
load model
- Parameters:
path (str) – path to load model
- Returns:
GPRSM model
- Return type:
- normalize(normalizer)¶
normalize training data
- Parameters:
normalizer (str) – normalizer (standardization, minmax, none)
- Returns:
normalized training data x and y
- Return type:
np.array
- normalize_x(inp_x)¶
normalize input data x
- Parameters:
inp_x (np.array) – input data x (number of samples x number of features)
- Returns:
normalized input data x
- Return type:
np.array
- optimize(max_iter, messages=False, num_restarts=10, parallel=True)¶
optimize GPR surrogate model
- Parameters:
max_iter (int) – max iteration number
messages (bool, optional) – print messages. Defaults to False.
num_restarts (int, optional) – number of restarts. Defaults to 10.
parallel (bool, optional) – is parallel. Defaults to True.
- Return type:
None
- predict(test_x)¶
predict by GPR surrogate model
- Parameters:
test_x (np.array) – test data x (number of samples x number of features)
- Returns:
predicted mean and variance
- Return type:
Tuple[np.array, np.array]
- save_model(path)¶
save model
- Parameters:
path (str) – path to save model
- Return type:
None
- select_kernel_func(kernel_name)¶
select kernel function
- Parameters:
kernel_name (str) – kernel name (Matern52, Matern32, RBF, etc.)
- Returns:
kernel function
- Return type:
GPy.kern
- set_transfer_learning(source_x, source_y)¶
set transfer learning
- Parameters:
source_x (numpy.ndarray) – source data x of transfer learning (number of samples x number of features)
source_y (numpy.ndarray) – source data y of transfer learning (number of samples x 1)