Skip to content
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

Refresh Error - number of observations in y (310) not equal to the number of rows of x (0) #419

Closed
Tsurty opened this issue Jun 27, 2022 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@Tsurty
Copy link

Tsurty commented Jun 27, 2022

Project Robyn

Describe issue

I have 3 similar models built with Robyn that I wanted to refresh.
While 2 of them worked without any issue this one model returns me this error.

I've checked the dataset and columns are all there as well as values.
I feel like it may be an easy to solve issue but I can't figure out the problem.

> Robyn <- robyn_refresh(
+   robyn_object = robyn_object
+   , dt_input = data.table::fread("~/Desktop/cassandra-workspace/data/dataset-total-r1.csv")
+   , dt_holidays = dt_prophet_holidays
+   , refresh_steps = 118
+   , refresh_mode = "auto"
+   , refresh_iters = 2000 # 1k is estimation. Use refresh_mode = "manual" to try out.
+   , refresh_trials = 3
+   , clusters = TRUE
+ )
>>> Initial model loaded
>>> Refreshing model 1 in auto mode. 0 more to go...
Input data has 939 days in total: 2019-12-01 to 2022-06-26
Refresh model is built on rolling window of 310 day: 2021-08-21 to 2022-06-26
Rolling window moving forward: 118 day
Using weibull_pdf adstocking with 61 hyperparameters (61 to iterate + 0 fixed) on 8 cores
>>> Starting 3 trials with 2000 iterations each using TwoPointsDE nevergrad algorithm...
  Running trial 1 of 3
  |                                                                                                                                                                       |   0%Error in { : 
  task 1 failed - "number of observations in y (310) not equal to the number of rows of x (0)"
Timing stopped at: 2.781 3.593 2.959

Provide dummy data & model configuration

Environment & Robyn version

> packageVersion("Robyn")
[1] ‘3.6.4’
@laresbernardo
Copy link
Collaborator

Hi @Tsurty Can you share a reproducible example that replicates this error to help us debug?

@Tsurty
Copy link
Author

Tsurty commented Jun 29, 2022

Hi @Tsurty Can you share a reproducible example that replicates this error to help us debug?

Sure, just sent it through the Google Form.
One note I figured out after sending it is: I uploaded the wrong code example but you basically have it up here so you should be good to go.

@laresbernardo laresbernardo self-assigned this Jun 29, 2022
@laresbernardo
Copy link
Collaborator

Thanks. I was able to reproduce the error with your RDS file. Will get back to you. Any hint you'd like to share?

@Tsurty
Copy link
Author

Tsurty commented Jun 29, 2022

Thanks. I was able to reproduce the error with your RDS file. Will get back to you. Any hint you'd like to share?

Not really honestly. I have two other similar models created (same client, similar columns and dataset, slightly different data).
Same process but those worked fine in refreshing, this one keeps returning this error.

If you think that can be useful I can share with you those as well.

@laresbernardo
Copy link
Collaborator

I found the bug and will upload the fix in a few minutes.

@laresbernardo laresbernardo added the bug Something isn't working label Jun 29, 2022
@laresbernardo
Copy link
Collaborator

laresbernardo commented Jun 29, 2022

Hi @Tsurty I've fixed this issue. The problem was that when no categorical columns were provided, model.matrix returned no data at all when doing one-hot encoding instead of ignoring the input and returning the same input as output.

Even though this issue has been fixed (please update and check), you'll get the following error later on, when Robyn ends training the refresh model: "Input 'metric_value' for fb_re_spend (0) must be a positive value". But that depends on your data input.

@Tsurty
Copy link
Author

Tsurty commented Jun 29, 2022

Hi @Tsurty I've fixed this issue. The problem was that when no categorical columns were provided, model.matrix returned no data at all when doing one-hot encoding instead of ignoring the input and returning the same input as output.

Even though this issue has been fixed (please update and check), you'll get the following error later on, when Robyn ends training the refresh model: "Input 'metric_value' for fb_re_spend (0) must be a positive value". But that depends on your data input.

Hello @laresbernardo thanks for the quick fix and explaination.
Will test this out tomorrow as I'm running other models atm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants