Sidra Khalid Assignment

Download as pdf or txt
Download as pdf or txt
You are on page 1of 31

NAME: Sidra Khalid

Roll No: MSCS/FA23/001

Subject: Tools and


Techniques in Data
Science
Govt. Sadiq College
Women University
Bahawalpur
In [12]: #SIDRA KHALID
#MSCS/FA23/001
#Question 1
import pandas as pd
import numpy as np

# Set the number of instances


n_instances = 500

# Generate patient IDs


patient_ids = np.arange(1, n_instances + 1)

# Generate age between 20 and 80


age = np.random.randint(20, 81, size=n_instances)

# Generate sex ("Male" or "Female")


sex = np.random.choice(["Male", "Female"], size=n_instances)

# Generate heart rate between 60 and 100 beats per minute


heart_rate = np.random.randint(60, 101, size=n_instances)

# Generate blood pressure between 90 and 140 mmHg


blood_pressure = np.random.randint(90, 141, size=n_instances)

# Generate blood sugar level between 70 and 200 mg/dL


blood_sugar_level = np.random.randint(70, 201, size=n_instances)

# Define the dependent variable based on blood sugar level


# For simplicity, let's assume:
# Blood sugar level > 140 mg/dL indicates diabetes ("Yes")
# Blood sugar level <= 140 mg/dL indicates non-diabetes ("No")
diabetic = np.where(blood_sugar_level > 140, "Yes", "No")

# Create a DataFrame
data = {
'PatientID': patient_ids,
'Age': age,
'Sex': sex,
'HeartRate': heart_rate,
'BloodPressure': blood_pressure,
'BloodSugarLevel': blood_sugar_level,
'Diabetic': diabetic
}

df = pd.DataFrame(data)

# Display the first few rows of the DataFrame


print(df.head())

# Save the dataset to a CSV file


df.to_csv('dataset1.csv', index=False)

PatientID Age Sex HeartRate BloodPressure BloodSugarLevel Diabetic


0 1 62 Male 78 105 161 Yes
1 2 25 Female 90 125 134 No
2 3 72 Female 75 106 168 Yes
3 4 79 Male 66 90 81 No
4 5 43 Male 67 104 73 No

In [15]: print(df.to_string())
PatientID Age Sex HeartRate BloodPressure BloodSugarLevel Diabetic
0 1 62 Male 78 105 161 Yes
1 2 25 Female 90 125 134 No
2 3 72 Female 75 106 168 Yes
3 4 79 Male 66 90 81 No
4 5 43 Male 67 104 73 No
5 6 64 Female 71 96 162 Yes
6 7 43 Female 67 107 179 Yes
7 8 20 Female 69 98 174 Yes
8 9 35 Female 95 92 155 Yes
9 10 37 Male 88 111 187 Yes
10 11 40 Male 73 112 184 Yes
11 12 24 Male 83 103 85 No
12 13 31 Female 74 96 119 No
13 14 74 Male 90 138 133 No
14 15 47 Male 63 96 81 No
15 16 50 Female 89 135 166 Yes
16 17 46 Female 73 113 88 No
17 18 41 Female 95 128 106 No
18 19 20 Male 100 111 198 Yes
19 20 34 Female 99 101 114 No
20 21 62 Male 60 129 138 No
21 22 43 Male 81 126 165 Yes
22 23 21 Female 89 111 73 No
23 24 43 Female 62 93 106 No
24 25 54 Male 93 101 71 No
25 26 56 Female 88 94 116 No
26 27 62 Male 86 97 133 No
27 28 79 Male 84 140 108 No
28 29 29 Female 81 119 177 Yes
29 30 66 Female 66 133 116 No
30 31 76 Female 65 128 93 No
31 32 38 Female 97 124 124 No
32 33 46 Male 72 101 146 Yes
33 34 42 Female 75 126 103 No
34 35 33 Female 99 91 90 No
35 36 34 Female 80 92 159 Yes
36 37 71 Male 75 97 120 No
37 38 29 Male 90 105 93 No
38 39 77 Male 90 124 168 Yes
39 40 58 Male 89 107 148 Yes
40 41 63 Female 82 134 87 No
41 42 56 Female 84 130 81 No
42 43 21 Female 82 112 99 No
43 44 61 Male 99 95 85 No
44 45 47 Male 80 97 127 No
45 46 44 Male 91 91 93 No
46 47 37 Female 98 126 150 Yes
47 48 34 Male 69 139 71 No
48 49 42 Male 63 127 75 No
49 50 24 Female 94 97 94 No
50 51 58 Female 82 128 138 No
51 52 40 Female 97 106 154 Yes
52 53 56 Male 95 93 129 No
53 54 41 Male 87 97 94 No
54 55 27 Male 88 95 131 No
55 56 22 Male 72 93 199 Yes
56 57 75 Female 75 128 173 Yes
57 58 80 Male 61 105 131 No
58 59 29 Female 99 103 197 Yes
59 60 34 Male 75 102 180 Yes
60 61 23 Female 89 98 164 Yes
61 62 21 Female 67 134 135 No
62 63 50 Female 63 137 183 Yes
63 64 35 Male 90 129 175 Yes
64 65 65 Male 75 114 175 Yes
65 66 73 Male 94 91 114 No
66 67 35 Female 100 138 187 Yes
67 68 63 Female 60 97 132 No
68 69 23 Male 89 126 102 No
69 70 29 Female 79 121 183 Yes
70 71 34 Male 80 98 142 Yes
71 72 64 Female 66 119 163 Yes
72 73 47 Female 91 105 125 No
73 74 70 Male 85 109 95 No
74 75 34 Female 68 96 104 No
75 76 32 Male 74 102 165 Yes
76 77 54 Female 88 91 142 Yes
77 78 56 Male 85 100 125 No
78 79 34 Male 63 105 136 No
79 80 75 Female 60 138 82 No
80 81 57 Female 91 90 70 No
81 82 33 Female 65 132 127 No
82 83 73 Female 61 139 76 No
83 84 37 Male 94 121 92 No
84 85 34 Male 77 102 173 Yes
85 86 80 Male 73 105 95 No
86 87 43 Female 75 124 185 Yes
87 88 61 Female 81 99 136 No
88 89 77 Female 92 116 111 No
89 90 41 Female 97 105 127 No
90 91 43 Female 69 95 147 Yes
91 92 50 Male 99 135 180 Yes
92 93 76 Male 65 106 141 Yes
93 94 80 Male 68 128 70 No
94 95 22 Male 97 95 165 Yes
95 96 79 Female 62 136 80 No
96 97 47 Male 66 90 102 No
97 98 47 Male 61 99 182 Yes
98 99 54 Male 75 122 107 No
99 100 64 Female 64 106 127 No
100 101 67 Female 94 118 135 No
101 102 34 Female 68 131 173 Yes
102 103 22 Female 81 103 177 Yes
103 104 20 Female 62 109 185 Yes
104 105 25 Male 99 120 110 No
105 106 23 Female 76 100 117 No
106 107 27 Female 65 120 186 Yes
107 108 60 Male 82 101 86 No
108 109 34 Female 65 139 182 Yes
109 110 79 Male 95 124 200 Yes
110 111 49 Female 97 92 138 No
111 112 67 Female 94 91 86 No
112 113 73 Male 70 92 172 Yes
113 114 56 Female 98 119 104 No
114 115 22 Female 90 118 145 Yes
115 116 58 Female 60 110 194 Yes
116 117 29 Female 66 92 90 No
117 118 37 Male 63 103 200 Yes
118 119 79 Male 70 104 166 Yes
119 120 29 Male 76 112 129 No
120 121 43 Male 92 115 158 Yes
121 122 45 Male 73 108 87 No
122 123 51 Male 63 124 119 No
123 124 42 Female 61 94 86 No
124 125 36 Female 98 91 79 No
125 126 57 Female 100 129 192 Yes
126 127 55 Female 60 102 183 Yes
127 128 58 Male 68 112 83 No
128 129 40 Male 62 138 137 No
129 130 40 Female 64 107 165 Yes
130 131 63 Male 97 124 198 Yes
131 132 45 Male 97 103 165 Yes
132 133 31 Female 74 102 195 Yes
133 134 80 Female 80 132 95 No
134 135 46 Female 74 116 140 No
135 136 63 Male 78 128 166 Yes
136 137 60 Male 89 103 92 No
137 138 22 Male 84 115 147 Yes
138 139 26 Female 71 94 117 No
139 140 52 Female 69 120 89 No
140 141 23 Male 66 138 137 No
141 142 54 Male 65 138 92 No
142 143 41 Male 73 135 95 No
143 144 61 Male 89 120 186 Yes
144 145 64 Male 69 112 102 No
145 146 21 Female 83 91 160 Yes
146 147 55 Female 65 132 191 Yes
147 148 71 Male 74 95 158 Yes
148 149 23 Male 83 119 126 No
149 150 23 Male 82 139 181 Yes
150 151 71 Female 82 123 146 Yes
151 152 67 Female 78 129 90 No
152 153 29 Male 97 116 103 No
153 154 38 Male 87 112 179 Yes
154 155 33 Male 89 134 176 Yes
155 156 65 Male 66 125 83 No
156 157 64 Female 91 139 144 Yes
157 158 56 Female 88 93 154 Yes
158 159 56 Female 69 120 115 No
159 160 70 Male 87 133 174 Yes
160 161 21 Male 76 128 116 No
161 162 26 Female 100 97 179 Yes
162 163 69 Female 99 128 80 No
163 164 57 Male 79 122 154 Yes
164 165 57 Male 72 119 192 Yes
165 166 22 Female 82 99 80 No
166 167 58 Male 98 99 162 Yes
167 168 67 Male 99 100 126 No
168 169 71 Female 96 114 133 No
169 170 43 Female 80 115 192 Yes
170 171 78 Male 63 103 74 No
171 172 37 Male 76 102 112 No
172 173 41 Female 68 112 187 Yes
173 174 42 Female 62 99 159 Yes
174 175 51 Female 79 108 93 No
175 176 75 Male 89 140 131 No
176 177 79 Male 96 111 136 No
177 178 41 Female 95 128 176 Yes
178 179 75 Male 88 116 133 No
179 180 52 Female 95 125 165 Yes
180 181 27 Male 90 108 143 Yes
181 182 22 Female 81 132 178 Yes
182 183 66 Male 81 131 129 No
183 184 48 Female 66 131 93 No
184 185 33 Male 82 116 163 Yes
185 186 23 Female 71 102 104 No
186 187 59 Female 70 101 119 No
187 188 60 Male 86 104 195 Yes
188 189 75 Female 64 139 192 Yes
189 190 73 Female 96 126 136 No
190 191 66 Male 74 111 193 Yes
191 192 39 Male 89 109 148 Yes
192 193 44 Female 100 137 74 No
193 194 65 Female 68 116 84 No
194 195 39 Female 71 134 138 No
195 196 28 Male 72 120 158 Yes
196 197 23 Male 74 107 160 Yes
197 198 23 Female 85 139 196 Yes
198 199 28 Female 89 107 132 No
199 200 80 Female 71 140 129 No
200 201 31 Female 61 107 117 No
201 202 36 Male 68 137 151 Yes
202 203 44 Male 82 139 189 Yes
203 204 57 Female 88 114 175 Yes
204 205 22 Female 73 112 122 No
205 206 71 Female 77 103 108 No
206 207 62 Female 70 109 145 Yes
207 208 25 Female 64 93 144 Yes
208 209 68 Female 81 115 98 No
209 210 62 Male 66 95 159 Yes
210 211 62 Female 95 130 179 Yes
211 212 35 Female 69 106 88 No
212 213 60 Male 81 97 93 No
213 214 49 Male 84 115 124 No
214 215 45 Male 72 120 129 No
215 216 57 Male 92 136 135 No
216 217 49 Male 77 135 147 Yes
217 218 25 Female 76 113 121 No
218 219 68 Male 98 130 159 Yes
219 220 20 Female 75 98 82 No
220 221 73 Male 63 100 136 No
221 222 32 Male 65 90 174 Yes
222 223 44 Male 96 121 79 No
223 224 40 Male 96 131 83 No
224 225 67 Female 68 95 103 No
225 226 35 Male 98 117 116 No
226 227 66 Female 90 104 148 Yes
227 228 62 Male 83 126 161 Yes
228 229 62 Female 72 129 90 No
229 230 69 Female 88 131 122 No
230 231 46 Female 70 128 146 Yes
231 232 45 Female 74 130 189 Yes
232 233 26 Male 62 100 200 Yes
233 234 36 Female 73 137 169 Yes
234 235 40 Female 71 109 172 Yes
235 236 23 Female 95 90 199 Yes
236 237 45 Male 74 118 189 Yes
237 238 29 Male 86 112 112 No
238 239 20 Male 84 95 105 No
239 240 46 Male 76 126 93 No
240 241 78 Male 79 97 83 No
241 242 50 Female 99 131 164 Yes
242 243 30 Male 67 129 82 No
243 244 47 Female 70 105 155 Yes
244 245 26 Female 60 93 85 No
245 246 32 Male 63 115 139 No
246 247 28 Female 62 131 74 No
247 248 44 Female 79 117 75 No
248 249 58 Male 76 132 160 Yes
249 250 26 Male 80 134 173 Yes
250 251 80 Male 77 135 93 No
251 252 56 Female 79 136 113 No
252 253 57 Male 62 116 192 Yes
253 254 80 Female 76 131 167 Yes
254 255 71 Male 94 140 126 No
255 256 58 Male 60 100 170 Yes
256 257 43 Female 67 133 86 No
257 258 74 Female 97 130 112 No
258 259 26 Male 70 137 136 No
259 260 42 Male 99 94 125 No
260 261 70 Male 97 120 127 No
261 262 46 Female 99 104 93 No
262 263 54 Female 74 96 87 No
263 264 41 Male 96 108 74 No
264 265 33 Male 74 90 92 No
265 266 35 Female 60 93 72 No
266 267 22 Female 92 123 73 No
267 268 25 Female 84 138 122 No
268 269 53 Male 88 92 112 No
269 270 65 Female 96 112 186 Yes
270 271 55 Female 78 115 164 Yes
271 272 23 Male 100 98 146 Yes
272 273 34 Male 64 97 141 Yes
273 274 56 Male 96 134 113 No
274 275 72 Male 62 134 156 Yes
275 276 61 Male 79 97 123 No
276 277 65 Female 84 117 129 No
277 278 29 Female 75 99 160 Yes
278 279 76 Male 97 92 164 Yes
279 280 22 Female 86 90 95 No
280 281 69 Female 87 123 95 No
281 282 57 Female 60 137 133 No
282 283 42 Male 95 98 165 Yes
283 284 48 Female 81 140 122 No
284 285 53 Female 70 108 101 No
285 286 35 Female 62 92 78 No
286 287 23 Female 70 97 140 No
287 288 79 Female 76 100 187 Yes
288 289 30 Male 63 112 153 Yes
289 290 40 Male 82 105 91 No
290 291 29 Female 95 96 101 No
291 292 54 Male 91 97 130 No
292 293 39 Female 71 93 143 Yes
293 294 52 Male 100 127 96 No
294 295 27 Male 79 122 95 No
295 296 24 Male 61 117 186 Yes
296 297 64 Female 92 97 157 Yes
297 298 25 Male 64 134 143 Yes
298 299 28 Male 78 133 91 No
299 300 21 Male 70 132 74 No
300 301 39 Male 95 111 70 No
301 302 70 Male 77 95 194 Yes
302 303 57 Male 84 108 85 No
303 304 56 Male 70 119 107 No
304 305 75 Male 65 109 160 Yes
305 306 27 Male 68 118 74 No
306 307 61 Female 84 106 161 Yes
307 308 32 Male 96 138 180 Yes
308 309 30 Female 74 114 144 Yes
309 310 43 Male 74 126 168 Yes
310 311 28 Female 75 131 123 No
311 312 28 Male 74 106 138 No
312 313 70 Female 63 127 184 Yes
313 314 29 Female 93 111 84 No
314 315 25 Female 76 110 95 No
315 316 27 Male 97 126 112 No
316 317 52 Male 69 96 200 Yes
317 318 58 Male 60 93 190 Yes
318 319 68 Male 87 109 99 No
319 320 60 Male 80 132 171 Yes
320 321 31 Male 92 92 127 No
321 322 32 Male 73 135 165 Yes
322 323 75 Female 74 119 164 Yes
323 324 22 Male 69 122 89 No
324 325 52 Female 71 125 88 No
325 326 53 Male 74 118 105 No
326 327 80 Male 67 108 187 Yes
327 328 33 Female 74 122 86 No
328 329 61 Female 60 128 86 No
329 330 32 Male 89 106 130 No
330 331 62 Female 84 137 109 No
331 332 61 Female 89 126 110 No
332 333 69 Male 84 123 187 Yes
333 334 27 Female 67 101 100 No
334 335 25 Female 91 115 176 Yes
335 336 32 Female 91 131 137 No
336 337 58 Male 97 131 191 Yes
337 338 39 Female 79 104 92 No
338 339 68 Male 60 110 151 Yes
339 340 74 Male 79 133 137 No
340 341 59 Male 70 131 157 Yes
341 342 22 Female 66 131 182 Yes
342 343 51 Male 68 102 91 No
343 344 78 Male 62 91 88 No
344 345 66 Female 62 131 187 Yes
345 346 65 Female 80 107 133 No
346 347 55 Female 98 111 80 No
347 348 79 Male 64 100 87 No
348 349 42 Male 79 126 197 Yes
349 350 74 Female 76 132 194 Yes
350 351 32 Female 73 117 188 Yes
351 352 44 Male 82 116 159 Yes
352 353 66 Female 60 132 187 Yes
353 354 22 Female 70 129 181 Yes
354 355 62 Female 85 90 152 Yes
355 356 39 Female 95 137 170 Yes
356 357 61 Male 89 126 185 Yes
357 358 70 Female 98 96 72 No
358 359 52 Male 92 100 119 No
359 360 57 Male 63 107 135 No
360 361 34 Male 71 101 193 Yes
361 362 36 Female 74 111 169 Yes
362 363 72 Female 67 104 188 Yes
363 364 55 Female 62 110 84 No
364 365 58 Male 66 110 120 No
365 366 60 Male 74 116 118 No
366 367 23 Female 84 115 144 Yes
367 368 80 Female 96 134 186 Yes
368 369 52 Male 69 103 117 No
369 370 77 Male 96 133 89 No
370 371 69 Male 79 101 98 No
371 372 31 Female 75 132 70 No
372 373 51 Male 63 115 90 No
373 374 26 Female 67 128 89 No
374 375 22 Male 100 129 105 No
375 376 71 Male 72 139 142 Yes
376 377 31 Male 79 120 101 No
377 378 68 Male 82 135 99 No
378 379 55 Female 82 101 133 No
379 380 51 Male 98 95 116 No
380 381 68 Female 63 113 127 No
381 382 36 Female 70 136 86 No
382 383 41 Female 93 106 119 No
383 384 47 Female 78 95 190 Yes
384 385 25 Male 98 96 84 No
385 386 68 Male 62 92 142 Yes
386 387 62 Female 81 113 162 Yes
387 388 53 Female 97 134 109 No
388 389 75 Male 94 139 173 Yes
389 390 24 Male 89 131 107 No
390 391 38 Male 83 123 195 Yes
391 392 63 Male 90 136 132 No
392 393 73 Female 70 110 179 Yes
393 394 33 Male 63 114 195 Yes
394 395 58 Male 84 120 200 Yes
395 396 53 Male 60 129 156 Yes
396 397 69 Female 83 136 140 No
397 398 76 Male 84 97 77 No
398 399 48 Male 60 123 146 Yes
399 400 63 Male 79 92 124 No
400 401 43 Female 94 122 109 No
401 402 75 Male 60 131 134 No
402 403 71 Female 63 95 197 Yes
403 404 27 Female 94 121 156 Yes
404 405 68 Female 86 135 169 Yes
405 406 46 Female 96 99 76 No
406 407 46 Female 93 96 84 No
407 408 33 Female 84 132 126 No
408 409 40 Female 68 91 74 No
409 410 43 Female 85 98 82 No
410 411 25 Male 67 104 108 No
411 412 66 Male 80 116 191 Yes
412 413 20 Male 71 126 152 Yes
413 414 75 Male 73 130 102 No
414 415 43 Female 71 137 110 No
415 416 47 Male 83 122 128 No
416 417 31 Male 82 123 73 No
417 418 63 Female 94 127 149 Yes
418 419 52 Female 63 109 176 Yes
419 420 77 Female 95 124 114 No
420 421 43 Male 61 117 138 No
421 422 74 Female 61 111 89 No
422 423 52 Female 82 128 159 Yes
423 424 60 Female 91 136 89 No
424 425 33 Female 76 134 78 No
425 426 36 Female 74 112 135 No
426 427 70 Female 69 102 161 Yes
427 428 76 Male 60 130 93 No
428 429 30 Female 93 91 74 No
429 430 54 Male 71 93 83 No
430 431 38 Male 69 114 162 Yes
431 432 79 Male 90 106 80 No
432 433 70 Female 93 118 84 No
433 434 32 Male 78 140 175 Yes
434 435 28 Male 93 117 174 Yes
435 436 60 Female 97 96 191 Yes
436 437 76 Male 77 110 93 No
437 438 71 Female 88 127 118 No
438 439 75 Male 60 104 158 Yes
439 440 43 Male 76 93 188 Yes
440 441 26 Male 80 128 114 No
441 442 32 Female 94 121 165 Yes
442 443 80 Male 94 96 114 No
443 444 22 Male 73 95 152 Yes
444 445 49 Male 85 107 77 No
445 446 41 Male 94 132 128 No
446 447 23 Male 99 117 126 No
447 448 76 Female 73 115 140 No
448 449 74 Male 71 96 167 Yes
449 450 37 Male 66 137 124 No
450 451 22 Female 79 128 77 No
451 452 69 Female 81 121 127 No
452 453 73 Male 66 103 188 Yes
453 454 67 Male 80 136 112 No
454 455 61 Male 65 95 193 Yes
455 456 31 Male 70 139 122 No
456 457 61 Female 94 91 136 No
457 458 45 Male 71 124 110 No
458 459 51 Female 65 138 181 Yes
459 460 41 Female 69 119 124 No
460 461 68 Female 85 129 173 Yes
461 462 46 Female 70 108 171 Yes
462 463 68 Male 67 107 195 Yes
463 464 51 Male 64 91 121 No
464 465 52 Female 71 97 84 No
465 466 40 Female 62 112 140 No
466 467 49 Male 65 92 120 No
467 468 46 Male 95 134 77 No
468 469 22 Male 72 139 177 Yes
469 470 56 Male 60 129 86 No
470 471 38 Female 70 140 94 No
471 472 54 Male 91 100 173 Yes
472 473 45 Female 83 98 166 Yes
473 474 41 Male 60 93 101 No
474 475 71 Male 94 138 97 No
475 476 59 Male 91 124 104 No
476 477 58 Male 94 136 70 No
477 478 71 Male 91 104 105 No
478 479 51 Male 73 101 100 No
479 480 55 Male 69 103 128 No
480 481 44 Female 83 108 134 No
481 482 55 Male 90 128 76 No
482 483 29 Male 80 133 100 No
483 484 71 Male 89 103 197 Yes
484 485 41 Female 76 137 108 No
485 486 28 Female 99 137 173 Yes
486 487 24 Female 65 110 158 Yes
487 488 27 Male 63 130 134 No
488 489 27 Male 76 106 159 Yes
489 490 44 Male 84 117 116 No
490 491 58 Female 62 98 171 Yes
491 492 34 Male 98 112 104 No
492 493 46 Female 87 105 77 No
493 494 24 Male 74 104 154 Yes
494 495 49 Male 79 140 119 No
495 496 66 Female 80 106 110 No
496 497 61 Female 90 112 179 Yes
497 498 26 Male 65 96 151 Yes
498 499 45 Female 67 137 111 No
499 500 45 Female 61 105 177 Yes

