查詢

fann_get_sarprop_temperature()函式—用法及示例

「 獲取Self-Adaptive Resilient Backpropagation (SARPROP) 訓練演演演算法中當前溫度引數的值 」


函式名稱:fann_get_sarprop_temperature()

適用版本:FANN >= 2.4.0

函式說明:fann_get_sarprop_temperature() 函式用於獲取Self-Adaptive Resilient Backpropagation (SARPROP) 訓練演演演算法中當前溫度引數的值。

用法:

float fann_get_sarprop_temperature ( resource $ann )

引數:

  • $ann:神經網路資源物件(由 fann_create_standard() 或 fann_create_sparse() 等函式建立)。

返回值: 返回當前 SARPROP 演演演算法中溫度引數(浮點數)的值。

示例:

$ann = fann_create_standard(2, 2, 1);
fann_set_training_algorithm($ann, FANN_TRAIN_SARPROP);

// 設定並獲取 SARPROP 溫度引數
fann_set_sarprop_temperature($ann, 0.25);
$temperature = fann_get_sarprop_temperature($ann);
echo "當前 SARPROP 溫度引數為:" . $temperature;

fann_destroy($ann);

以上示例中,我們首先建立了一個擁有 2 個輸入節點、2 個隱藏節點和 1 個輸出節點的神經網路 $ann。然後我們使用 fann_set_training_algorithm() 函式設定訓練演演演算法為 SARPROP。接下來,我們使用 fann_set_sarprop_temperature() 函式設定 SARPROP 演演演算法的溫度引數為 0.25,並使用 fann_get_sarprop_temperature() 函式獲取該溫度引數的值,並將其輸出到螢幕上。最後,我們銷燬了神經網路資源物件。

請注意,要使用 fann_set_sarprop_temperature()fann_get_sarprop_temperature() 函式,你需要在編譯 PHP 時啟用 FANN 擴充套件,並且 FANN 版本需大於等於 2.4.0。

補充糾錯
熱門PHP函式
分享連結