-
Notifications
You must be signed in to change notification settings - Fork 21
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
forecast
and scores
objects print output every time a column is changed
#935
Comments
forecast
object prints output every time a column is changedforecast
and scores
objects print output every time a column is changed
@Bisaloo do you think you might have a minute to look at this, or are you swamped at the moment? In that case I can try and take over. Thank you! For context: we have to update scoringutils on CRAN until October 31, 2024. The reason for that is that the package author fields are currently malformed in the CRAN version (they are fixed on gh) and we got a few messages asking us to fix this by October 31 latest. Ideally, it would be nice to have this fixed before we release anything to CRAN. see #920 |
@seabbs tagging you for context on the deadline |
Ah I see. So we could just update the CRAN version from the release that we made it with (i.e update that branch and release from there). That takes the pressure off the very breaking dev version but also deadlines are nice |
Exactly. But I think we could actually make the October 31 deadline. Only 3 more issues to got! Edit: SHOULD! |
I can have a look after Wednesday. I don't have any intuition of what may be causing this yet 🤔 |
Merci! |
From what I understand, data.table has a complex internal state to control whether or not an object should be printed. The problem is that this state is stored in the scoringutils could potentially add its own internal variable to determine if printing should proceed (i.e., forwarded to |
I see. Hm... |
Sorry, I'm just glancing & not able to glean the full context. Do you have something that's printing, that shouldn't be, or something that's not printing, that should be? |
Things are printing that shouldn't be printing.
This prints although it shouldn't:
Same happens with
This is probably related to the fact that we have specific |
In the This lets me think that the issue may be related to the fact that we're hitting
I'm landing at
with
in |
Hm. Planning ahead: If we're not able to solve this before October 31, I see two and a half options:
I'm leaning towards 2) and would like to avoid 3). Ideal solution would of course be fixing the issue until then. I'm a bit lost what's exactly causing this... |
ok it seems like an alternative temporary solution would be to get rid of the custom I created a reprex to simplify what's going on.
|
ok digging deeper it seems like actually the problem is with the There is this issue from 2018 mentioning the exact same problem: Rdatatable/data.table#3029. I'm slightly confused we didn't notice this earlier (as far as I can tell we had the |
In complete ignorance of what's actually happening I made some progress by including the following part from
At leat in the simple example above this seems to work, i.e. the following behaves correctly:
In the package itself it does not work again which again may have to do with the fact that |
Wow lots here. Firstly I agree with "alternative temporary solution would be to get rid of the custom print method." as the option to go with to avoid us getting blocked if we cant resolve.
I also have no idea what is happening here so guess its good it helps a bit! I don't currently have a lot of useful insights for this unfortunately. |
Digging deeper again it seems like the problem is not only with the print method. Even if we remove the print method, the problem still persists. For example, this line in
But this is performed on a I will try and write up what I did exactly a bit later. But the tldr is: I wasn't able to find an easy fix. I think our short-term options:
Both seem not ideal. I'm leaning slightly towards option 2. |
It has to be 2. of those but yeah very much not ideal. |
Urgh!!11! I discovered a new issue:
If |
ok I think |
I think we need to (temporarily, I hope) remove some of the |
I think that we can't fix the printing issue. Digging into the This, we could perhaps address by cleverly manipulating the In our case when called from [[1]]
(function (x, ...)
UseMethod("print"))(x)
[[2]]
print.forecast(x)
[[3]]
NextMethod()
[[4]]
print.data.table(x) So the only option I can see would be to re-create the logic in |
Yeah it seems quite difficult... Maybe we should actually just use |
We could but of course we’d still get prints with |
Argh. True... (empirically, I just tested it). But I'm not sure it always has to be the case. Hm.... |
My understanding is that because using |
Sorry for the headaches here all & thanks for digging into this. I haven't had time to read carefully but it looks like you're close to hitting on the root issues. I can point to where in I wonder if calling |
Consider this example:
Upon changing the model column, the first data.table prints nothing. For
ex
, however, the whole data.table is printed again.EDIT: This is no longer true
Same happens with
scores
objects@Bisaloo do you have any thoughts on this?
The text was updated successfully, but these errors were encountered: