deepkashiwa20 / megacrn Goto Github PK
View Code? Open in Web Editor NEW[AAAI23] This it the official github for AAAI23 paper "Spatio-Temporal Meta-Graph Learning for Traffic Forecasting"
License: MIT License
[AAAI23] This it the official github for AAAI23 paper "Spatio-Temporal Meta-Graph Learning for Traffic Forecasting"
License: MIT License
May I ask to publish checkpoints?
Hi,
Congratulations for your good job!
I have one question here. I think the matrix W_E should have the dimension of N * \phi as your codes said, rather than d * e in your paper. Correct me if I am wrong.
Line 153 in ac03024
Best regards.
Hello, it is mentioned in the paper that EXPY-TKY dataset contains accident information, but I can't find it in the data folder. Could you please send me a copy of the accident data? My QQ email is [email protected] and my other email is [email protected]. Thank you very much!
Dear Authors,
First of all, the idea of this paper is really interesting and empirical results are very impressive.
However, it seems that the implementation of function evaluate(model, mode) might be problematic when y_true is full of zeros. The details are as follows @deepkashiwa20 :
def masked_mae_loss(y_pred, y_true):
mask = (y_true != 0).float()
mask /= mask.mean()
loss = torch.abs(y_pred - y_true)
loss = loss * mask
# trick for nans: https://discuss.pytorch.org/t/how-to-set-nan-in-tensor-to-0/3918/3
loss[loss != loss] = 0
return loss.mean()
def masked_mape_loss(y_pred, y_true):
mask = (y_true != 0).float()
mask /= mask.mean()
loss = torch.abs(torch.div(y_true - y_pred, y_true))
loss = loss * mask
# trick for nans: https://discuss.pytorch.org/t/how-to-set-nan-in-tensor-to-0/3918/3
loss[loss != loss] = 0
return loss.mean()
In such case, masked_mae_loss returns 0, then the lists l3,l6,l12 would take this ambiguous ZERO as the model perfectly make the predictions.
for x, y in data_iter:
x, y, ycov = prepare_x_y(x, y)
output, h_att, query, pos, neg = model(x, ycov)
y_pred = scaler.inverse_transform(output)
y_true = scaler.inverse_transform(y)
loss1 = masked_mae_loss(y_pred, y_true) # masked_mae_loss(y_pred, y_true)
separate_loss = nn.TripletMarginLoss(margin=1.0)
compact_loss = nn.MSELoss()
loss2 = separate_loss(query, pos.detach(), neg.detach())
loss3 = compact_loss(query, pos.detach())
loss = loss1 + args.lamb * loss2 + args.lamb1 * loss3
losses.append(loss.item())
# Followed the DCRNN TensorFlow Implementation
maes.append(masked_mae_loss(y_pred, y_true).item())
mapes.append(masked_mape_loss(y_pred, y_true).item())
mses.append(masked_mse_loss(y_pred, y_true).item())
# Important for MegaCRN model to let T come first.
y_true, y_pred = y_true.permute(1, 0, 2, 3), y_pred.permute(1, 0, 2, 3)
l_3.append(masked_mae_loss(y_pred[2:3], y_true[2:3]).item())
m_3.append(masked_mape_loss(y_pred[2:3], y_true[2:3]).item())
r_3.append(masked_mse_loss(y_pred[2:3], y_true[2:3]).item())
l_6.append(masked_mae_loss(y_pred[5:6], y_true[5:6]).item())
m_6.append(masked_mape_loss(y_pred[5:6], y_true[5:6]).item())
r_6.append(masked_mse_loss(y_pred[5:6], y_true[5:6]).item())
l_12.append(masked_mae_loss(y_pred[11:12], y_true[11:12]).item())
m_12.append(masked_mape_loss(y_pred[11:12], y_true[11:12]).item())
r_12.append(masked_mse_loss(y_pred[11:12], y_true[11:12]).item())
ys_true.append(y_true)
ys_pred.append(y_pred)
Unfortunately, for the META-LA dataset there exist several batches of y_true that are all zeros. This will lead to MAE/RMSE/MAPE that are underestimated.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.