facebookexperimental / facebookexperimental/Robyn

Validation procedure of Robyn 2

Open
#1,196 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
1.5k
Forks
433
PR merge metrics
No merged PRs in 30d

Description

Hi, I am forwarding a message already sent by a user.
Hello, I was trying to validate between initial model, robyn_response & robyn_allocator for the very last period (`last_period <- 1`) as shown from the code above by @gufengzhou:
```
## comparing responses
last_period <- 1
media_sorted <- sort(InputCollect$paid_media_spends)

## get last period response from initial model
val_response_a <- OutputCollect$xDecompVecCollect %>%
filter(solID == select_model) %>%
select(ds, media_sorted) %>%
tail(last_period)

## get last period response from robyn_response
val_response_b <- list()
for (i in seq_along(media_sorted)){
Response <- robyn_response(
InputCollect = InputCollect,
OutputCollect = OutputCollect,
select_model = select_model,
metric_name = media_sorted[i],
date_range = paste0("last_", last_period)
)
val_response_b["ds"] <- data.frame(ds = Response$date)
val_response_b[media_sorted[i]] <- data.frame(response = Response$response_total)

}
val_response_b <- bind_cols(val_response_b)

## get last period response from robyn_allocator
AllocatorCollect1 <- robyn_allocator(
InputCollect = InputCollect,
OutputCollect = OutputCollect,
select_model = select_model,
date_range = paste0("last_", last_period), # Default last month as initial period
# total_budget = NULL, # When NULL, default is total spend in date_range
channel_constr_low = 0.7,
channel_constr_up = c(1.2, 1.5, 1.5, 1.5, 1.5),
# channel_constr_multiplier = 3,
scenario = "max_response",
export = create_files
)
val_response_c <- AllocatorCollect1$dt_optimOut %>% select(date_min, date_max, initResponseUnit)

val_response_a
val_response_b
val_response_c
```

The initial response (val_response_a) and the response from robyn_response (val_response_b) are identical. However, I’m noticing discrepancies in the results from the robyn_allocator (val_response_c), which I’m unable to account for. Could you provide any insights into why this might be happening?
issue_github

_Originally posted by @gaiaderossinunatac in https://github.com/facebookexperimental/Robyn/issues/772#issuecomment-2352203664_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.