In [19]: import pandas as pd


from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelEncoder, StandardScaler
from sklearn.svm import SVC
from sklearn.metrics import accuracy_score

# Load the dataset


df = pd.read_csv('dataset1.csv')

# Encode categorical variables (if any)


label_encoder = LabelEncoder()
df['Sex'] = label_encoder.fit_transform(df['Sex'])

# Define features (X) and target variable (y)


X = df.drop(columns=['PatientID', 'Diabetic']) # Features
y = df['Diabetic'] # Target variable

# Split dataset into training and testing sets


X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)

# Standardize features
scaler = StandardScaler()
X_train = scaler.fit_transform(X_train)
X_test = scaler.transform(X_test)

# Initialize and train the SVM classifier


svm_classifier = SVC(kernel='linear', random_state=42)
svm_classifier.fit(X_train, y_train)

# Predict on the test set


y_pred = svm_classifier.predict(X_test)

# Calculate accuracy
accuracy = accuracy_score(y_test, y_pred)
print("Accuracy:", accuracy)

# Make prediction for single instance: (244,34,Female,105,98)


single_instance = pd.DataFrame({
'Age': [34],
'Sex': [label_encoder.transform(['Female'])[0]],
'HeartRate': [82],
'BloodPressure': [105],
'BloodSugarLevel': [98]
})
single_instance_scaled = scaler.transform(single_instance)
single_prediction = svm_classifier.predict(single_instance_scaled)
print("Prediction for single instance:", single_prediction)

Accuracy: 1.0
Prediction for single instance: ['No']

In [ ]:
In [26]: import pandas as pd
import numpy as np

# Set the number of instances


n_instances = 500

# Generating random data for the dataset


np.random.seed(0)

# Generating 500 random product IDs


product_ids = np.random.randint(1000, 10000, size=n_instances)

# Generating random product types


product_types = np.random.choice(['Electronics', 'Clothing', 'Dairy', 'Furniture', 'Books', 'Home Decor'], size=n_instances)

# Generating random market prices


market_prices = np.random.uniform(10, 1000, size=n_instances)

# Generating random discounts


discounts = np.random.uniform(0, 0.5, size=n_instances)

# Generating random sale months


sale_months = np.random.randint(1, 13, size=n_instances)

# Generating random values for 'No of Distribution'


no_of_distribution = np.random.randint(1, 100, size=n_instances)

# Determine 'Need Improvement' based on conditions


condition = ((market_prices > 500) & (no_of_distribution < 20)) | ((sale_months < 6) & (market_prices > 400))
need_improvement = np.where(condition, 'Yes', 'No')

# Create a DataFrame
data = {
'Product ID': product_ids,
'Product Type': product_types,
'Market Price': market_prices,
'Discount': discounts,
'Sales Month': sale_months,
'No of Distribution': no_of_distribution,
'Need Improvement': need_improvement
}

df = pd.DataFrame(data)

# Display the first few rows of the DataFrame


print(df.to_string())

# Save the dataset to a CSV file


df.to_csv('dataset2.csv', index=False)
Product ID Product Type Market Price Discount Sales Month No of Distribution Need Improvement
0 3732 Home Decor 238.759350 0.461047 9 83 No
1 4264 Dairy 543.479818 0.318920 7 81 No
2 5859 Home Decor 775.304626 0.048948 1 58 Yes
3 8891 Dairy 749.118445 0.130456 1 44 Yes
4 5373 Books 724.215809 0.088965 3 34 Yes
5 6874 Clothing 488.062706 0.310027 4 70 Yes
6 7744 Home Decor 202.082587 0.077195 3 94 No
7 4468 Electronics 213.510659 0.220424 2 80 No
8 1705 Furniture 540.113574 0.276220 12 90 No
9 3599 Home Decor 443.436109 0.113935 10 25 No
10 3222 Electronics 975.239914 0.113578 6 61 No
11 8768 Books 307.815686 0.133473 7 65 No
12 3897 Dairy 88.180210 0.448529 2 62 No
13 1537 Clothing 729.609186 0.282314 11 78 No
14 7216 Electronics 975.669893 0.062906 12 13 Yes
15 7921 Clothing 784.268483 0.102506 9 71 No
16 7036 Dairy 254.574760 0.468422 12 50 No
17 3163 Clothing 46.195376 0.186553 8 4 No
18 6072 Clothing 412.852712 0.175194 12 33 No
19 5851 Home Decor 878.973281 0.234997 8 50 No
20 8877 Furniture 437.673847 0.197080 4 14 Yes
21 3046 Electronics 291.245274 0.169141 5 76 No
22 2871 Books 935.948867 0.183240 10 18 Yes
23 8599 Clothing 774.542927 0.433229 7 69 No
24 3496 Clothing 614.876643 0.347364 10 88 No
25 9291 Home Decor 12.650300 0.008884 7 48 No
26 1755 Books 932.189983 0.479073 5 75 Yes
27 1797 Electronics 677.098970 0.411786 12 39 No
28 1659 Dairy 232.222269 0.460530 2 49 No
29 4219 Furniture 34.505548 0.120348 3 37 No
30 9615 Books 17.393635 0.344231 1 94 No
31 8456 Clothing 928.128526 0.488381 1 26 Yes
32 4337 Dairy 696.221275 0.063544 11 36 No
33 3745 Furniture 708.096065 0.373344 8 72 No
34 5735 Books 600.104340 0.121266 7 65 No
35 9736 Clothing 541.863298 0.255010 3 65 Yes
36 7687 Electronics 461.022775 0.126237 11 9 No
37 1714 Books 604.191277 0.324516 12 68 No
38 3292 Clothing 657.541112 0.343795 10 7 Yes
39 9343 Dairy 379.309379 0.021308 11 8 No
40 2207 Books 671.551633 0.274619 9 52 No
41 7172 Furniture 462.315801 0.321599 9 78 No
42 9994 Electronics 94.216141 0.285212 3 83 No
43 8221 Books 240.842014 0.136839 2 18 No
44 7021 Home Decor 90.558002 0.110412 11 4 No
45 4622 Books 328.797162 0.076791 3 9 No
46 4560 Home Decor 615.214146 0.379937 12 48 No
47 9948 Electronics 373.949912 0.396359 8 44 No
48 2641 Home Decor 728.964911 0.275169 7 62 No
49 5984 Dairy 681.278816 0.266163 7 4 Yes
50 5353 Furniture 153.244228 0.180553 3 45 No
51 9622 Clothing 176.362096 0.037925 12 76 No
52 8250 Dairy 73.791091 0.492015 2 50 No
53 5187 Clothing 271.689430 0.434924 6 51 No
54 3659 Home Decor 354.873186 0.102750 7 11 No
55 3956 Furniture 97.365757 0.212426 10 44 No
56 3251 Dairy 606.206885 0.326257 10 80 No
57 5420 Books 717.231983 0.276323 4 92 Yes
58 8108 Dairy 165.649880 0.125600 10 63 No
59 2071 Clothing 348.716137 0.162026 12 83 No
60 6251 Books 729.977407 0.394082 5 63 Yes
61 8012 Electronics 666.684745 0.081225 12 36 No
62 4918 Dairy 855.915428 0.040791 3 86 Yes
63 2684 Dairy 559.057355 0.256592 2 29 Yes
64 8098 Books 35.498895 0.110665 7 60 No
65 3957 Dairy 66.747418 0.116158 1 98 No
66 5469 Books 89.260482 0.262958 3 90 No
67 9752 Electronics 521.965904 0.249267 7 75 No
68 6795 Dairy 757.555117 0.463979 4 2 Yes
69 2472 Clothing 41.950555 0.251725 8 22 No
70 8263 Dairy 462.120717 0.098187 6 26 No
71 8365 Books 826.549729 0.013539 11 11 Yes
72 9448 Books 671.919789 0.042089 11 42 No
73 7001 Clothing 550.458421 0.209929 3 14 Yes
74 4762 Clothing 592.923593 0.258561 7 52 No
75 3435 Books 897.515200 0.323245 7 67 No
76 2634 Home Decor 579.327034 0.235603 11 83 No
77 1973 Books 427.601028 0.329100 12 85 No
78 5464 Dairy 705.922194 0.000358 2 8 Yes
79 9393 Books 363.635350 0.007390 10 41 No
80 3418 Clothing 973.182626 0.401367 11 57 No
81 4455 Dairy 873.579485 0.306851 1 86 Yes
82 7167 Books 165.086956 0.377869 2 38 No
83 6819 Electronics 687.284471 0.189202 4 47 Yes
84 7521 Clothing 43.730058 0.300467 4 84 No
85 7242 Home Decor 886.355202 0.234585 2 91 Yes
86 8742 Electronics 846.405048 0.362658 12 56 No
87 7738 Dairy 515.026720 0.048830 4 7 Yes
88 3787 Clothing 136.411755 0.058746 5 1 No
89 8316 Dairy 625.258306 0.406612 4 9 Yes
90 5305 Furniture 246.943634 0.052686 10 86 No
91 3610 Clothing 634.562356 0.482255 10 38 No
92 6531 Dairy 696.808255 0.356320 6 68 No
93 7926 Electronics 115.192361 0.261997 7 47 No
94 8204 Dairy 482.176433 0.443059 9 42 No
95 7922 Books 589.737447 0.431665 11 93 No
96 5182 Books 261.089451 0.387713 10 64 No
97 1307 Electronics 209.000183 0.398646 12 58 No
98 6302 Dairy 641.477192 0.390745 6 40 No
99 2152 Clothing 763.136129 0.284853 6 66 No
100 7950 Electronics 365.519548 0.363426 9 52 No
101 9467 Dairy 711.808582 0.228575 5 62 Yes
102 6294 Furniture 591.501555 0.401108 6 70 No
103 2208 Books 811.497448 0.371766 1 59 Yes
104 3492 Electronics 212.031341 0.433146 4 92 No
105 9829 Dairy 798.432798 0.463745 2 96 Yes
106 1770 Furniture 273.743823 0.006819 7 41 No
107 9286 Books 305.281777 0.240211 9 74 No
108 6995 Furniture 978.390452 0.458576 7 54 No
109 3344 Home Decor 55.553441 0.084967 4 8 No
110 4091 Electronics 197.856080 0.019611 5 48 No
111 4912 Dairy 525.666047 0.215073 6 70 No
112 2434 Furniture 382.234328 0.215627 9 42 No
113 7594 Furniture 249.678711 0.265598 12 29 No
114 6368 Furniture 687.707212 0.235324 3 86 Yes
115 9372 Clothing 672.544594 0.348997 10 12 Yes
116 8148 Furniture 964.103585 0.270911 4 4 Yes
117 8997 Dairy 879.814371 0.271170 3 19 Yes
118 4854 Dairy 997.461766 0.333607 10 36 No
119 9032 Dairy 369.259117 0.261195 2 47 No
120 9131 Books 54.782145 0.031065 2 18 No
121 5845 Furniture 332.043840 0.405629 11 28 No
122 6116 Electronics 501.945601 0.143227 9 55 No
123 4533 Books 180.473750 0.450825 11 74 No
124 3937 Home Decor 94.225314 0.321117 7 20 No
125 5939 Clothing 458.201570 0.381934 11 72 No
126 4224 Dairy 933.338876 0.156255 4 72 Yes
127 6021 Clothing 765.533357 0.078049 12 44 No
128 2134 Books 318.371208 0.325734 3 45 No
129 1025 Clothing 889.729340 0.168541 3 47 Yes
130 1956 Books 700.301550 0.215118 5 35 Yes
131 2913 Home Decor 468.710577 0.424668 11 34 No
132 3934 Clothing 271.973334 0.011166 8 75 No
133 3721 Dairy 579.778549 0.397153 3 70 Yes
134 1928 Home Decor 202.951994 0.462146 5 93 No
135 6627 Furniture 743.819349 0.253125 5 47 Yes
136 7265 Dairy 937.558601 0.072090 10 33 No
137 6446 Home Decor 662.675188 0.198117 12 84 No
138 1469 Dairy 727.744153 0.074487 2 40 Yes
139 9717 Dairy 172.843528 0.061372 6 31 No
140 2863 Furniture 750.741729 0.481956 4 96 Yes
141 2720 Dairy 502.383271 0.151711 8 48 No
142 6272 Books 96.508863 0.133340 5 2 No
143 1591 Home Decor 392.582932 0.385546 11 33 No
144 7185 Clothing 732.153633 0.264160 3 64 Yes
145 3322 Furniture 582.428246 0.436495 12 46 No
146 1207 Electronics 313.318825 0.499927 1 56 No
147 5262 Home Decor 988.861513 0.040142 12 65 No
148 4421 Books 578.291521 0.071539 10 86 No
149 6249 Home Decor 945.499700 0.471552 3 23 Yes
150 9408 Furniture 564.176489 0.105651 3 28 Yes
151 9216 Clothing 569.019870 0.022465 10 6 Yes
152 6103 Furniture 60.658733 0.430181 7 36 No
153 8939 Books 113.037979 0.036787 9 36 No
154 3282 Books 618.293682 0.480921 10 68 No
155 2740 Home Decor 734.317376 0.380140 2 29 Yes
156 7118 Electronics 251.592104 0.202211 2 92 No
157 6846 Dairy 964.335969 0.032559 2 10 Yes
158 4781 Clothing 743.825693 0.355807 1 44 Yes
159 3775 Home Decor 245.631165 0.284917 2 4 No
160 3603 Books 647.976079 0.075693 8 12 Yes
161 8179 Books 346.358816 0.313671 1 52 No
162 7356 Clothing 730.205933 0.328651 7 87 No
163 2162 Home Decor 588.746651 0.472709 12 5 Yes
164 1623 Books 759.087180 0.228918 6 30 No
165 9962 Electronics 258.949150 0.256244 10 61 No
166 5051 Electronics 932.972356 0.454269 9 45 No
167 2241 Dairy 993.071301 0.123201 6 3 Yes
168 5403 Home Decor 172.887392 0.131673 7 95 No
169 2198 Home Decor 517.776270 0.465055 9 70 No
170 3997 Home Decor 864.841456 0.186724 2 48 Yes
171 6661 Furniture 354.221009 0.385816 5 77 No
172 1807 Clothing 250.210953 0.169922 6 18 No
173 3121 Electronics 733.754557 0.109064 10 80 No
174 9067 Electronics 977.742645 0.154410 1 57 Yes
175 4886 Electronics 508.710341 0.253483 6 42 No
176 9922 Electronics 398.506263 0.110891 7 25 No
177 7066 Dairy 398.013537 0.365001 10 86 No
178 2823 Books 796.561394 0.037461 2 4 Yes
179 1199 Home Decor 709.000397 0.276658 2 61 Yes
180 2447 Electronics 325.728153 0.288328 4 47 No
181 6181 Home Decor 974.842770 0.157835 2 32 Yes
182 6208 Dairy 892.664682 0.022234 11 71 No
183 7177 Furniture 703.918783 0.256155 7 52 No
184 5863 Home Decor 446.369421 0.031913 11 98 No
185 7180 Books 215.223020 0.424031 1 48 No
186 2792 Furniture 668.315055 0.474685 8 12 Yes
187 2483 Books 756.351166 0.132479 12 63 No
188 9389 Home Decor 608.036771 0.050687 7 9 Yes
189 1894 Books 500.660613 0.143363 12 63 No
190 6374 Books 126.861149 0.098323 5 4 No
191 1136 Dairy 786.883264 0.004452 10 56 No
192 7273 Clothing 496.675513 0.445651 3 55 Yes
193 4419 Furniture 855.573736 0.394508 4 42 Yes
194 1168 Books 143.470459 0.151439 11 55 No
195 7004 Books 965.438490 0.322413 7 26 No
196 3852 Electronics 496.289031 0.485205 7 7 No
197 5419 Home Decor 81.626865 0.392778 3 72 No
198 9039 Electronics 287.312611 0.374487 2 64 No
199 9700 Dairy 903.554405 0.303812 11 94 No
200 4186 Books 340.677769 0.184970 8 70 No
201 6918 Furniture 970.377322 0.292320 9 39 No
202 6149 Home Decor 449.680195 0.078641 9 68 No
203 2777 Furniture 373.375782 0.018882 12 8 No
204 4361 Electronics 791.871918 0.196376 12 44 No
205 9338 Electronics 472.448213 0.077065 5 24 Yes
206 6393 Clothing 84.810897 0.076371 3 89 No
207 5317 Books 830.552497 0.239915 12 30 No
208 5605 Books 792.557667 0.088468 10 52 No
209 3562 Home Decor 519.842985 0.099940 12 18 Yes
210 7213 Electronics 19.586484 0.287569 9 57 No
211 5652 Electronics 144.993437 0.228531 11 44 No
212 7235 Electronics 714.870671 0.359060 1 34 Yes
213 1423 Clothing 594.948974 0.231525 12 49 No
214 7854 Home Decor 703.044057 0.153653 4 79 Yes
215 1967 Clothing 367.325128 0.317934 1 43 No
216 5370 Clothing 633.082941 0.241314 6 81 No
217 7187 Books 440.478370 0.488792 8 2 No
218 6203 Clothing 419.663010 0.123884 8 54 No
219 1433 Books 420.882292 0.337529 5 65 Yes
220 7237 Electronics 41.735063 0.493685 12 57 No
221 2429 Books 70.385057 0.462997 9 16 No
222 3546 Furniture 850.825972 0.126284 3 81 Yes
223 1329 Home Decor 698.570285 0.359735 12 73 No
224 4612 Dairy 238.107585 0.193269 10 21 No
225 9401 Electronics 126.945435 0.379745 6 62 No
226 7761 Furniture 50.303160 0.062854 2 64 No
227 4968 Dairy 484.910082 0.486548 8 55 No
228 9150 Furniture 592.087454 0.074749 8 44 No
229 2040 Dairy 898.976377 0.349768 2 26 Yes
230 7250 Dairy 921.069037 0.172757 6 1 Yes
231 9356 Clothing 372.581876 0.093469 1 50 No
232 9798 Furniture 931.531060 0.195427 8 40 No
233 8704 Home Decor 550.321547 0.485680 9 3 Yes
234 7772 Furniture 578.350977 0.057384 5 71 Yes
235 6311 Electronics 186.849282 0.016547 6 4 No
236 7011 Home Decor 124.702839 0.398059 3 31 No
237 3798 Books 251.932312 0.409998 1 14 No
238 9352 Home Decor 133.046005 0.242897 9 21 No
239 3195 Home Decor 231.058753 0.480466 7 76 No
240 5680 Home Decor 544.415244 0.313858 12 12 Yes
241 7599 Furniture 869.572434 0.295499 6 6 Yes
242 4085 Furniture 797.037908 0.416472 4 17 Yes
243 6713 Electronics 42.032670 0.000558 9 78 No
244 6240 Electronics 701.571836 0.098350 11 63 No
245 1732 Clothing 56.323870 0.143571 10 9 No
246 6028 Home Decor 998.045231 0.223368 1 28 Yes
247 9473 Books 786.273207 0.061898 11 7 Yes
248 8594 Books 239.067962 0.429862 8 43 No
249 5566 Clothing 495.209162 0.357811 3 5 Yes
250 8444 Home Decor 746.660219 0.385498 11 16 Yes
251 4396 Home Decor 841.408459 0.045560 9 61 No
252 6347 Home Decor 236.568816 0.250731 8 1 No
253 8034 Electronics 142.609402 0.059863 7 40 No
254 1595 Electronics 931.765827 0.137020 1 38 Yes
255 1647 Electronics 674.054039 0.460274 6 7 Yes
256 1573 Furniture 877.522042 0.386314 3 94 Yes
257 7797 Books 240.059323 0.386028 11 59 No
258 6637 Books 137.409648 0.376543 7 26 No
259 9448 Dairy 356.821934 0.202322 9 77 No
260 6259 Dairy 260.172935 0.043478 5 65 No
261 7567 Furniture 82.026544 0.465439 1 63 No
262 5444 Furniture 648.034312 0.347197 4 53 Yes
263 3989 Books 258.699842 0.389121 11 51 No
264 1586 Home Decor 455.722225 0.395807 5 50 Yes
265 6102 Dairy 295.417548 0.411670 2 29 No
266 8601 Home Decor 921.980286 0.191171 9 72 No
267 1739 Clothing 455.707072 0.467391 3 66 Yes
268 5882 Electronics 881.058120 0.234794 9 51 No
269 6410 Books 53.576199 0.107980 10 8 No
270 1437 Clothing 540.443900 0.257312 9 27 No
271 4898 Furniture 458.203191 0.321998 8 41 No
272 2847 Electronics 332.856515 0.159710 10 62 No
273 2020 Furniture 307.187563 0.053403 4 49 No
274 7930 Dairy 274.120276 0.228432 7 23 No
275 1941 Home Decor 207.534238 0.243900 4 15 No
276 9641 Clothing 497.706108 0.385703 8 64 No
277 6610 Home Decor 351.686393 0.036211 8 96 No
278 3107 Electronics 337.294524 0.335215 3 86 No
279 5259 Electronics 75.545101 0.073995 8 53 No
280 1945 Furniture 23.726396 0.340557 12 8 No
281 9393 Home Decor 912.540188 0.170992 9 37 No
282 8468 Books 419.620845 0.422543 5 81 Yes
283 2805 Clothing 680.274094 0.228186 4 71 Yes
284 2862 Electronics 457.874975 0.116854 11 21 No
285 9742 Electronics 208.631294 0.381262 1 39 No
286 4751 Home Decor 930.180435 0.489327 3 5 Yes
287 3040 Dairy 131.435364 0.316822 11 17 No
288 1903 Clothing 486.561477 0.067214 6 99 No
289 9696 Clothing 100.810816 0.102187 5 57 No
290 9015 Electronics 236.983333 0.189831 3 15 No
291 6896 Home Decor 688.560783 0.248289 8 16 Yes
292 8942 Clothing 531.148414 0.010071 11 89 No
293 8377 Clothing 554.553964 0.240852 4 15 Yes
294 6593 Electronics 833.916472 0.237442 8 11 Yes
295 4128 Electronics 70.170375 0.217942 4 5 No
296 8026 Furniture 905.778441 0.154329 2 85 Yes
297 4821 Home Decor 654.715287 0.478471 5 53 Yes
298 3711 Furniture 644.498253 0.333003 6 76 No
299 9472 Home Decor 39.906118 0.393814 4 54 No
300 2028 Furniture 910.971891 0.257798 3 94 Yes
301 3660 Furniture 37.702171 0.183073 12 68 No
302 3353 Clothing 193.593490 0.185606 2 45 No
303 6662 Dairy 896.952080 0.136692 12 91 No
304 8734 Electronics 135.460395 0.273482 11 92 No
305 9345 Electronics 404.008276 0.427069 12 3 No
306 8521 Books 762.448709 0.019601 4 61 Yes
307 2053 Dairy 567.317968 0.375649 5 67 Yes
308 3977 Home Decor 733.173272 0.391882 5 24 Yes
309 6491 Dairy 200.917639 0.197362 7 29 No
310 4893 Electronics 417.931919 0.371897 10 54 No
311 3679 Dairy 503.404217 0.194644 10 19 Yes
312 5950 Home Decor 251.187289 0.157694 4 60 No
313 3665 Books 997.938349 0.117741 8 66 No
314 4057 Clothing 674.404419 0.401896 5 69 Yes
315 7838 Home Decor 884.941642 0.014540 12 37 No
316 4968 Furniture 399.037107 0.119549 1 82 No
317 1851 Books 925.591418 0.150680 11 25 No
318 6028 Home Decor 259.110489 0.303815 1 90 No
319 4793 Home Decor 166.305032 0.212909 1 77 No
320 8316 Furniture 788.991427 0.331531 1 35 Yes
321 9053 Electronics 973.286466 0.071531 5 86 Yes
322 8152 Clothing 71.415462 0.171727 12 57 No
323 4331 Books 109.002650 0.264655 6 64 No
324 9318 Dairy 324.718891 0.311283 6 74 No
325 6930 Clothing 530.691429 0.134800 10 37 No
326 9769 Books 707.228581 0.130585 3 42 Yes
327 6652 Clothing 955.995043 0.023192 11 7 Yes
328 1804 Electronics 126.641541 0.411355 1 18 No
329 6444 Dairy 362.751832 0.013973 8 32 No
330 4024 Furniture 273.621149 0.180317 2 7 No
331 1112 Furniture 809.344342 0.089953 12 51 No
332 2967 Home Decor 171.923207 0.250884 10 17 No
333 1650 Furniture 878.071175 0.490324 10 31 No
334 5333 Home Decor 775.973302 0.210493 11 29 No
335 2384 Books 884.980451 0.292814 1 76 Yes
336 1063 Clothing 969.476077 0.295585 8 33 No
337 4999 Dairy 577.709498 0.028499 7 90 No
338 4988 Dairy 463.828310 0.360569 8 39 No
339 3502 Home Decor 490.180228 0.388211 11 30 No
340 4516 Books 896.557805 0.366881 10 3 Yes
341 3671 Dairy 216.596496 0.073371 1 84 No
342 3387 Dairy 381.596928 0.226940 12 77 No
343 6394 Clothing 644.721602 0.198580 12 19 Yes
344 4441 Clothing 718.872322 0.192880 10 65 No
345 9010 Home Decor 65.808440 0.034146 5 42 No
346 2963 Clothing 978.372198 0.395152 9 23 No
347 6763 Books 338.137403 0.002465 6 18 No
348 3956 Home Decor 214.002902 0.081632 3 43 No
349 8396 Books 314.101221 0.348414 12 5 No
350 4898 Books 984.924748 0.113716 12 5 Yes
351 4969 Dairy 671.891385 0.423509 12 19 Yes
352 8296 Furniture 252.825163 0.300813 6 70 No
353 5903 Dairy 209.085058 0.376630 5 15 No
354 9890 Clothing 84.146214 0.112904 2 11 No
355 1292 Furniture 369.581839 0.375691 1 51 No
356 5099 Electronics 825.515629 0.418027 3 94 Yes
357 6346 Furniture 282.671011 0.271009 6 84 No
358 8033 Clothing 374.806051 0.013700 5 35 No
359 5776 Clothing 763.822326 0.164986 3 4 Yes
360 8452 Clothing 698.987390 0.295571 8 9 Yes
361 7980 Home Decor 418.309214 0.469047 4 91 Yes
362 5122 Clothing 172.676123 0.108752 6 83 No
363 1736 Electronics 894.835028 0.021858 11 69 No
364 5461 Home Decor 579.311094 0.297993 7 8 Yes
365 2971 Furniture 264.200138 0.270505 5 94 No
366 9389 Electronics 244.422136 0.203247 10 36 No
367 2671 Dairy 453.901817 0.476782 9 80 No
368 1606 Furniture 409.115710 0.042144 1 47 Yes
369 3120 Dairy 78.191650 0.475551 11 46 No
370 7996 Dairy 943.711015 0.017495 11 68 No
371 2731 Home Decor 789.084602 0.269472 12 59 No
372 8788 Dairy 501.582647 0.472818 1 4 Yes
373 4395 Home Decor 333.633698 0.230877 3 71 No
374 7246 Clothing 189.661557 0.055124 7 67 No
375 9020 Furniture 174.626674 0.484344 2 25 No
376 9787 Books 248.085492 0.225795 6 56 No
377 6343 Furniture 228.323017 0.407805 10 60 No
378 3304 Clothing 712.603532 0.340789 6 36 No
379 4419 Furniture 771.937425 0.202894 3 4 Yes
380 2131 Home Decor 369.846947 0.491204 4 72 No
381 3003 Clothing 167.799770 0.328571 12 28 No
382 8644 Furniture 648.286997 0.378735 4 67 Yes
383 2707 Furniture 339.502677 0.010834 4 72 No
384 9192 Home Decor 932.926711 0.304586 9 11 Yes
385 8528 Dairy 790.774351 0.472595 6 64 No
386 1691 Electronics 987.880805 0.121007 12 6 Yes
387 3547 Furniture 888.489431 0.125149 10 41 No
388 3683 Books 15.261890 0.425098 6 87 No
389 9535 Electronics 69.731990 0.472660 2 53 No
390 7995 Books 899.210335 0.185647 9 44 No
391 7862 Home Decor 127.742950 0.337878 11 66 No
392 7176 Furniture 599.627810 0.457824 8 7 Yes
393 7598 Clothing 361.272920 0.047562 8 29 No
394 6985 Home Decor 43.433852 0.242471 2 6 No
395 5524 Furniture 92.047411 0.390394 10 75 No
396 1827 Dairy 768.174155 0.324248 1 8 Yes
397 7834 Clothing 843.977798 0.063256 10 30 No
398 4204 Books 369.591722 0.430013 5 83 No
399 1093 Furniture 254.304679 0.309037 7 48 No
400 3467 Home Decor 498.654698 0.475330 1 61 Yes
401 4778 Home Decor 160.760275 0.300901 12 64 No
402 1404 Furniture 620.771105 0.407293 4 67 Yes
403 6037 Clothing 742.112694 0.493692 4 42 Yes
404 1375 Furniture 706.925917 0.393726 5 30 Yes
405 4945 Electronics 932.758842 0.245690 11 97 No
406 1497 Books 605.696419 0.294236 2 50 Yes
407 8666 Furniture 599.245450 0.286623 11 61 No
408 8373 Furniture 739.615385 0.024728 1 53 Yes
409 9930 Clothing 728.525874 0.192646 5 26 Yes
410 5515 Dairy 286.380025 0.211138 7 37 No
411 7729 Home Decor 799.281387 0.064816 9 20 No
412 4290 Books 905.395360 0.020653 3 97 Yes
413 2562 Electronics 781.614645 0.002374 2 92 Yes
414 9652 Home Decor 850.889132 0.178403 3 27 Yes
415 4123 Electronics 850.234317 0.121266 2 57 Yes
416 2838 Clothing 255.141616 0.277693 1 57 No
417 7959 Electronics 828.780518 0.461967 2 29 Yes
418 5736 Dairy 721.791290 0.019524 7 46 No
419 4466 Furniture 330.131824 0.217633 5 88 No
420 5043 Books 677.935990 0.333823 5 83 Yes
421 7029 Home Decor 676.458623 0.042104 12 6 Yes
422 5702 Furniture 804.332197 0.305985 6 66 No
423 6638 Clothing 10.059963 0.184549 10 86 No
424 8853 Furniture 650.737759 0.382635 4 35 Yes
425 6534 Dairy 676.160271 0.123808 7 2 Yes
426 7310 Electronics 581.639071 0.061748 11 94 No
427 3987 Home Decor 779.604080 0.053521 1 99 Yes
428 5690 Books 152.093283 0.247382 3 15 No
429 4292 Dairy 308.295836 0.281033 1 31 No
430 3881 Home Decor 758.308858 0.109392 8 10 Yes
431 6801 Clothing 349.491586 0.275400 8 55 No
432 8282 Books 607.612927 0.358926 2 28 Yes
433 9526 Furniture 625.178664 0.124901 5 8 Yes
434 9933 Clothing 305.627526 0.005082 10 77 No
435 9292 Furniture 466.300299 0.415533 9 94 No
436 3463 Dairy 687.951164 0.421839 12 37 No
437 8676 Home Decor 775.922453 0.188840 1 39 Yes
438 9366 Dairy 650.745793 0.469122 4 93 Yes
439 9797 Clothing 391.881675 0.413398 11 86 No
440 8794 Electronics 41.258852 0.158687 5 88 No
441 4745 Clothing 901.997833 0.299096 11 38 No
442 5876 Electronics 19.281426 0.202061 7 21 No
443 4808 Clothing 111.366052 0.058434 2 14 No
444 6576 Clothing 785.441443 0.206241 4 41 Yes
445 3173 Books 70.283303 0.421829 4 51 No
446 5720 Electronics 886.938376 0.261554 3 55 Yes
447 7874 Electronics 899.129859 0.304201 5 66 Yes
448 2179 Home Decor 65.421625 0.179937 5 73 No
449 9888 Dairy 951.446302 0.087902 11 59 No
450 8288 Furniture 519.317839 0.285020 5 74 Yes
451 3496 Dairy 10.684640 0.275889 10 50 No
452 3757 Electronics 528.131032 0.478065 6 18 Yes
453 8458 Books 386.789424 0.004679 9 50 No
454 5047 Electronics 985.506243 0.449077 4 90 Yes
455 3051 Home Decor 267.982372 0.462924 7 88 No
456 7844 Furniture 452.081272 0.120312 6 58 No
457 4310 Furniture 103.750259 0.022839 4 75 No
458 8845 Clothing 877.881924 0.424430 4 91 Yes
459 2747 Books 47.159007 0.084488 8 14 No
460 8828 Home Decor 773.528770 0.198442 1 32 Yes
461 4868 Dairy 285.545519 0.226599 10 22 No
462 5723 Books 147.741952 0.162499 8 98 No
463 5998 Clothing 704.426344 0.213264 11 2 Yes
464 5930 Electronics 628.252502 0.155623 5 97 Yes
465 1604 Home Decor 45.225984 0.262612 1 44 No
466 9156 Furniture 394.287392 0.020009 12 56 No
467 4686 Electronics 560.122248 0.295485 11 71 No
468 4451 Electronics 362.875490 0.076444 12 35 No
469 4781 Clothing 635.401341 0.488201 6 95 No
470 1100 Dairy 467.956911 0.322804 11 47 No
471 5790 Electronics 649.865895 0.003960 4 91 Yes
472 7037 Furniture 613.441349 0.019535 12 18 Yes
473 6627 Furniture 208.941056 0.134866 7 13 No
474 9863 Dairy 344.462458 0.381968 8 53 No
475 4665 Dairy 310.220292 0.046132 1 48 No
476 4107 Clothing 980.605699 0.331034 4 40 Yes
477 9429 Books 251.464763 0.275788 3 49 No
478 7910 Furniture 238.002529 0.218266 1 56 No
479 1021 Electronics 66.895927 0.088669 8 26 No
480 7573 Clothing 948.958673 0.016360 1 65 Yes
481 2253 Dairy 481.243126 0.256185 8 61 No
482 7102 Electronics 989.141813 0.257305 3 31 Yes
483 9592 Books 752.204430 0.007450 1 93 Yes
484 4191 Home Decor 43.903450 0.321288 3 88 No
485 9063 Dairy 797.589934 0.180686 7 80 No
486 2734 Books 909.646106 0.240654 1 39 Yes
487 7540 Books 738.382685 0.229543 9 87 No
488 4418 Furniture 273.271183 0.348795 4 49 No
489 9778 Home Decor 153.981247 0.253123 11 8 No
490 6046 Furniture 202.117508 0.185026 4 38 No
491 8246 Books 992.957821 0.098248 7 67 No
492 4205 Home Decor 505.021188 0.014941 7 78 No
493 6290 Furniture 996.575458 0.113091 7 21 No
494 5547 Home Decor 662.018030 0.310905 5 47 Yes
495 7282 Home Decor 931.124101 0.129070 11 94 No
496 5850 Dairy 646.984921 0.339347 3 33 Yes
497 2337 Books 254.111283 0.468795 6 53 No
498 4547 Books 321.871880 0.128284 5 56 No
499 1387 Clothing 903.949067 0.386916 11 20 No

