-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFlowers.py
More file actions
52 lines (35 loc) · 1.31 KB
/
Copy pathFlowers.py
File metadata and controls
52 lines (35 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
from numpy import *
from Vec import trans
class Flowers:
def __init__(self, *args):
self.args_num = list(map(float, args[0][:-1]))
self.species = args[0][-1]
self.remove()
self.norm = linalg.norm(vectorize(trans)(self.args_num))
self.axs_names = ["Comprimento Sepala", "Largura sepala", "Comprimento petala", "Largura petala"]
self.color_2d = self.color(self.species)
def remove(self):
if (self.species == "virginica\n") | (self.species == "setosa\n") | (self.species == "versicolor\n"):
self.species = self.species[:-1]
def color(self, specie):
match specie:
case "virginica":
return "red,"
case "setosa":
return "blue,"
case "versicolor":
return "black,"
def __it__(self, other):
if self.norm > other.norm:
return False
else:
return True
def __gt__(self, other):
if self.norm > other.norm:
return True
else:
return False
def fo(self):
return self.norm
def lista(self, i):
return self.args_num[i]