Thanks so much for your interest in MvTS!
We first briefly introduce how MvTS
completes the entire training process of a model. To be convenient, we take the LSTNET model for an example.
Python run_model.py --task single_step --model LSTNET --dataset solar
The directory of the main files participating in the process is shown as below.
[root@#######/MTS_Library/]# tree
.
├── mvts
│ └── config
│ └── data
│ └── solar.json
│ ├── model
│ └── single_step
│ └── LSTNET.json
│ └── task_config.json
│ ├── data
│ └── dataset
│ └── single_step_dataset
│ ├── _init_.py
│ └── single_step_dataset.py
│ ├── model
│ └── single_step_model
│ ├── _init_.py
│ └── LSTNET.py
│ ├── executor
│ └── single_step_executor
│ ├── _init_.py
│ └── single_step_executor.py
│ ├── evaluator
│ └── evaluator.py
│ ├── pipeline
│ └── pipeline.py
│ ├── raw_data
│ └── solar.h5
│ └── utils
├── run_model.py
Key Steps:
MvTS
first get the parameter configuration in Config, including the parameters of dataset and the training parameters of model. Meanwhile,task_config.json
shows the models and datasets supported by the library, and specifies the corresponding dataloader and executor for a specific model. (ForLSTNET
, the dataloader and executor aresingle_step_dataset
andsingle_step_executor
).- The dataloader (
singel_step_dataset
) loads datasetsolar
, and performs normalization, segmentation and other operations, and finally is used to provide well processed data during the training process. LSTNET.py
stores the original implementation of the modelLSTNET
.- The executor(
single_step_executor
) completes the training and prediction process ofLSTNET
, and finally stores the well trained model at the specified location. - evaluator provides a variety of evaluation functions to evaluate the performance of the model.
If you want to extend new datasets into MvTS
, then you can follow the methods below:
-
Record the rawdata, time, adjacency matrix(if not available, then set it zero-matrix) information of the dataset and integrate them in the h5 file. And put it into
./mvts/raw_data/
. -
Add
newdataset.json
in directory./mvts/config/data/
. -
Modify
./mvts/config/task_config.json
to support the new dataset.def convert_to_h5(filename, data, time, adj_mx = None): f = h5py.File(filename, "w") f.create_dataset("raw_data", data = data) f.create_dataset("time", data = time) if(str(type(adj_mx)) == "<class 'NoneType'>"): adj_mx = np.zeros((data.shape[1], data.shape[1])) print(adj_mx.shape) f.create_dataset("adjacency_matrix", data = adj_mx)
If you want to develop new datasets into MvTS
, then you can follow the methods below (lets' take the model LSTNET
for example):
- Add the
LSTNET.py
into./mvts/model/single_step_model/
, and modify the./mvts/model/single_step_model/_inti_.py
to link the new model. - Add
LSTNET.json
into./mvts/config/model/single_step/
. - Construct correct dataloader and executor.
- You can select a correct one from the existing modules, all you need is to make sure the methods that the module loads data and train the model are the same.
- If there are not modules available, you can just add yours into
./mvts/data/dataset/single_step_dataset/
and./mvts/executor/single_step_executor/
. Meanwhile, remember to modify the_init_.py
files in the two directories.
- Finally, modify the
task_config.json
to support the new model and set the corresponding dataloader and executor.