Question: Write a function to generate customized clusters. ( 1 5 % ) - There are two clusters, both contain ( n )
Write a function to generate customized clusters.
There are two clusters, both contain n samples.
One cluster is the frame of a square with size r
Another cluster is the frame of a rhombus with size sqrt r
Hint: In generating a square, you can obtain random numbers, in which the first random number determines one out of the four sides, while the second random number determines the location of the point on the side.
This problem is about clusters.
Note: In application, you can add some random noise to make the cluster thicker.
Code:
# Problem
import random
def problemn r outputqjpg:
# write your logic here
random.seed # for reproducibility
pltsavefigoutput # do not show the plt
Execution:
problemn r
qjpg:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