In [5]: import pandas as pd


import numpy as np
import tensorflow as tf
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelEncoder

# Load the dataset


df = pd.read_csv('dataset2.csv')

# Preprocessing
X = df.drop('Need Improvement', axis=1)
Y = df['Need Improvement']

# Encoding categorical variables


encoder = LabelEncoder()
X['Product Type'] = encoder.fit_transform(X['Product Type'])
Y = encoder.fit_transform(Y)

# Splitting the dataset into the Training set and Test set
X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size=0.2, random_state=42)

# Initializing ANN
ann = tf.keras.models.Sequential()
# Adding First Hidden Layer
ann.add(tf.keras.layers.Dense(units=6, activation="relu"))
# Creating Output Layer with softmax activation for multi-class classification
ann.add(tf.keras.layers.Dense(units=2, activation="softmax"))
# Compiling ANN
ann.compile(optimizer="adam", loss="sparse_categorical_crossentropy", metrics=['accuracy'])
# Fitting ANN
ann.fit(X_train, Y_train, batch_size=32, epochs=500)
# Evaluate ANN on the test set
test_loss, test_accuracy = ann.evaluate(X_test, Y_test)
print(f"Test Loss: {test_loss}")
print(f"Test Accuracy: {test_accuracy}")
Epoch 1/500
13/13 [==============================] - 1s 4ms/step - loss: 2768.8875 - accuracy: 0.3325
Epoch 2/500
13/13 [==============================] - 0s 4ms/step - loss: 2604.3115 - accuracy: 0.3325
Epoch 3/500
13/13 [==============================] - 0s 4ms/step - loss: 2447.1526 - accuracy: 0.3325
Epoch 4/500
13/13 [==============================] - 0s 4ms/step - loss: 2295.4780 - accuracy: 0.3325
Epoch 5/500
13/13 [==============================] - 0s 3ms/step - loss: 2152.2021 - accuracy: 0.3325
Epoch 6/500
13/13 [==============================] - 0s 4ms/step - loss: 2017.7281 - accuracy: 0.3325
Epoch 7/500
13/13 [==============================] - 0s 4ms/step - loss: 1887.2980 - accuracy: 0.3325
Epoch 8/500
13/13 [==============================] - 0s 4ms/step - loss: 1765.4678 - accuracy: 0.3325
Epoch 9/500
13/13 [==============================] - 0s 4ms/step - loss: 1650.0900 - accuracy: 0.3325
Epoch 10/500
13/13 [==============================] - 0s 4ms/step - loss: 1539.8113 - accuracy: 0.3325
Epoch 11/500
13/13 [==============================] - 0s 4ms/step - loss: 1436.3506 - accuracy: 0.3325
Epoch 12/500
13/13 [==============================] - 0s 4ms/step - loss: 1336.8367 - accuracy: 0.3325
Epoch 13/500
13/13 [==============================] - 0s 4ms/step - loss: 1244.3463 - accuracy: 0.3325
Epoch 14/500
13/13 [==============================] - 0s 3ms/step - loss: 1157.0068 - accuracy: 0.3325
Epoch 15/500
13/13 [==============================] - 0s 3ms/step - loss: 1073.4574 - accuracy: 0.3325
Epoch 16/500
13/13 [==============================] - 0s 4ms/step - loss: 996.1408 - accuracy: 0.3325
Epoch 17/500
13/13 [==============================] - 0s 3ms/step - loss: 923.6188 - accuracy: 0.3325
Epoch 18/500
13/13 [==============================] - 0s 5ms/step - loss: 855.5767 - accuracy: 0.3325
Epoch 19/500
13/13 [==============================] - 0s 3ms/step - loss: 790.8569 - accuracy: 0.3325
Epoch 20/500
13/13 [==============================] - 0s 3ms/step - loss: 731.1816 - accuracy: 0.3325
Epoch 21/500
13/13 [==============================] - 0s 3ms/step - loss: 673.8420 - accuracy: 0.3325
Epoch 22/500
13/13 [==============================] - 0s 4ms/step - loss: 621.4019 - accuracy: 0.3325
Epoch 23/500
13/13 [==============================] - 0s 3ms/step - loss: 571.1108 - accuracy: 0.3325
Epoch 24/500
13/13 [==============================] - 0s 3ms/step - loss: 525.4233 - accuracy: 0.3325
Epoch 25/500
13/13 [==============================] - 0s 5ms/step - loss: 481.2599 - accuracy: 0.3325
Epoch 26/500
13/13 [==============================] - 0s 3ms/step - loss: 440.0471 - accuracy: 0.3325
Epoch 27/500
13/13 [==============================] - 0s 3ms/step - loss: 401.7426 - accuracy: 0.3325
Epoch 28/500
13/13 [==============================] - 0s 3ms/step - loss: 364.5751 - accuracy: 0.3325
Epoch 29/500
13/13 [==============================] - 0s 3ms/step - loss: 330.1614 - accuracy: 0.3325
Epoch 30/500
13/13 [==============================] - 0s 3ms/step - loss: 297.6785 - accuracy: 0.3325
Epoch 31/500
13/13 [==============================] - 0s 3ms/step - loss: 266.2175 - accuracy: 0.3325
Epoch 32/500
13/13 [==============================] - 0s 4ms/step - loss: 235.6310 - accuracy: 0.3325
Epoch 33/500
13/13 [==============================] - 0s 3ms/step - loss: 206.9955 - accuracy: 0.3325
Epoch 34/500
13/13 [==============================] - 0s 3ms/step - loss: 179.3041 - accuracy: 0.3325
Epoch 35/500
13/13 [==============================] - 0s 3ms/step - loss: 152.0382 - accuracy: 0.3325
Epoch 36/500
13/13 [==============================] - 0s 3ms/step - loss: 124.7569 - accuracy: 0.3325
Epoch 37/500
13/13 [==============================] - 0s 3ms/step - loss: 98.2413 - accuracy: 0.3325
Epoch 38/500
13/13 [==============================] - 0s 4ms/step - loss: 70.4909 - accuracy: 0.3325
Epoch 39/500
13/13 [==============================] - 0s 3ms/step - loss: 42.5739 - accuracy: 0.3375
Epoch 40/500
13/13 [==============================] - 0s 3ms/step - loss: 18.3621 - accuracy: 0.5325
Epoch 41/500
13/13 [==============================] - 0s 3ms/step - loss: 10.4760 - accuracy: 0.6575
Epoch 42/500
13/13 [==============================] - 0s 3ms/step - loss: 9.3661 - accuracy: 0.6775
Epoch 43/500
13/13 [==============================] - 0s 3ms/step - loss: 9.1881 - accuracy: 0.6750
Epoch 44/500
13/13 [==============================] - 0s 3ms/step - loss: 8.9637 - accuracy: 0.6800
Epoch 45/500
13/13 [==============================] - 0s 3ms/step - loss: 8.7595 - accuracy: 0.6775
Epoch 46/500
13/13 [==============================] - 0s 3ms/step - loss: 8.5807 - accuracy: 0.6775
Epoch 47/500
13/13 [==============================] - 0s 3ms/step - loss: 8.4279 - accuracy: 0.6750
Epoch 48/500
13/13 [==============================] - 0s 3ms/step - loss: 8.2040 - accuracy: 0.6800
Epoch 49/500
13/13 [==============================] - 0s 5ms/step - loss: 8.0379 - accuracy: 0.6800
Epoch 50/500
13/13 [==============================] - 0s 3ms/step - loss: 7.8551 - accuracy: 0.6800
Epoch 51/500
13/13 [==============================] - 0s 3ms/step - loss: 7.6454 - accuracy: 0.6825
Epoch 52/500
13/13 [==============================] - 0s 3ms/step - loss: 7.4645 - accuracy: 0.6775
Epoch 53/500
13/13 [==============================] - 0s 4ms/step - loss: 7.2995 - accuracy: 0.6750
Epoch 54/500
13/13 [==============================] - 0s 3ms/step - loss: 7.1178 - accuracy: 0.6750
Epoch 55/500
13/13 [==============================] - 0s 3ms/step - loss: 6.9163 - accuracy: 0.6850
Epoch 56/500
13/13 [==============================] - 0s 3ms/step - loss: 6.7172 - accuracy: 0.6900
Epoch 57/500
13/13 [==============================] - 0s 3ms/step - loss: 6.5326 - accuracy: 0.6850
Epoch 58/500
13/13 [==============================] - 0s 3ms/step - loss: 6.3586 - accuracy: 0.6875
Epoch 59/500
13/13 [==============================] - 0s 3ms/step - loss: 6.1669 - accuracy: 0.6925
Epoch 60/500
13/13 [==============================] - 0s 3ms/step - loss: 5.9940 - accuracy: 0.6850
Epoch 61/500
13/13 [==============================] - 0s 3ms/step - loss: 5.7872 - accuracy: 0.6850
Epoch 62/500
13/13 [==============================] - 0s 3ms/step - loss: 5.6028 - accuracy: 0.6925
Epoch 63/500
13/13 [==============================] - 0s 3ms/step - loss: 5.4125 - accuracy: 0.6900
Epoch 64/500
13/13 [==============================] - 0s 3ms/step - loss: 5.2326 - accuracy: 0.6850
Epoch 65/500
13/13 [==============================] - 0s 3ms/step - loss: 5.0151 - accuracy: 0.6875
Epoch 66/500
13/13 [==============================] - 0s 3ms/step - loss: 4.8308 - accuracy: 0.6900
Epoch 67/500
13/13 [==============================] - 0s 4ms/step - loss: 4.6520 - accuracy: 0.7025
Epoch 68/500
13/13 [==============================] - 0s 3ms/step - loss: 4.4486 - accuracy: 0.7025
Epoch 69/500
13/13 [==============================] - 0s 3ms/step - loss: 4.2515 - accuracy: 0.6925
Epoch 70/500
13/13 [==============================] - 0s 5ms/step - loss: 4.0547 - accuracy: 0.7025
Epoch 71/500
13/13 [==============================] - 0s 3ms/step - loss: 3.8976 - accuracy: 0.7075
Epoch 72/500
13/13 [==============================] - 0s 3ms/step - loss: 3.6774 - accuracy: 0.7125
Epoch 73/500
13/13 [==============================] - 0s 3ms/step - loss: 3.5136 - accuracy: 0.7125
Epoch 74/500
13/13 [==============================] - 0s 3ms/step - loss: 3.3177 - accuracy: 0.7200
Epoch 75/500
13/13 [==============================] - 0s 4ms/step - loss: 3.1513 - accuracy: 0.7225
Epoch 76/500
13/13 [==============================] - 0s 3ms/step - loss: 2.9661 - accuracy: 0.7300
Epoch 77/500
13/13 [==============================] - 0s 3ms/step - loss: 2.8444 - accuracy: 0.7250
Epoch 78/500
13/13 [==============================] - 0s 3ms/step - loss: 2.5921 - accuracy: 0.7300
Epoch 79/500
13/13 [==============================] - 0s 3ms/step - loss: 2.4473 - accuracy: 0.7225
Epoch 80/500
13/13 [==============================] - 0s 3ms/step - loss: 2.2812 - accuracy: 0.7250
Epoch 81/500
13/13 [==============================] - 0s 3ms/step - loss: 2.1207 - accuracy: 0.7350
Epoch 82/500
13/13 [==============================] - 0s 3ms/step - loss: 1.9610 - accuracy: 0.7375
Epoch 83/500
13/13 [==============================] - 0s 3ms/step - loss: 1.8313 - accuracy: 0.7325
Epoch 84/500
13/13 [==============================] - 0s 3ms/step - loss: 1.7124 - accuracy: 0.7400
Epoch 85/500
13/13 [==============================] - 0s 3ms/step - loss: 1.5830 - accuracy: 0.7425
Epoch 86/500
13/13 [==============================] - 0s 3ms/step - loss: 1.4444 - accuracy: 0.7475
Epoch 87/500
13/13 [==============================] - 0s 3ms/step - loss: 1.3486 - accuracy: 0.7550
Epoch 88/500
13/13 [==============================] - 0s 3ms/step - loss: 1.2625 - accuracy: 0.7550
Epoch 89/500
13/13 [==============================] - 0s 3ms/step - loss: 1.1759 - accuracy: 0.7475
Epoch 90/500
13/13 [==============================] - 0s 3ms/step - loss: 1.1102 - accuracy: 0.7525
Epoch 91/500
13/13 [==============================] - 0s 3ms/step - loss: 1.0629 - accuracy: 0.7525
Epoch 92/500
13/13 [==============================] - 0s 3ms/step - loss: 1.0464 - accuracy: 0.7500
Epoch 93/500
13/13 [==============================] - 0s 3ms/step - loss: 0.9922 - accuracy: 0.7550
Epoch 94/500
13/13 [==============================] - 0s 3ms/step - loss: 0.9521 - accuracy: 0.7600
Epoch 95/500
13/13 [==============================] - 0s 3ms/step - loss: 0.9345 - accuracy: 0.7550
Epoch 96/500
13/13 [==============================] - 0s 3ms/step - loss: 0.9074 - accuracy: 0.7525
Epoch 97/500
13/13 [==============================] - 0s 3ms/step - loss: 0.8994 - accuracy: 0.7525
Epoch 98/500
13/13 [==============================] - 0s 4ms/step - loss: 0.8916 - accuracy: 0.7550
Epoch 99/500
13/13 [==============================] - 0s 3ms/step - loss: 0.8706 - accuracy: 0.7475
Epoch 100/500
13/13 [==============================] - 0s 3ms/step - loss: 0.8765 - accuracy: 0.7425
Epoch 101/500
13/13 [==============================] - 0s 3ms/step - loss: 0.8637 - accuracy: 0.7675
Epoch 102/500
13/13 [==============================] - 0s 3ms/step - loss: 0.8549 - accuracy: 0.7525
Epoch 103/500
13/13 [==============================] - 0s 3ms/step - loss: 0.8534 - accuracy: 0.7550
Epoch 104/500
13/13 [==============================] - 0s 4ms/step - loss: 0.8383 - accuracy: 0.7600
Epoch 105/500
13/13 [==============================] - 0s 3ms/step - loss: 0.8566 - accuracy: 0.7450
Epoch 106/500
13/13 [==============================] - 0s 5ms/step - loss: 0.8815 - accuracy: 0.7500
Epoch 107/500
13/13 [==============================] - 0s 3ms/step - loss: 0.8282 - accuracy: 0.7625
Epoch 108/500
13/13 [==============================] - 0s 4ms/step - loss: 0.8251 - accuracy: 0.7575
Epoch 109/500
13/13 [==============================] - 0s 4ms/step - loss: 0.8236 - accuracy: 0.7575
Epoch 110/500
13/13 [==============================] - 0s 3ms/step - loss: 0.8317 - accuracy: 0.7525
Epoch 111/500
13/13 [==============================] - 0s 3ms/step - loss: 0.8083 - accuracy: 0.7575
Epoch 112/500
13/13 [==============================] - 0s 3ms/step - loss: 0.8045 - accuracy: 0.7625
Epoch 113/500
13/13 [==============================] - 0s 3ms/step - loss: 0.7997 - accuracy: 0.7600
Epoch 114/500
13/13 [==============================] - 0s 3ms/step - loss: 0.7939 - accuracy: 0.7550
Epoch 115/500
13/13 [==============================] - 0s 3ms/step - loss: 0.7916 - accuracy: 0.7625
Epoch 116/500
13/13 [==============================] - 0s 3ms/step - loss: 0.7824 - accuracy: 0.7600
Epoch 117/500
13/13 [==============================] - 0s 3ms/step - loss: 0.7873 - accuracy: 0.7625
Epoch 118/500
13/13 [==============================] - 0s 3ms/step - loss: 0.7857 - accuracy: 0.7575
Epoch 119/500
13/13 [==============================] - 0s 3ms/step - loss: 0.7740 - accuracy: 0.7650
Epoch 120/500
13/13 [==============================] - 0s 3ms/step - loss: 0.7679 - accuracy: 0.7575
Epoch 121/500
13/13 [==============================] - 0s 3ms/step - loss: 0.7595 - accuracy: 0.7650
Epoch 122/500
13/13 [==============================] - 0s 3ms/step - loss: 0.7568 - accuracy: 0.7625
Epoch 123/500
13/13 [==============================] - 0s 3ms/step - loss: 0.7558 - accuracy: 0.7575
Epoch 124/500
13/13 [==============================] - 0s 3ms/step - loss: 0.7606 - accuracy: 0.7600
Epoch 125/500
13/13 [==============================] - 0s 3ms/step - loss: 0.7627 - accuracy: 0.7675
Epoch 126/500
13/13 [==============================] - 0s 3ms/step - loss: 0.7427 - accuracy: 0.7625
Epoch 127/500
13/13 [==============================] - 0s 3ms/step - loss: 0.7375 - accuracy: 0.7600
Epoch 128/500
13/13 [==============================] - 0s 3ms/step - loss: 0.7355 - accuracy: 0.7625
Epoch 129/500
13/13 [==============================] - 0s 3ms/step - loss: 0.7373 - accuracy: 0.7700
Epoch 130/500
13/13 [==============================] - 0s 3ms/step - loss: 0.7436 - accuracy: 0.7475
Epoch 131/500
13/13 [==============================] - 0s 3ms/step - loss: 0.7242 - accuracy: 0.7625
Epoch 132/500
13/13 [==============================] - 0s 3ms/step - loss: 0.7234 - accuracy: 0.7525
Epoch 133/500
13/13 [==============================] - 0s 3ms/step - loss: 0.7095 - accuracy: 0.7650
Epoch 134/500
13/13 [==============================] - 0s 3ms/step - loss: 0.7178 - accuracy: 0.7650
Epoch 135/500
13/13 [==============================] - 0s 3ms/step - loss: 0.7234 - accuracy: 0.7700
Epoch 136/500
13/13 [==============================] - 0s 4ms/step - loss: 0.6929 - accuracy: 0.7750
Epoch 137/500
13/13 [==============================] - 0s 3ms/step - loss: 0.6965 - accuracy: 0.7575
Epoch 138/500
13/13 [==============================] - 0s 3ms/step - loss: 0.6845 - accuracy: 0.7625
Epoch 139/500
13/13 [==============================] - 0s 3ms/step - loss: 0.7026 - accuracy: 0.7600
Epoch 140/500
13/13 [==============================] - 0s 3ms/step - loss: 0.6835 - accuracy: 0.7800
Epoch 141/500
13/13 [==============================] - 0s 3ms/step - loss: 0.7164 - accuracy: 0.7525
Epoch 142/500
13/13 [==============================] - 0s 3ms/step - loss: 0.6876 - accuracy: 0.7675
Epoch 143/500
13/13 [==============================] - 0s 3ms/step - loss: 0.6670 - accuracy: 0.7675
Epoch 144/500
13/13 [==============================] - 0s 3ms/step - loss: 0.6615 - accuracy: 0.7650
Epoch 145/500
13/13 [==============================] - 0s 3ms/step - loss: 0.6488 - accuracy: 0.7800
Epoch 146/500
13/13 [==============================] - 0s 4ms/step - loss: 0.6984 - accuracy: 0.7650
Epoch 147/500
13/13 [==============================] - 0s 4ms/step - loss: 0.6695 - accuracy: 0.7475
Epoch 148/500
13/13 [==============================] - 0s 4ms/step - loss: 0.6818 - accuracy: 0.7775
Epoch 149/500
13/13 [==============================] - 0s 4ms/step - loss: 0.6502 - accuracy: 0.7700
Epoch 150/500
13/13 [==============================] - 0s 4ms/step - loss: 0.6450 - accuracy: 0.7725
Epoch 151/500
13/13 [==============================] - 0s 5ms/step - loss: 0.6409 - accuracy: 0.7700
Epoch 152/500
13/13 [==============================] - 0s 5ms/step - loss: 0.6275 - accuracy: 0.7600
Epoch 153/500
13/13 [==============================] - 0s 5ms/step - loss: 0.7251 - accuracy: 0.7525
Epoch 154/500
13/13 [==============================] - 0s 3ms/step - loss: 0.6095 - accuracy: 0.7750
Epoch 155/500
13/13 [==============================] - 0s 3ms/step - loss: 0.6373 - accuracy: 0.7575
Epoch 156/500
13/13 [==============================] - 0s 3ms/step - loss: 0.6104 - accuracy: 0.7675
Epoch 157/500
13/13 [==============================] - 0s 3ms/step - loss: 0.5992 - accuracy: 0.7725
Epoch 158/500
13/13 [==============================] - 0s 4ms/step - loss: 0.6136 - accuracy: 0.7675
Epoch 159/500
13/13 [==============================] - 0s 3ms/step - loss: 0.6078 - accuracy: 0.7800
Epoch 160/500
13/13 [==============================] - 0s 3ms/step - loss: 0.6028 - accuracy: 0.7875
Epoch 161/500
13/13 [==============================] - 0s 3ms/step - loss: 0.5961 - accuracy: 0.7775
Epoch 162/500
13/13 [==============================] - 0s 3ms/step - loss: 0.5870 - accuracy: 0.7825
Epoch 163/500
13/13 [==============================] - 0s 3ms/step - loss: 0.5963 - accuracy: 0.7775
Epoch 164/500
13/13 [==============================] - 0s 3ms/step - loss: 0.5774 - accuracy: 0.7775
Epoch 165/500
13/13 [==============================] - 0s 3ms/step - loss: 0.5684 - accuracy: 0.7850
Epoch 166/500
13/13 [==============================] - 0s 3ms/step - loss: 0.5723 - accuracy: 0.7850
Epoch 167/500
13/13 [==============================] - 0s 3ms/step - loss: 0.6251 - accuracy: 0.7575
Epoch 168/500
13/13 [==============================] - 0s 3ms/step - loss: 0.5573 - accuracy: 0.7700
Epoch 169/500
13/13 [==============================] - 0s 3ms/step - loss: 0.5614 - accuracy: 0.7775
Epoch 170/500
13/13 [==============================] - 0s 3ms/step - loss: 0.5463 - accuracy: 0.7850
Epoch 171/500
13/13 [==============================] - 0s 3ms/step - loss: 0.5456 - accuracy: 0.7900
Epoch 172/500
13/13 [==============================] - 0s 3ms/step - loss: 0.5510 - accuracy: 0.7875
Epoch 173/500
13/13 [==============================] - 0s 3ms/step - loss: 0.5671 - accuracy: 0.7700
Epoch 174/500
13/13 [==============================] - 0s 3ms/step - loss: 0.5406 - accuracy: 0.7900
Epoch 175/500
13/13 [==============================] - 0s 3ms/step - loss: 0.5383 - accuracy: 0.7850
Epoch 176/500
13/13 [==============================] - 0s 3ms/step - loss: 0.5613 - accuracy: 0.7750
Epoch 177/500
13/13 [==============================] - 0s 3ms/step - loss: 0.5476 - accuracy: 0.7775
Epoch 178/500
13/13 [==============================] - 0s 3ms/step - loss: 0.5669 - accuracy: 0.7750
Epoch 179/500
13/13 [==============================] - 0s 3ms/step - loss: 0.5468 - accuracy: 0.7850
Epoch 180/500
13/13 [==============================] - 0s 3ms/step - loss: 0.5786 - accuracy: 0.7750
Epoch 181/500
13/13 [==============================] - 0s 3ms/step - loss: 0.5551 - accuracy: 0.7500
Epoch 182/500
13/13 [==============================] - 0s 3ms/step - loss: 0.5048 - accuracy: 0.7875
Epoch 183/500
13/13 [==============================] - 0s 3ms/step - loss: 0.5055 - accuracy: 0.7775
Epoch 184/500
13/13 [==============================] - 0s 4ms/step - loss: 0.5094 - accuracy: 0.7850
Epoch 185/500
13/13 [==============================] - 0s 3ms/step - loss: 0.5156 - accuracy: 0.7725
Epoch 186/500
13/13 [==============================] - 0s 3ms/step - loss: 0.5047 - accuracy: 0.7850
Epoch 187/500
13/13 [==============================] - 0s 3ms/step - loss: 0.5063 - accuracy: 0.7775
Epoch 188/500
13/13 [==============================] - 0s 3ms/step - loss: 0.5305 - accuracy: 0.7800
Epoch 189/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4907 - accuracy: 0.7950
Epoch 190/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4785 - accuracy: 0.7900
Epoch 191/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4761 - accuracy: 0.7900
Epoch 192/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4788 - accuracy: 0.7875
Epoch 193/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4801 - accuracy: 0.7925
Epoch 194/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4847 - accuracy: 0.7900
Epoch 195/500
13/13 [==============================] - 0s 3ms/step - loss: 0.5132 - accuracy: 0.7700
Epoch 196/500
13/13 [==============================] - 0s 3ms/step - loss: 0.6470 - accuracy: 0.7200
Epoch 197/500
13/13 [==============================] - 0s 3ms/step - loss: 0.5996 - accuracy: 0.7475
Epoch 198/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4927 - accuracy: 0.7800
Epoch 199/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4815 - accuracy: 0.7850
Epoch 200/500
13/13 [==============================] - 0s 4ms/step - loss: 0.4728 - accuracy: 0.7875
Epoch 201/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4535 - accuracy: 0.7950
Epoch 202/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4772 - accuracy: 0.7850
Epoch 203/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4528 - accuracy: 0.7900
Epoch 204/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4611 - accuracy: 0.7750
Epoch 205/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4427 - accuracy: 0.7950
Epoch 206/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4719 - accuracy: 0.7775
Epoch 207/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4714 - accuracy: 0.7725
Epoch 208/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4410 - accuracy: 0.7950
Epoch 209/500
13/13 [==============================] - 0s 4ms/step - loss: 0.4468 - accuracy: 0.8050
Epoch 210/500
13/13 [==============================] - 0s 4ms/step - loss: 0.4345 - accuracy: 0.7850
Epoch 211/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4926 - accuracy: 0.7825
Epoch 212/500
13/13 [==============================] - 0s 4ms/step - loss: 0.4696 - accuracy: 0.7750
Epoch 213/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4493 - accuracy: 0.8000
Epoch 214/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4559 - accuracy: 0.7850
Epoch 215/500
13/13 [==============================] - 0s 4ms/step - loss: 0.4442 - accuracy: 0.7850
Epoch 216/500
13/13 [==============================] - 0s 5ms/step - loss: 0.4587 - accuracy: 0.7825
Epoch 217/500
13/13 [==============================] - 0s 3ms/step - loss: 0.5039 - accuracy: 0.7575
Epoch 218/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4932 - accuracy: 0.7700
Epoch 219/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4469 - accuracy: 0.7800
Epoch 220/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4579 - accuracy: 0.7800
Epoch 221/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4937 - accuracy: 0.7775
Epoch 222/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4503 - accuracy: 0.7600
Epoch 223/500
13/13 [==============================] - 0s 4ms/step - loss: 0.4278 - accuracy: 0.8000
Epoch 224/500
13/13 [==============================] - 0s 4ms/step - loss: 0.4237 - accuracy: 0.8075
Epoch 225/500
13/13 [==============================] - 0s 4ms/step - loss: 0.4177 - accuracy: 0.7975
Epoch 226/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4334 - accuracy: 0.7775
Epoch 227/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4288 - accuracy: 0.7900
Epoch 228/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4476 - accuracy: 0.7750
Epoch 229/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4256 - accuracy: 0.8125
Epoch 230/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4572 - accuracy: 0.7750
Epoch 231/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4558 - accuracy: 0.7875
Epoch 232/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4298 - accuracy: 0.7925
Epoch 233/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4094 - accuracy: 0.8075
Epoch 234/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4655 - accuracy: 0.7825
Epoch 235/500
13/13 [==============================] - 0s 5ms/step - loss: 0.4516 - accuracy: 0.7675
Epoch 236/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4232 - accuracy: 0.7800
Epoch 237/500
13/13 [==============================] - 0s 4ms/step - loss: 0.4155 - accuracy: 0.7975
Epoch 238/500
13/13 [==============================] - 0s 4ms/step - loss: 0.4175 - accuracy: 0.7975
Epoch 239/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4167 - accuracy: 0.7900
Epoch 240/500
13/13 [==============================] - 0s 4ms/step - loss: 0.4063 - accuracy: 0.8075
Epoch 241/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3988 - accuracy: 0.8050
Epoch 242/500
13/13 [==============================] - 0s 4ms/step - loss: 0.3971 - accuracy: 0.8150
Epoch 243/500
13/13 [==============================] - 0s 4ms/step - loss: 0.4846 - accuracy: 0.7575
Epoch 244/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4476 - accuracy: 0.7600
Epoch 245/500
13/13 [==============================] - 0s 4ms/step - loss: 0.4181 - accuracy: 0.7925
Epoch 246/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3956 - accuracy: 0.8025
Epoch 247/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4223 - accuracy: 0.8050
Epoch 248/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4411 - accuracy: 0.7900
Epoch 249/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4754 - accuracy: 0.7675
Epoch 250/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4336 - accuracy: 0.7850
Epoch 251/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4530 - accuracy: 0.7650
Epoch 252/500
13/13 [==============================] - 0s 4ms/step - loss: 0.4144 - accuracy: 0.7950
Epoch 253/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4278 - accuracy: 0.7925
Epoch 254/500
13/13 [==============================] - 0s 4ms/step - loss: 0.4196 - accuracy: 0.7975
Epoch 255/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4188 - accuracy: 0.7875
Epoch 256/500
13/13 [==============================] - 0s 4ms/step - loss: 0.3979 - accuracy: 0.8075
Epoch 257/500
13/13 [==============================] - 0s 4ms/step - loss: 0.4087 - accuracy: 0.7950
Epoch 258/500
13/13 [==============================] - 0s 4ms/step - loss: 0.4450 - accuracy: 0.7825
Epoch 259/500
13/13 [==============================] - 0s 4ms/step - loss: 0.4619 - accuracy: 0.7800
Epoch 260/500
13/13 [==============================] - 0s 4ms/step - loss: 0.4377 - accuracy: 0.7900
Epoch 261/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3905 - accuracy: 0.8075
Epoch 262/500
13/13 [==============================] - 0s 4ms/step - loss: 0.4061 - accuracy: 0.7900
Epoch 263/500
13/13 [==============================] - 0s 4ms/step - loss: 0.3869 - accuracy: 0.8050
Epoch 264/500
13/13 [==============================] - 0s 4ms/step - loss: 0.3980 - accuracy: 0.7900
Epoch 265/500
13/13 [==============================] - 0s 4ms/step - loss: 0.3956 - accuracy: 0.8075
Epoch 266/500
13/13 [==============================] - 0s 4ms/step - loss: 0.3973 - accuracy: 0.8050
Epoch 267/500
13/13 [==============================] - 0s 4ms/step - loss: 0.3897 - accuracy: 0.8125
Epoch 268/500
13/13 [==============================] - 0s 4ms/step - loss: 0.4029 - accuracy: 0.7950
Epoch 269/500
13/13 [==============================] - 0s 5ms/step - loss: 0.3887 - accuracy: 0.7950
Epoch 270/500
13/13 [==============================] - 0s 4ms/step - loss: 0.3898 - accuracy: 0.8200
Epoch 271/500
13/13 [==============================] - 0s 4ms/step - loss: 0.3963 - accuracy: 0.8025
Epoch 272/500
13/13 [==============================] - 0s 4ms/step - loss: 0.3836 - accuracy: 0.8025
Epoch 273/500
13/13 [==============================] - 0s 4ms/step - loss: 0.3814 - accuracy: 0.8150
Epoch 274/500
13/13 [==============================] - 0s 4ms/step - loss: 0.3804 - accuracy: 0.8250
Epoch 275/500
13/13 [==============================] - 0s 4ms/step - loss: 0.3840 - accuracy: 0.8050
Epoch 276/500
13/13 [==============================] - 0s 4ms/step - loss: 0.4144 - accuracy: 0.8050
Epoch 277/500
13/13 [==============================] - 0s 4ms/step - loss: 0.3912 - accuracy: 0.8050
Epoch 278/500
13/13 [==============================] - 0s 4ms/step - loss: 0.3917 - accuracy: 0.7925
Epoch 279/500
13/13 [==============================] - 0s 4ms/step - loss: 0.3939 - accuracy: 0.8025
Epoch 280/500
13/13 [==============================] - 0s 4ms/step - loss: 0.3866 - accuracy: 0.7950
Epoch 281/500
13/13 [==============================] - 0s 4ms/step - loss: 0.3786 - accuracy: 0.8075
Epoch 282/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3942 - accuracy: 0.8050
Epoch 283/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3788 - accuracy: 0.8250
Epoch 284/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3993 - accuracy: 0.8025
Epoch 285/500
13/13 [==============================] - 0s 4ms/step - loss: 0.4301 - accuracy: 0.7975
Epoch 286/500
13/13 [==============================] - 0s 4ms/step - loss: 0.4674 - accuracy: 0.7650
Epoch 287/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3833 - accuracy: 0.8075
Epoch 288/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4283 - accuracy: 0.7700
Epoch 289/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3917 - accuracy: 0.8075
Epoch 290/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3826 - accuracy: 0.8075
Epoch 291/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3853 - accuracy: 0.8100
Epoch 292/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3987 - accuracy: 0.7925
Epoch 293/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3872 - accuracy: 0.8250
Epoch 294/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4455 - accuracy: 0.7825
Epoch 295/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3851 - accuracy: 0.8175
Epoch 296/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3917 - accuracy: 0.8000
Epoch 297/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4002 - accuracy: 0.7975
Epoch 298/500
13/13 [==============================] - 0s 3ms/step - loss: 0.5228 - accuracy: 0.7675
Epoch 299/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4591 - accuracy: 0.7900
Epoch 300/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4425 - accuracy: 0.7550
Epoch 301/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3914 - accuracy: 0.8050
Epoch 302/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3828 - accuracy: 0.8225
Epoch 303/500
13/13 [==============================] - 0s 5ms/step - loss: 0.3751 - accuracy: 0.8125
Epoch 304/500
13/13 [==============================] - 0s 6ms/step - loss: 0.4256 - accuracy: 0.7800
Epoch 305/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4529 - accuracy: 0.7800
Epoch 306/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4472 - accuracy: 0.7875
Epoch 307/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3995 - accuracy: 0.8225
Epoch 308/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4158 - accuracy: 0.7925
Epoch 309/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3759 - accuracy: 0.8150
Epoch 310/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3802 - accuracy: 0.8125
Epoch 311/500
13/13 [==============================] - 0s 4ms/step - loss: 0.3754 - accuracy: 0.8100
Epoch 312/500
13/13 [==============================] - 0s 4ms/step - loss: 0.3887 - accuracy: 0.7975
Epoch 313/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4001 - accuracy: 0.8100
Epoch 314/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4264 - accuracy: 0.7825
Epoch 315/500
13/13 [==============================] - 0s 4ms/step - loss: 0.3895 - accuracy: 0.8125
Epoch 316/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3899 - accuracy: 0.7850
Epoch 317/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3744 - accuracy: 0.8075
Epoch 318/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3831 - accuracy: 0.8175
Epoch 319/500
13/13 [==============================] - 0s 4ms/step - loss: 0.4142 - accuracy: 0.7875
Epoch 320/500
13/13 [==============================] - 0s 4ms/step - loss: 0.4047 - accuracy: 0.7925
Epoch 321/500
13/13 [==============================] - 0s 6ms/step - loss: 0.4197 - accuracy: 0.8025
Epoch 322/500
13/13 [==============================] - 0s 4ms/step - loss: 0.4137 - accuracy: 0.8050
Epoch 323/500
13/13 [==============================] - 0s 4ms/step - loss: 0.3780 - accuracy: 0.8050
Epoch 324/500
13/13 [==============================] - 0s 4ms/step - loss: 0.3752 - accuracy: 0.8000
Epoch 325/500
13/13 [==============================] - 0s 5ms/step - loss: 0.5008 - accuracy: 0.7750
Epoch 326/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4224 - accuracy: 0.7900
Epoch 327/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4676 - accuracy: 0.7675
Epoch 328/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4357 - accuracy: 0.7925
Epoch 329/500
13/13 [==============================] - 0s 4ms/step - loss: 0.4982 - accuracy: 0.7775
Epoch 330/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4576 - accuracy: 0.7725
Epoch 331/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3728 - accuracy: 0.8125
Epoch 332/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3706 - accuracy: 0.8200
Epoch 333/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3783 - accuracy: 0.8100
Epoch 334/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4034 - accuracy: 0.7950
Epoch 335/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4003 - accuracy: 0.7925
Epoch 336/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3744 - accuracy: 0.8125
Epoch 337/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3607 - accuracy: 0.8225
Epoch 338/500
13/13 [==============================] - 0s 4ms/step - loss: 0.3683 - accuracy: 0.8150
Epoch 339/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4468 - accuracy: 0.7850
Epoch 340/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3645 - accuracy: 0.8150
Epoch 341/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3897 - accuracy: 0.8275
Epoch 342/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3901 - accuracy: 0.8125
Epoch 343/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4023 - accuracy: 0.8175
Epoch 344/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4026 - accuracy: 0.7975
Epoch 345/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3726 - accuracy: 0.8075
Epoch 346/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3984 - accuracy: 0.8150
Epoch 347/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3617 - accuracy: 0.8200
Epoch 348/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3858 - accuracy: 0.8150
Epoch 349/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3684 - accuracy: 0.8075
Epoch 350/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3825 - accuracy: 0.8150
Epoch 351/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3852 - accuracy: 0.8100
Epoch 352/500
13/13 [==============================] - 0s 4ms/step - loss: 0.3945 - accuracy: 0.8075
Epoch 353/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3807 - accuracy: 0.8200
Epoch 354/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3807 - accuracy: 0.8075
Epoch 355/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3633 - accuracy: 0.8150
Epoch 356/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4693 - accuracy: 0.7850
Epoch 357/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4540 - accuracy: 0.7800
Epoch 358/500
13/13 [==============================] - 0s 5ms/step - loss: 0.3990 - accuracy: 0.8000
Epoch 359/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4531 - accuracy: 0.7725
Epoch 360/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4174 - accuracy: 0.8025
Epoch 361/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4213 - accuracy: 0.7975
Epoch 362/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3743 - accuracy: 0.8050
Epoch 363/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3926 - accuracy: 0.8000
Epoch 364/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3830 - accuracy: 0.8200
Epoch 365/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4271 - accuracy: 0.7975
Epoch 366/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3932 - accuracy: 0.8050
Epoch 367/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3981 - accuracy: 0.8050
Epoch 368/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3553 - accuracy: 0.8250
Epoch 369/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3658 - accuracy: 0.8175
Epoch 370/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3818 - accuracy: 0.8175
Epoch 371/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3872 - accuracy: 0.8125
Epoch 372/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4798 - accuracy: 0.7750
Epoch 373/500
13/13 [==============================] - 0s 3ms/step - loss: 0.5617 - accuracy: 0.7575
Epoch 374/500
13/13 [==============================] - 0s 3ms/step - loss: 0.5857 - accuracy: 0.7400
Epoch 375/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4204 - accuracy: 0.8025
Epoch 376/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4262 - accuracy: 0.7800
Epoch 377/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4718 - accuracy: 0.7675
Epoch 378/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3921 - accuracy: 0.8100
Epoch 379/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4245 - accuracy: 0.7800
Epoch 380/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3843 - accuracy: 0.8150
Epoch 381/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3621 - accuracy: 0.8125
Epoch 382/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3902 - accuracy: 0.8050
Epoch 383/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3587 - accuracy: 0.8225
Epoch 384/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3645 - accuracy: 0.8225
Epoch 385/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3704 - accuracy: 0.8175
Epoch 386/500
13/13 [==============================] - 0s 4ms/step - loss: 0.3737 - accuracy: 0.8100
Epoch 387/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3728 - accuracy: 0.8075
Epoch 388/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3619 - accuracy: 0.8200
Epoch 389/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3497 - accuracy: 0.8275
Epoch 390/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3802 - accuracy: 0.8100
Epoch 391/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3632 - accuracy: 0.8175
Epoch 392/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3576 - accuracy: 0.8275
Epoch 393/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3667 - accuracy: 0.8150
Epoch 394/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3635 - accuracy: 0.8075
Epoch 395/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3724 - accuracy: 0.8150
Epoch 396/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3679 - accuracy: 0.8225
Epoch 397/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3928 - accuracy: 0.8275
Epoch 398/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3691 - accuracy: 0.8125
Epoch 399/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3571 - accuracy: 0.8275
Epoch 400/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3560 - accuracy: 0.8150
Epoch 401/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3759 - accuracy: 0.8125
Epoch 402/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3551 - accuracy: 0.8200
Epoch 403/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3915 - accuracy: 0.8075
Epoch 404/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4464 - accuracy: 0.8000
Epoch 405/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4178 - accuracy: 0.8075
Epoch 406/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3790 - accuracy: 0.8100
Epoch 407/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4192 - accuracy: 0.8050
Epoch 408/500
13/13 [==============================] - 0s 3ms/step - loss: 0.5111 - accuracy: 0.7850
Epoch 409/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3949 - accuracy: 0.8100
Epoch 410/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4212 - accuracy: 0.7775
Epoch 411/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3661 - accuracy: 0.8325
Epoch 412/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3730 - accuracy: 0.8150
Epoch 413/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3538 - accuracy: 0.8150
Epoch 414/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3544 - accuracy: 0.8175
Epoch 415/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3996 - accuracy: 0.7950
Epoch 416/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3852 - accuracy: 0.8050
Epoch 417/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3884 - accuracy: 0.8050
Epoch 418/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4044 - accuracy: 0.8175
Epoch 419/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3799 - accuracy: 0.8025
Epoch 420/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4230 - accuracy: 0.7975
Epoch 421/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4904 - accuracy: 0.7775
Epoch 422/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3718 - accuracy: 0.8225
Epoch 423/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4433 - accuracy: 0.8000
Epoch 424/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3605 - accuracy: 0.8250
Epoch 425/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3744 - accuracy: 0.8175
Epoch 426/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4031 - accuracy: 0.7950
Epoch 427/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3678 - accuracy: 0.8175
Epoch 428/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3990 - accuracy: 0.8100
Epoch 429/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3768 - accuracy: 0.8150
Epoch 430/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4314 - accuracy: 0.7850
Epoch 431/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3725 - accuracy: 0.8200
Epoch 432/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3945 - accuracy: 0.7975
Epoch 433/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3561 - accuracy: 0.8200
Epoch 434/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3517 - accuracy: 0.8200
Epoch 435/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3893 - accuracy: 0.8025
Epoch 436/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3639 - accuracy: 0.8150
Epoch 437/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3930 - accuracy: 0.8000
Epoch 438/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4007 - accuracy: 0.7975
Epoch 439/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3615 - accuracy: 0.8350
Epoch 440/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3941 - accuracy: 0.7975
Epoch 441/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3706 - accuracy: 0.8325
Epoch 442/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3801 - accuracy: 0.8100
Epoch 443/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4905 - accuracy: 0.7875
Epoch 444/500
13/13 [==============================] - 0s 4ms/step - loss: 0.7593 - accuracy: 0.7225
Epoch 445/500
13/13 [==============================] - 0s 3ms/step - loss: 0.6630 - accuracy: 0.7375
Epoch 446/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4982 - accuracy: 0.7725
Epoch 447/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3870 - accuracy: 0.8175
Epoch 448/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4344 - accuracy: 0.7875
Epoch 449/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4347 - accuracy: 0.7975
Epoch 450/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3958 - accuracy: 0.8075
Epoch 451/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3502 - accuracy: 0.8300
Epoch 452/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3838 - accuracy: 0.8250
Epoch 453/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4698 - accuracy: 0.7800
Epoch 454/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3704 - accuracy: 0.8250
Epoch 455/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3467 - accuracy: 0.8250
Epoch 456/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3903 - accuracy: 0.8150
Epoch 457/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3995 - accuracy: 0.7950
Epoch 458/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3713 - accuracy: 0.8200
Epoch 459/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3501 - accuracy: 0.8150
Epoch 460/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3427 - accuracy: 0.8325
Epoch 461/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3813 - accuracy: 0.8075
Epoch 462/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3498 - accuracy: 0.8225
Epoch 463/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3598 - accuracy: 0.8200
Epoch 464/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3693 - accuracy: 0.7975
Epoch 465/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3517 - accuracy: 0.8325
Epoch 466/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3385 - accuracy: 0.8375
Epoch 467/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3757 - accuracy: 0.8025
Epoch 468/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3526 - accuracy: 0.8225
Epoch 469/500
13/13 [==============================] - 0s 4ms/step - loss: 0.4555 - accuracy: 0.7750
Epoch 470/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4625 - accuracy: 0.7675
Epoch 471/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4342 - accuracy: 0.7850
Epoch 472/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3637 - accuracy: 0.8125
Epoch 473/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3527 - accuracy: 0.8200
Epoch 474/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3645 - accuracy: 0.8100
Epoch 475/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3660 - accuracy: 0.8150
Epoch 476/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4276 - accuracy: 0.7975
Epoch 477/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3620 - accuracy: 0.8150
Epoch 478/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3653 - accuracy: 0.8400
Epoch 479/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3499 - accuracy: 0.8375
Epoch 480/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4120 - accuracy: 0.8150
Epoch 481/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3389 - accuracy: 0.8400
Epoch 482/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3561 - accuracy: 0.8150
Epoch 483/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3517 - accuracy: 0.8325
Epoch 484/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3460 - accuracy: 0.8225
Epoch 485/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4233 - accuracy: 0.7850
Epoch 486/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3933 - accuracy: 0.8225
Epoch 487/500
13/13 [==============================] - 0s 5ms/step - loss: 0.3733 - accuracy: 0.8000
Epoch 488/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3735 - accuracy: 0.8050
Epoch 489/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3695 - accuracy: 0.8275
Epoch 490/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3703 - accuracy: 0.8050
Epoch 491/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4176 - accuracy: 0.8075
Epoch 492/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3807 - accuracy: 0.8150
Epoch 493/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4697 - accuracy: 0.7950
Epoch 494/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4050 - accuracy: 0.8075
Epoch 495/500
13/13 [==============================] - 0s 3ms/step - loss: 0.4088 - accuracy: 0.7850
Epoch 496/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3566 - accuracy: 0.8125
Epoch 497/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3382 - accuracy: 0.8300
Epoch 498/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3832 - accuracy: 0.8150
Epoch 499/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3930 - accuracy: 0.7900
Epoch 500/500
13/13 [==============================] - 0s 3ms/step - loss: 0.3444 - accuracy: 0.8275
4/4 [==============================] - 0s 4ms/step - loss: 0.2666 - accuracy: 0.8900
Test Loss: 0.2666371762752533
Test Accuracy: 0.8899999856948853

