Closed umuur closed 2 years ago
Hi @umuur
The issue here is that learn
and predict
must be called on the entire ccb example, which requires at least as many actions as slots (making ccb slot 1:0:0.5 0,1 |
invalid). I would recommend something more like this for your use:
import vowpalwabbit
vw = vowpalwabbit.Workspace("--ccb_explore_adf", quiet=True)
ccb_ex = """
ccb shared | age feature1
ccb action |
ccb action |
ccb slot 0:1:0.6 0,1 |
ccb slot 1:0:0.5 0,1 |
"""
vw.learn(ccb_ex)
vw.predict(ccb_ex)
Calling predict
here will return:
[[(0, 0.5), (1, 0.5)], [(1, 1.0)]]
where [(0, 0.5), (1, 0.5)]
are the decision scores for the first slot and [(1, 1.0)]
are the scores for the second. Let me know if you have any questions.
Hi @bassmang
Thank you! I think I misunderstand the multiline concept before. Now it makes more sense!
closing this issue, please feel free to reopen if you have more questions
Describe the bug
I am currently building a conditional contextual bandit with python api. I created a workspace with
ccb_explore_adf
command with a data file that contains examples.I'd like to use online learning functionality with vw.learn, vw.predict methods, but when I try to use commands like:
vw.learn(ccb slot 1:1:0.6 0,1 | feature1)
jupyter notebook crashes withkernel died unexpectedly and will restart automatically
message.Is online learning and getting predictions realtime possible with ccb at this moment? I know it's possible with classic contextual bandit, but couldn't find any resources for ccb for python.
How to reproduce
Create data.txt file with examples:
ccb shared | age feature1 ccb action | ccb action | ccb slot 0:1:0.6 0,1 | ccb slot 1:0:0.5 0,1 |
Create vw.workspace with
ccb_explore_adf -d data.txt
Add more examples with
vw.learn('ccb slot 1:0:0.5 0,1 |')
kernel died unexpectedly and will restart automatically
message.Get predictions with
vw.predict('ccb slot |')
kernel died unexpectedly and will restart automatically
message.Version
9.3.0
OS
macOS
Language
Python
Additional context
No response