Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
CODE import random import numpy as np import math def genrandompointsr1 r2 n X npempty...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started