python - generate an artificial data set for context bandit algorithm -
i want generate following artificial dataset test contextual bandit algorithm. easiest way done in python may be? can point me link demonstrates code it?
the unit vectors θ1 , ..., θk k actions drawn uniformly rd . in each iteration t of t complete iterations, context xt first sampled uniform distribution within ∥x| ≤ 1.
if understand question right, want generate:
- context xt uniform distribution
- a unit vector of k elements indicating arm choose single value being set one, again uniform distribution
both tasks can achieved numpy package:
- use numpy.random.uniform generate values uniform distribution within range.
- use numpy.random.randint generate integers uniform distribution , use generated values set list element 1.
Comments
Post a Comment