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:

  1. context xt uniform distribution
  2. a unit vector of k elements indicating arm choose single value being set one, again uniform distribution

both tasks can achieved numpy package:

  1. use numpy.random.uniform generate values uniform distribution within range.
  2. use numpy.random.randint generate integers uniform distribution , use generated values set list element 1.

Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -