Aaman Sarkar Assignment2
Aaman Sarkar Assignment2
Aaman Sarkar Assignment2
import turtle
win = turtle.Screen()
win.bgcolor("pink")
# created aan object
leo = turtle.Turtle()
leo.speed(0)
# defined an function for makeing the cylinder.
def cylinder(radii,length,coloring,home):
leo.penup()
leo.setheading(0)
leo.goto(home)
leo.pendown()
leo.fillcolor(coloring)
leo.begin_fill()
leo.left(90)
leo.circle(-radii,180,20)
leo.circle(radii,180,20)
leo.forward(length)
leo.left(180)
leo.circle(-radii,180,20)
leo.circle(radii,180,20)
leo.forward(length)
leo.circle(radii, 360, 20)
leo.end_fill()
leo.penup()
leo.goto(home[0]+4*radii,length)
leo.pendown()
leo.begin_fill()
leo.circle(-radii,360,20)
leo.end_fill()
def arrow(length1,start):
leo.penup()
leo.setheading(90)
leo.goto(start)
leo.pendown()
leo.forward(length1)
leo.stamp()
def arrow1(length2,start):
leo.penup()
leo.setheading(270)
leo.goto(start)
leo.pendown()
leo.forward(length2)
leo.stamp()
cylinder(12.5,200,"lightblue",(0,0))
cylinder(12.5,200,"lightblue",(100,0))
cylinder(12.5,200,"lightblue",(-100,0))
arrow(50,(10,-100))
arrow(50,(110,-100))
arrow(50,(-90,-100))
arrow1(50,(30,300))
arrow1(50,(130,300))
arrow1(50,(-70,300))
leo.hideturtle()
# Question 3
import turtle
win = turtle.Screen()
win.bgcolor("pink")
# created aan object
leo = turtle.Turtle()
leo.speed(0)
# defined an function for makeing the cylinder.
def cylinder(radii,length,coloring,home):
leo.penup()
leo.setheading(0)
leo.goto(home)
leo.pendown()
leo.fillcolor(coloring)
leo.begin_fill()
leo.left(90)
leo.circle(-radii,180,20)
leo.circle(radii,180,20)
leo.forward(length)
leo.left(180)
leo.circle(-radii,180,20)
leo.circle(radii,180,20)
leo.forward(length)
leo.circle(radii, 360, 20)
leo.end_fill()
leo.penup()
leo.goto(home[0]+4*radii,length)
leo.pendown()
leo.begin_fill()
leo.circle(-radii,360,20)
leo.end_fill()
def arrow(length1,start):
leo.penup()
leo.setheading(90)
leo.goto(start)
leo.pendown()
leo.forward(length1)
leo.stamp()
def arrow1(length2,start):
leo.penup()
leo.setheading(270)
leo.goto(start)
leo.pendown()
leo.forward(length2)
leo.stamp()
cylinder(12.5,200,"lightblue",(0,0))
cylinder(12.5,200,"lightgreen",(100,0))
cylinder(12.5,200,"red",(-100,0))
arrow(50,(10,-100))
arrow(50,(110,-100))
arrow(50,(-90,-100))
arrow1(50,(30,300))
arrow1(50,(130,300))
arrow1(50,(-70,300))
leo.hideturtle()
# Question 3
"""import matplotlib
import matplotlib.pyplot as plt
def create_diagram():
"""
This function creates a diagram depicting the machine learning process.
"""
fig, ax = plt.subplots()
# Create shapes
labeled_data_shape = matplotlib.patches.Ellipse(xy=(2, 5), width=3,
height=2, angle=0, color='lightblue')
model_shape = matplotlib.patches.Rectangle(xy=(4.5, 5), width=2, height=2,
color='lightgreen')
square_shape = matplotlib.patches.Rectangle(xy=(7, 5), width=1, height=1,
color='lightgray')
training_data_text = plt.text(1.5, 5, 'Labeled Data', ha='center',
va='center', fontsize=10)
model_text = plt.text(5, 5.5, 'Model', ha='center', va='center',
fontsize=10)
training_text = plt.text(7.5, 5, 'Training', ha='center', va='center',
fontsize=10)
triangle1_shape = matplotlib.patches.RegularPolygon(xy=(2, 3),
numVertices=3, radius=1, color='lightblue')
triangle2_shape = matplotlib.patches.RegularPolygon(xy=(5.5, 3),
numVertices=3, radius=1, color='lightyellow')
square2_shape = matplotlib.patches.Rectangle(xy=(7, 3), width=1, height=1,
color='lightgray')
test_data_text = plt.text(1.5, 3, 'Test Data', ha='center', va='center',
fontsize=10)
prediction_text = plt.text(5.5, 3, 'Prediction', ha='center', va='center',
fontsize=10)
oval_shape = matplotlib.patches.Ellipse(xy=(4.5, 1), width=3, height=1,
angle=0, color='lightpink')
labels_text = plt.text(5, 1, 'Labels', ha='center', va='center',
fontsize=10)
# Create arrows
arrow1 = matplotlib.patches.FancyArrowPatch((2.7, 5), (4.2, 5),
mutation_scale=100, color='black')
arrow2 = matplotlib.patches.FancyArrowPatch((5.7, 5), (7, 5),
mutation_scale=100, color='black')
arrow3 = matplotlib.patches.FancyArrowPatch((2, 2.5), (2, 4.2),
mutation_scale=100, color='black')
arrow4 = matplotlib.patches.FancyArrowPatch((5.5, 2.5), (5.5, 4.2),
mutation_scale=100, color='black')