[英]build a binary classification model with LSTM
這里有兩個教程可能會對您有所幫助:
https://stackabuse.com/time-series-analysis-with-lstm-using-pythons-keras-library/
本教程是關於混合數據的: https://www.pyimagesearch.com/2019/02/04/keras-multiple-inputs-and-mixed-data/
如果您不使用未提及的其他東西,我建議您嘗試 Keras 以熟悉如何訓練它。
只需在 google 中寫下您的問題,就可以幫助您找到許多具體的教程!
編輯:來自 keras 文檔:
keras.utils.to_categorical(y, num_classes=None, dtype='float32')
將 class 向量(整數)轉換為二進制 class 矩陣。 例如與 categorical_crossentropy 一起使用。 Arguments
回報:
輸入的二進制矩陣表示。 類軸放在最后。
# Consider an array of 5 labels out of a set of 3 classes {0, 1, 2}:
> labels
array([0, 2, 1, 2, 0])
# `to_categorical` converts this into a matrix with as many
# columns as there are classes. The number of rows
# stays the same.
> to_categorical(labels)
array([[ 1., 0., 0.],
[ 0., 0., 1.],
[ 0., 1., 0.],
[ 0., 0., 1.],
[ 1., 0., 0.]], dtype=float32)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.