You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am currently working on reproducing the mean_wQuantileLoss and m_sum_mean_wQuantileLoss metrics from a research paper. However, I have encountered significant discrepancies between my results and those obtained from the model.
I would appreciate any assistance in identifying potential errors in my implementation.
Here is a summary of my approach:
def quantile_loss(y_true, y_pred, q):
loss = 2 * np.sum(np.abs((y_pred - y_true) * ((y_true <= y_pred) - q)))
return loss
def quantile_loss(y_true, y_pred, q):
loss = 2 * np.sum(np.abs((y_pred - y_true) * ((y_true <= y_pred) - q)))
return loss
def mean_wQuantileLoss(forecasts, targets, quantiles=(np.arange(20)/20.0)[1:]):
B, T, D = targets.shape
loss = 0.0
for i in range(B):
for d in range(D):
for q in quantiles:
loss += quantile_loss(targets[i, :, d], forecasts[i, :, d], q) / np.sum(np.abs(targets))
return loss / (B * D * len(quantiles))
def m_sum_mean_wQuantileLoss(forecasts, targets, quantiles=(np.arange(20)/20.0)[1:]):#
B, T, D = targets.shape
forecasts = np.sum(forecasts, axis=-1)
targets = np.sum(targets, axis=-1)
total_loss = 0.0
for i in range(B):
loss = 0.0
for q in quantiles:
loss += quantile_loss(targets[i], forecasts[i], q) / np.sum(np.abs(targets))
total_loss += loss / len(quantiles)
return total_loss / B
The text was updated successfully, but these errors were encountered:
I am currently working on reproducing the mean_wQuantileLoss and m_sum_mean_wQuantileLoss metrics from a research paper. However, I have encountered significant discrepancies between my results and those obtained from the model.
I would appreciate any assistance in identifying potential errors in my implementation.
Here is a summary of my approach:
def quantile_loss(y_true, y_pred, q):
loss = 2 * np.sum(np.abs((y_pred - y_true) * ((y_true <= y_pred) - q)))
return loss
def quantile_loss(y_true, y_pred, q):
loss = 2 * np.sum(np.abs((y_pred - y_true) * ((y_true <= y_pred) - q)))
return loss
def mean_wQuantileLoss(forecasts, targets, quantiles=(np.arange(20)/20.0)[1:]):
B, T, D = targets.shape
loss = 0.0
for i in range(B):
for d in range(D):
for q in quantiles:
loss += quantile_loss(targets[i, :, d], forecasts[i, :, d], q) / np.sum(np.abs(targets))
return loss / (B * D * len(quantiles))
def m_sum_mean_wQuantileLoss(forecasts, targets, quantiles=(np.arange(20)/20.0)[1:]):#
B, T, D = targets.shape
forecasts = np.sum(forecasts, axis=-1)
targets = np.sum(targets, axis=-1)
total_loss = 0.0
for i in range(B):
loss = 0.0
for q in quantiles:
loss += quantile_loss(targets[i], forecasts[i], q) / np.sum(np.abs(targets))
total_loss += loss / len(quantiles)
return total_loss / B
The text was updated successfully, but these errors were encountered: