-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
97 lines (35 loc) · 1.77 KB
/
test.py
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
from src.irisdataprediction.pipeline.prediction_pipeline import PredictionPipeline
import numpy as np
from src.irisdataprediction.utils.ml_utils.preprocessor.helper import data_standardization
import pandas as pd
try:
flower_type = np.array(['Iris-setosa', 'Iris-versicolor', 'Iris-virginica'])
independent_features = ['sepal_length', 'sepal_width', 'petal_length', 'petal_width']
predict_Item = PredictionPipeline()
items = [4.5, 2.3, 1.3, 0.3]
data=pd.DataFrame(np.array(items).reshape(1,-1),columns=independent_features,index=None)
normalized_data = data_standardization(data,independent_features)
spicies = predict_Item.predict(normalized_data)
# print(np.array(normalized_data).reshape(-1,1))
print(spicies)
print(flower_type[int(spicies[0])])
except Exception as e:
raise e
# from src.irisdataprediction.pipeline.prediction_pipeline import PredictionPipeline
# import numpy as np
# from src.irisdataprediction.utils.ml_utils.preprocessor.helper import data_standardization
# import pandas as pd
# try:
# flower_type=np.array(['Iris-setosa','Iris-versicolor','Iris-virginica'])
# independent_features=['Sepal_length', 'Sepal_width', 'Petal_length', 'Petal_width']
# predict_Item=PredictionPipeline()
# items=[7.7,2.8,6.7,2]
# data=pd.DataFrame(np.array(items).reshape(1,-1),columns=independent_features)
# normalized_data=data_standardization(data)
# # data=np.array(normalized_data).reshape(-1,1)
# # new_data=pd.DataFrame(normalized_data.T, columns=independent_features)
# # spicies=predict_Item.predict(new_data.T)
# # print(spicies)
# # print(flower_type[int(spicies[0])])
# except Exception as e:
# raise e