banditml/offline-policy-evaluation

KeyError: avg_order_size, which in features_config, yet not integrated into X in processor.py, but used at Line 207?

Joecth opened this issue · 2 comments

Hi, I get KeyError while running the QuickStart steps,
Could you please help to give a hint?
Thanks!

Following shows the Pic regarding my problem,
image

That is to say,
At line 207, In processor.py,
According to the Quick Start, the avg_order_size is from
features_config[“features”],
features_config = {
"features": {
"avg_order_size": {"type": "N"},
...

And, I can’t see anywhere X in processor.py, which is mainly from data_frame, integrates avg_order_size into itself,
Data_Frame:

row mdp_id sequence_number context decision reward
1 u123 1 {"country": 2, "year": 1796} female 154.2
2 u456 1 {"country": 4, "year": 2017} male 170.9

which makes me don't know how to fix it by making sense...

Hey @Joecth - features should match the features present in your context. See example_feature_config.json for an example.

Thanks for your reply, @econti!
Just now, I already simply replace features_config on QuickStart page with the content in example_feature_config.json, shown as the pic,
圖片

I can see the features includes country, year, and decision, which is already consistent with context in DataFrame.

However, looks like it receives an empty array in preprocess_feature() in proprocessor.py, and thus raised ValueError...
圖片

Is it possible for you to guide a quick fix regarding what happened here?
(p.s. I just wanna smoothly and successfully run it up to get more idea abt it according to QuickStart.., but still not able to... )

Thanks~!