In [6]: import pandas as pd


import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelEncoder, StandardScaler
from sklearn.linear_model import LogisticRegression
from sklearn.neural_network import MLPClassifier
from sklearn.metrics import accuracy_score, confusion_matrix
import seaborn as sns
import matplotlib.pyplot as plt

# Load the dataset


df = pd.read_csv('dataset2.csv')

# Encode categorical variables


label_encoder = LabelEncoder()
df['Product Type'] = label_encoder.fit_transform(df['Product Type'])

# Define features (X) and target variable (y)


X = df.drop(columns=['Need Improvement'])
y = df['Need Improvement']

# Split dataset into training and testing sets


X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)

# Standardize features
scaler = StandardScaler()
X_train = scaler.fit_transform(X_train)
X_test = scaler.transform(X_test)

# Train a linear model (Logistic Regression) for benchmarking


linear_model = LogisticRegression(random_state=42)
linear_model.fit(X_train, y_train)
linear_model_pred = linear_model.predict(X_test)
linear_model_accuracy = accuracy_score(y_test, linear_model_pred)
print("Linear Model Accuracy:", linear_model_accuracy)
# Train an ANN classifier
ann_classifier = MLPClassifier(hidden_layer_sizes=(100, 50), max_iter=1000, solver='adam', random_state=42)
ann_classifier.fit(X_train, y_train)

