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 , n and generates random points (x1,x2) as follows -
- n random points that lie within a circle with center at (0,0) and radius r1 → These points belong to class 'inner'
- n 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 X , Cls :
- X 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 X (values will be either 'inner' or 'outer')
Step by Step Solution
3.42 Rating (158 Votes )
There are 3 Steps involved in it
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
Get step-by-step solutions from verified subject matter experts
