sklearn.gaussian_process.CompoundKernel?

class sklearn.gaussian_process.kernels.CompoundKernel(kernels)

[源碼]

由一組其他內核組成的內核。

新版本0.18。

參數 說明
kernels list of Kernels
另一個內核
屬性 說明
bounds 返回的對數變換界限。
hyperparameters 返回所有超參數規范的列表。
n_dims 返回內核的非固定超參數的數量。
requires_vector_input 返回內核是否定義在離散結構上。
theta 返回(扁平的、對數轉換的)非固定超參數。

方法

方法 說明
__call__(self, X[, Y, eval_gradient]) 返回核函數k(X, Y)和它的梯度。
clone_with_theta(self, theta) 返回帶有給定超參數theta的self的克隆。
diag(self, X) 返回核函數k(X, X)的對角線。
get_params(self[, deep]) 獲取這個內核的參數。
is_stationary(self) 返回內核是否靜止。
set_params(self, **params) 設置這個內核的參數。
__init__(self, kernels)

[源碼]

初始化self. 請參閱help(type(self))以獲得準確的說明。

__call__(self, X, Y=None, eval_gradient=False)

[源碼]

返回核函數k(X, Y)和它的梯度。

注意,這個復合內核返回沿著一個附加軸堆積的所有簡單內核的結果。

參數 說明
X array-like of shape (n_samples_X, n_features) or list of object, default=None
返回核函數k(X, Y)的左參數
Y array-like of shape (n_samples_X, n_features) or list of object, default=None
返回的核函數k(X, Y)的正確參數。如果沒有,則計算k(X, X)。
eval_gradient bool, default=False
確定關于核超參數的梯度是否確定。
返回值 說明
K ndarray of shape (n_samples_X, n_samples_Y, n_kernels)
內核k (X, Y)
K_gradient ndarray of shape (n_samples_X, n_samples_X, n_dims, n_kernels), optional
核函數k(X, X)關于核函數超參數的梯度。只有當eval_gradient為真時才返回。
property bounds

返回的對數變換界限。

返回值 說明
bounds array of shape (n_dims, 2)
核函數超參數的對數變換界限
clone_with_theta(self, theta)

[源碼]

返回帶有給定超參數theta的self的克隆。

參數 說明
theta ndarray of shape (n_dims,)
超參數
diag`(X)

[源碼]

返回核函數k(X, X)的對角線 。

該方法的結果與np.diag(self(X))相同;但是,由于只計算對角,因此可以更有效地計算它。

參數值 說明
X array-like of shape (n_samples_X, n_features) or list of object
參數指向內核。
返回值 說明
K_diag ndarray of shape (n_samples_X, n_kernels)
核k(X, X)的對角線
get_params(self, deep=True)[source]

[源碼]

獲取這個內核的參數。

參數值 說明
deep bool, default=True
如果為真,將返回此估計器的參數以及包含的作為估計器的子對象。
返回值 說明
params dict
參數名稱映射到它們的值。
property hyperparameters

返回所有超參數規范的列表。

is_stationary(self)

[源碼]

返回內核是否靜止。

property n_dims

[源碼]

返回內核的非固定超參數的數量。

property requires_vector_input

返回內核是否定義在離散結構上。

set_params(self, **params)

[源碼]

設置這個內核的參數。

該方法適用于簡單估計量和嵌套對象(如pipline)。后者具有形式為<component>_<parameter>的參數,這樣就讓更新嵌套對象的每個組件成為了可能。

返回值 說明
self
property theta

返回(扁平的、對數轉換的)非固定超參數。

注意,theta通常是內核超參數的對數變換值,因為這種搜索空間的表示更適合超參數搜索,因為像長度尺度這樣的超參數自然存在于對數尺度上。

返回值 說明
theta ndarray of shape (n_dims,)
核函數的非固定、對數變換超參數