-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add feature to show multiple forecasts over time #15
Comments
E.g. here is a figure showing predictions (points) for different models (colors) from different timezeroes, this is from the NBA predictions project in zoltar, plotted in R. In some ways, this is a simpler kind of chart than the existing main plotting feature in predtimechart because there isn't any of the inferring of dates that needs to happen to get x-axes aligned that goes on in the current plot feature. I'm imagining that just one of these plots would be shown in resolving this issue, but the faceting (multiple embedded plots) is an example of what is requested in #16 . |
I think this would require a new API and a new chart type (e.g., a tab or separate URL). Question: What would the API look like for downloading necessary data? (Specifically the function call arguments and the returned data format.) |
@nickreich Q: The example image is for a particular project target, correct? The targets from the NBA Zoltar project are: "make playoffs", "season wins", and "win finals", with only the middle one being non-binary. |
@matthewcornell Yes, the idea is that you would pick one particular target. Predictions for that target are shown on y-axis, with timezero where the forecast was made on the x-axis. |
@nickreich : Q: I'm trying to understand how you've gone from zoltar data to the example output you gave. I tried this query:
which returned 1309 rows of bin data, e.g.,
Q: Do you have time to explain this to me? Note: I'm using a simplified query while trying to understand this. Ultimately we'll need to specify a list of timezeros from the relevant period (the entire NBA season, i.e., |
Basically, this looks like output that is nearly ready to be plotted. The one thing is that for a prediction element with |
Thanks, Nick. So we will need rules for translating between data classes ( |
Yes. For |
Yep! |
do we have a sample--> point conversion function? this is something we've talked about before, right? |
According to our Automatic prediction type conversion docs:
|
Multiple forecasts over time: APIFollowing is example API input, intermediate Zoltar query, and API output for the Zoltar NBA project. workflow
[1] Rules to convert rows to plottable data:
input: a JSON object from the UI specifying what data is to be plottedThe only difference between this and a Zoltar forecast query is the {
"project_id": 316,
"units": ["bos", "den"],
"models": ["538-Elo", "538-RAPTOR"],
"dates": ["2022-10-18", "2023-04-09"],
"target": "win finals"
} corresponding intermediate Zoltar queryHere I'm simulating the expansion of {"units": ["bos", "den"],
"targets": ["win finals"],
"timezeros": ["2022-10-19", "2022-10-21", "2022-10-24", "2022-10-28", "2022-10-31", "2022-11-01", "2022-11-02", "2022-11-03", "2022-11-04", "2022-11-05", "2022-11-06", "2022-11-07", "2022-11-13", "2022-11-14", "2022-11-16", "2022-11-17", "2022-11-18", "2022-11-19", "2022-11-20", "2022-11-21"],
"models": ["538-Elo", "538-RAPTOR"]
} Behind the scenes this results in num_rows=32 . output: a JSON object containing the data to plotThis format is similar to that of predtimechart's forecast and truth data formats. The object has one key per unit, where each unit becomes its own subplot/facet. Each key's value is an object that has one key per model. Each model has x/y data ( {
"bos": {
"538-Elo": {
"date": ["2022-10-21", "2022-10-24", "2022-10-28", "2022-10-31", "2022-11-04", "2022-11-07", "2022-11-14", "2022-11-21"],
"y": [0.18, 0.2118, 0.16, 0.1332, 0.13, 0.1436, 0.2198, 0.3082]
},
"538-RAPTOR": {
"date": ["2022-10-19", "2022-10-24", "2022-10-28", "2022-10-31", "2022-11-04", "2022-11-07", "2022-11-14", "2022-11-21"],
"y": [0.22, 0.2376, 0.24, 0.2029, 0.18, 0.1621, 0.2644, 0.2931]
}
},
"den": {
"538-Elo": {
"date": ["2022-10-21", "2022-10-24", "2022-10-28", "2022-10-31", "2022-11-04", "2022-11-07", "2022-11-14", "2022-11-21"],
"y": [0.01, 0.0205, 0.01, 0.0151, 0.02, 0.0226, 0.0456, 0.0327]
},
"538-RAPTOR": {
"date": ["2022-10-19", "2022-10-24", "2022-10-28", "2022-10-31", "2022-11-04", "2022-11-07", "2022-11-14", "2022-11-21"],
"y": [0.12, 0.1205, 0.07, 0.0583, 0.07, 0.0691, 0.0661, 0.063]
}
}
} |
This is a great start on this. I am realizing that I made a conceptual error in my earlier descriptions. I was confusing "bin" prediction types and "binary" target types. In general, not all "bin" prediction types will have a My suggestion above needs to be changed a bit as follows:
Suggestion for moving forward:
|
Thanks, Nick - good plan. Here's the updated spec in case @elray1 wants to chime in. Multiple forecasts over time: APIFollowing is example API input, intermediate Zoltar query, and API output for the Zoltar NBA project. workflow
[1] Rules to convert rows to plottable data:
input: a JSON object from the UI specifying what data is to be plottedThe only difference between this and a Zoltar forecast query is the {
"project_id": 316,
"units": ["bos", "den"],
"models": ["538-Elo", "538-RAPTOR"],
"dates": ["2022-10-18", "2023-04-09"],
"target": "season wins"
} corresponding intermediate Zoltar queryHere I'm simulating the expansion of {"units": ["bos", "den"],
"targets": ["season wins"],
"timezeros": ["2022-10-19", "2022-10-21", "2022-10-24", "2022-10-28", "2022-10-31", "2022-11-01", "2022-11-02", "2022-11-03", "2022-11-04", "2022-11-05", "2022-11-06", "2022-11-07", "2022-11-13", "2022-11-14", "2022-11-16", "2022-11-17", "2022-11-18", "2022-11-19", "2022-11-20", "2022-11-21"],
"models": ["538-Elo", "538-RAPTOR"]
} Behind the scenes this results in num_rows=32 . output: a JSON object containing the data to plotThis format is similar to that of predtimechart's forecast and truth data formats. The object has one key per unit, where each unit becomes its own subplot/facet. Each key's value is an object that has one key per model. Each model has x/y data ( {
"bos": {
"538-Elo": {
"date": ["2022-10-21", "2022-10-24", "2022-10-28", "2022-10-31", "2022-11-04", "2022-11-07", "2022-11-14", "2022-11-21"],
"point": [57, 59, 56, 54, 53, 55, 58, 61]
},
"538-RAPTOR": {
"date": ["2022-10-19", "2022-10-24", "2022-10-28", "2022-10-31", "2022-11-04", "2022-11-07", "2022-11-14", "2022-11-21"],
"point": [57, 58, 57, 55, 54, 55, 58, 60]
}
},
"den": {
"538-Elo": {
"date": ["2022-10-21", "2022-10-24", "2022-10-28", "2022-10-31", "2022-11-04", "2022-11-07", "2022-11-14", "2022-11-21"],
"point": [42, 45, 42, 42, 44, 45, 49, 47]
},
"538-RAPTOR": {
"date": ["2022-10-19", "2022-10-24", "2022-10-28", "2022-10-31", "2022-11-04", "2022-11-07", "2022-11-14", "2022-11-21"],
"point": [53, 53, 51, 50, 51, 51, 52, 51]
}
}
} |
FYI slack thread: https://reichlab.slack.com/archives/C04CYGMDFS4/p1689686394483149 |
FYI slack thread from @elray1 re: differences b/w "classic" (current predtimechart) and "new" (this) versions: https://reichlab.slack.com/archives/C04CYGMDFS4/p1691593308450669?thread_ts=1691592032.148409&cid=C04CYGMDFS4 |
Here are some notes based on conversation with Matt just now: I think the key difference between the two plots has to do with how they deal with reference dates, horizons, and target end dates:
There are some things that are not differences between the two plot types:
Given that, I think most of the UI would not change between the two plot types. However, there is a piece here that I still haven't fully thought through related to how UI navigations across "as of dates" or reference times would work. In the classic plot, navigating across "as of dates" updates truth as well as the reference dates for which forecasts are displayed. But now we are saying that forecasts at all reference dates will be displayed no matter what the reference date is... |
E.g. instead of the mode that predtimechart uses now to show forecasts from a single timezero or forecast_date, we could code up a different chart where you select a target (or "outcome"?) and a time-frame and i guess a location and then all predictions that have been made over time for those selections are shown.
The text was updated successfully, but these errors were encountered: