元編程參考文件

Keras 模型

6 個節點

本頁內容 6

構建 Keras 模型

函數

Makes a model of the layers between an input and an output.

簽名
構建 Keras 模型 -> Keras Model
    輸入: KerasTensor
    輸出: KerasTensor
    名稱: 文字
KerasModel BuildKerasModel(
    KerasTensor input,
    KerasTensor output,
    string name)

參數

名稱型別預設值說明
輸入KerasTensor—The Input the network starts from.
輸出KerasTensor—The last layer's tensor.
名稱文字—A name for the model; empty for Keras's own.

返回

模型Keras Model
所屬發行版
元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
Keras 模型
所屬包
機器學習

載入 Keras 模型

函數

Loads a model saved in Keras's .keras format, by this package or by Python's Keras.

簽名
載入 Keras 模型(路徑: 文字) -> Keras Model
KerasModel LoadKerasModel(string path)

參數

名稱型別預設值說明
路徑文字—The .keras file.

返回

模型Keras Model
所屬發行版
元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
Keras 模型
所屬包
機器學習

預測單個樣本

函數

The model's answer for one example.

簽名
預測單個樣本(模型: Keras Model, 特徵: 數字陣列) -> 數字陣列
double[] PredictOne(KerasModel model, double[] features)

參數

名稱型別預設值說明
模型Keras Model—A trained model.
特徵數字陣列—The example's numbers, in the order it was trained on.

返回

輸出數字陣列
所屬發行版
元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
Keras 模型
所屬包
機器學習

用 Keras 模型預測

函數

The model's answers for the rows of a table, as a table with one column per output.

簽名
用 Keras 模型預測 -> Table
    模型: Keras Model
    資料: Table
    特徵: 文字陣列
Table PredictWithKerasModel(
    KerasModel model,
    Table data,
    string[] features)

參數

名稱型別預設值說明
模型Keras Model—A trained model.
資料Table—The rows.
特徵文字陣列—The columns it sees, in the order it was trained on.

返回

預測結果Table
所屬發行版
元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
Keras 模型
所屬包
機器學習

儲存 Keras 模型

函數

Saves a model in Keras's .keras format: its layers, weights and training setup in one file.

簽名
儲存 Keras 模型(模型: Keras Model, 路徑: 文字) -> 文字
string SaveKerasModel(KerasModel model, string path)

參數

名稱型別預設值說明
模型Keras Model—The model.
路徑文字—The file to write, ending in .keras.

返回

路徑文字
所屬發行版
元編程(專業版)
可用的圖種類
事件 例程 狀態機狀態
宣告於
Keras 模型
所屬包
機器學習

訓練 Keras 模型

函數

Trains a model on the rows of a table: some columns are what it sees, others what it should answer.

簽名
訓練 Keras 模型 -> (模型: Keras Model, 損失: 數字陣列, 驗證損失: 數字陣列)
    模型: Keras Model
    資料: Table
    特徵: 文字陣列
    標籤: 文字陣列
    損失: 文字
    優化器: 文字
    學習率: 數字
    輪數: 整數
    批大小: 整數
    驗證比例: 數字
    種子: 整數
KerasModel TrainKerasModel(
    KerasModel model,
    Table data,
    string[] features,
    string[] labels,
    string loss,
    string optimizer,
    double learningRate,
    int epochs,
    int batchSize,
    double validationShare,
    int seed,
    out double[] losses,
    out double[] validationLosses)

參數

名稱型別預設值說明
模型Keras Model—The model; training changes it.
資料Table—The training rows.
特徵文字陣列—The columns it sees, in the order of its input.
標籤文字陣列—The columns it should answer. For sparse_categorical_crossentropy, one column of class numbers 0, 1, 2...
損失文字—What it minimizes: mse or mae for numbers, binary_crossentropy for yes or no, sparse_categorical_crossentropy for one of several classes.
優化器文字—adam, sgd, rmsprop, adamw...
學習率數字—How big each step is.
輪數整數—How many times to go through the data.
批大小整數—How many rows each step sees.
驗證比例數字—The share of rows, taken from the end, kept back to measure the model on rows it has not trained on; 0 for none.
種子整數—Makes the run repeatable: the starting weights, the shuffling and dropout.

返回

模型Keras Model
損失數字陣列
驗證損失數字陣列
所屬發行版
元編程(專業版)
可用的圖種類
事件 例程 狀態機狀態
宣告於
Keras 模型
所屬包
機器學習