# Predict on the test set


ann_pred = ann_classifier.predict(X_test)

# Calculate accuracy
ann_accuracy = accuracy_score(y_test, ann_pred)
print("ANN Accuracy:", ann_accuracy)

# Confusion matrix for ANN


ann_cm = confusion_matrix(y_test, ann_pred)
plt.figure(figsize=(8, 6))
sns.heatmap(ann_cm, annot=True, fmt='d', cmap='Blues', cbar=False)
plt.xlabel('Predicted Labels')
plt.ylabel('True Labels')
plt.title('ANN Confusion Matrix')
plt.show()

# Predict output for given instance: (288,Dairy,200,0.10,8,12)


single_instance = pd.DataFrame({
'Product ID': [288],
'Product Type': [label_encoder.transform(['Dairy'])[0]],
'Market Price': [200],
'Discount': [0.10],
'Sales Month': [8],
'No of Distribution': [12]
})
single_instance_scaled = scaler.transform(single_instance)
ann_single_prediction = ann_classifier.predict(single_instance_scaled)
print("ANN Prediction for single instance:", ann_single_prediction)

# Test the data with linear model


linear_model_test_pred = linear_model.predict(single_instance_scaled)
print("Linear Model Prediction for single instance:", linear_model_test_pred)

Linear Model Accuracy: 0.9


ANN Accuracy: 0.94

ANN Prediction for single instance: ['No']


Linear Model Prediction for single instance: ['No']

In [ ]:

You might also like