Urban Computing ToolBox is a package providing spatial-temporal predicting models. It contains both conventional models and state-of-art models.
Currently the package supported the following models: (Details)
UCTB is a flexible and open package. You can use the data we provided or use your own data, the data structure is well stated in the tutorial chapter. You can build your own model based on model-units we provided and use the model-training class to train the model.
You can skip to step 2 if you already installed tensorflow.
You can refer to this page https://www.tensorflow.org/install to install tensorflow, if you have a Nvidia GPU installed on you computer, we highly recommend you to install GPU version of tensorflow.
pip install --upgrade UCTB
The following required package will be installed or upgraded with UCTB:
xxxxxxxxxx
'hmmlearn',
'keras',
'GPUtil',
'numpy',
'pandas',
'python-dateutil',
'scikit-learn',
'scipy',
'statsmodels',
'wget',
'xgboost',
'nni',
'chinesecalendar',
'PyYAML'
You can also use UCTB by docker. First pull uctb docker from docker hub.
xxxxxxxxxx
docker pull dichai/uctb:v0.2.0
And you then can run it.
xxxxxxxxxx
docker run --runtime=nvidia -it -d dichai/uctb:v0.2.0 /bin/bash
xfrom UCTB.dataset import NodeTrafficLoader
from UCTB.model import AMultiGCLSTM
from UCTB.evaluation import metric
# Config data loader
data_loader = NodeTrafficLoader(dataset='Bike', city='NYC', graph='Correlation',
closeness_len=6, period_len=7, trend_len=4, normalize=True)
# Init model object
AMulti_GCLSTM_Obj = AMultiGCLSTM(closeness_len=data_loader.closeness_len,
period_len=data_loader.period_len,
trend_len=data_loader.trend_len,
num_node=data_loader.station_number,
num_graph=data_loader.LM.shape[0])
# Build tf-graph
AMulti_GCLSTM_Obj.build()
# Training
AMulti_GCLSTM_Obj.fit(closeness_feature=data_loader.train_closeness,
period_feature=data_loader.train_period,
trend_feature=data_loader.train_trend,
laplace_matrix=data_loader.LM,
target=data_loader.train_y,
sequence_length=data_loader.train_sequence_len)
# Predict
prediction = AMulti_GCLSTM_Obj.predict(closeness_feature=data_loader.test_closeness,
period_feature=data_loader.test_period,
trend_feature=data_loader.test_trend,
laplace_matrix=data_loader.LM,
target=data_loader.test_y,
output_names=['prediction'],
sequence_length=data_loader.test_sequence_len)
# Evaluate
print('Test result', metric.rmse(prediction=data_loader.normalizer.min_max_denormal(prediction['prediction']),
target=data_loader.normalizer.min_max_denormal(data_loader.test_y), threshold=0))
Compare different version of AMulti-GCLSTM
Experiments on charge station demand prediction