VisionEval / VisionEval-Dev

Development version of VisionEval framework
https://visioneval.github.io/
Apache License 2.0
6 stars 32 forks source link

An error from "readFromTable" when running the staged scenarios with both years in the reference scenario #132

Closed dongmeic closed 2 years ago

dongmeic commented 3 years ago

The current set-up for running multiple scenarios is to run the base-year only on the first stage and the predicted year only on the other stages. When querying data, the reference scenario is not available. Since I need to compare measures with the reference scenario, I tried to run with both years at the first stage. It then ran into an error from the readFromTable function, as below:

image

I am trying to track the source issue from the module. Maybe someone else can spot and resolve the issue faster? I appreciate much the help.

jrawbits commented 3 years ago

The error message is because the query is trying to read data from tables that have differing numbers of rows: it's saying that the Vehicle table has 333327 rows and the query tried to read from (say) 333328. From what you describe, the difficulty probably arises from creating a first stage that has a future year, then running a second stage that has a different scenario for the same future year - you will end up with conflicting tables in the Datastore.

Keeping the reference scenario separate and adjusting the query script is the right way to handle that. For now, the query script is "custom". We can handle that outside the Github...

I'm keeping this issue, however, as a generic version of the query function in question here will be available publicly as part of the VisionEval command-line API in a near-future release. We'll make sure this problem has been handled gracefully.

dongmeic commented 3 years ago

Thanks, @jrawbits. I wonder though, how come the second stage worked but the third stage didn't in a three-scenario set-up. I had the reference scenario and the second stage run, and the error occurred in the third stage. I thought the manner of the third stage and any of the rest is the same as the second stage. That is how I can tell from the run script.

As a solution, I might use the reference scenario as one of the other scenarios (repeated a folder with a different run script from the base year folder but the same as the second and rest stage) to get the query report. I tried that before and probably didn't handle well the run script so that I got mistakes.

jrawbits commented 3 years ago

When you set up the subsequent stages for alternate future years (third, fourth, fifth states, etc.), it should use everything the same as the second stage. In the run_model.R for each of those stages, you want “LoadDatastore=TRUE” the “DatastoreName=’path/to/Stage-1-Base-Year/Datastore”. So the later stages all ignore each other, except that they all use the base year as the starting point.

Remember that the reference scenario (unaltered future year) should also be a separate stage. Conceptually, you’re trying to set up the stages like the following (with each run_model.R, inputs and defs in a sub-folder containing the stage)

dongmeic commented 3 years ago

Yes, I got that, but why the third stage behaves differently with the same set-up as the second stage in my case? I am still not clear about this, sorry. I meant the second stage shouldn't work out either if both years run in the base year folder, right?

jrawbits commented 2 years ago

I'm going to close this issue since VE 3.0 (VEModel framework) has much more robust handling of alternate scenarios (model stages) - the framework will take care of making sure everything adds up (and notify more explicitly if it does not - though we'll need to keep an eye on trapping the myriad ways that it is no doubt still possible to break it).