Tensorflow And Pytorch
Applications in tensorflow and pytorch.
Tensorflow
- transform “pandas.dataframe” to “tensorflow.dataset”
For training dataset, you should set the “label” to be the prediction label. In the “Titanic Survivors Prediction”, the label should be set to “Survived”.
1
2
3
4# tfdf: tensorflow_decision_forests
train_ds = tfdf.keras.pd_dataframe_to_tf_dataset(pandans_train_dataframe, label="Survived")
test_ds = tfdf.keras.pd_dataframe_to_tf_dataset(pandans_test_dataframe)
PyTorch
- flatten (扁平化)
torch.flatten(tensor)