How do I load (or reshape) my data to input into an LSTM?

17 Views Asked by At

I am following this LSTM Model: https://machinelearningmastery.com/how-to-develop-rnn-models-for-human-activity-recognition-time-series-classification/#:~:text=(scores)-,Complete%20Example,-Now%20that%20we

All my extracted features, labels of train and test set and the LSTM models are in the same folder.

LSTM requires 3D tensors = [samples, timesteps, fetaures]. But my train_features.csv file is 2D (i.e. 9000 x 861). How do I restructure it to pass it onto LSTM? Also, do I directly one-hot encode the features csv?

My train_labels.csv is 9000 x 1

My directory is as follows:

├── published_data
│   ├── labels
│   │   ├── 1_ann.csv
│   │   ├── 2_ann.csv
│   │   └── (25 files of labels)
│   ├── skeletal_keypoints
│   │   ├── 1_keypoint.csv
│   │   ├── 2_keypoint.csv
│   │   └── (25 files of skeletal data)
│   └── video
│       ├── 1.mts
│       ├── 2.mts
│       └── (25 video files)
└── Models
    └── LSTM
        ├── extract_data_LSTM.py
        ├── test_features.csv
        ├── test_ids.csv
        ├── test_labels.csv
        ├── train_features.csv
        ├── train_ids.csv
        ├── train_labels.csv
        └── LSTM_model.ipynb
0

There are 0 best solutions below