Question: Write a function that takes parameters r1 , r2 , n and generates random points (x1,x2) as follows - n random points that lie within

Write a function that takes parameters r1  , r2  , and generates random points (x1,x2)  as follows -

  • random points that lie within a circle with center at (0,0)  and radius r1  →  These points belong to class 'inner'
  • random points that lie outside circle with center at (0,0)  and radius r1  but inside circle with center at (0,0)  and radius r2  →  These points belong to class 'outer'

The function gen_random should return , Cls  :

  • is a numpy array of shape (2n,2)  which has the 2n  random points generated as above.
  • Cls  is a numpy array of shape (2n,)  which contains the value of the class corresponding to each point in (values will be either 'inner' or 'outer')

Step by Step Solution

3.42 Rating (158 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To solve this problem well write a Python function genrandom that generates n random points in each specified region and classifies them accordingly W... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Algorithms Questions!