a
This commit is contained in:
commit
95b5e546dc
19 files changed
+7516
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,301 @@
|
||||
timestamp,floor_requested,wait_time_seconds,direction,people_count,peak_hour,load_percent
|
||||
2025-01-01 11:31,5,16.53,Down,5,No,53
|
||||
2025-01-01 10:22,12,18.98,Down,3,Yes,20
|
||||
2025-01-01 16:25,4,19.35,Down,1,No,10
|
||||
2025-01-01 10:37,8,3.22,Up,4,Yes,31
|
||||
2025-01-01 07:31,6,17.32,Up,4,No,50
|
||||
2025-01-01 11:48,1,13.05,Down,5,No,57
|
||||
2025-01-01 12:09,11,11.8,Up,1,No,14
|
||||
2025-01-01 07:53,10,12.45,Up,4,No,49
|
||||
2025-01-01 08:12,11,8.59,Up,4,Yes,46
|
||||
2025-01-01 12:01,8,15.04,Up,1,No,10
|
||||
2025-01-01 19:04,3,13.8,Down,5,Yes,43
|
||||
2025-01-01 08:01,10,11.18,Up,1,Yes,10
|
||||
2025-01-01 16:42,11,12.11,Down,2,No,23
|
||||
2025-01-01 15:27,7,14.63,Down,1,No,10
|
||||
2025-01-01 13:07,8,6.29,Up,9,No,78
|
||||
2025-01-01 19:33,12,24.38,Up,5,Yes,47
|
||||
2025-01-01 18:25,6,16.62,Down,4,Yes,26
|
||||
2025-01-01 18:30,3,11.24,Up,4,Yes,33
|
||||
2025-01-01 19:38,11,15.35,Up,4,Yes,25
|
||||
2025-01-01 15:30,3,7.04,Down,4,No,23
|
||||
2025-01-01 18:56,12,12.59,Up,4,Yes,29
|
||||
2025-01-01 18:12,8,2.77,Up,3,Yes,43
|
||||
2025-01-01 15:58,2,5.13,Up,1,No,10
|
||||
2025-01-01 06:30,10,14.78,Down,1,No,13
|
||||
2025-01-01 06:26,5,8.24,Down,1,No,10
|
||||
2025-01-01 19:40,11,14.62,Up,2,Yes,25
|
||||
2025-01-01 10:39,8,15.97,Up,4,Yes,54
|
||||
2025-01-01 10:41,10,18.57,Up,5,Yes,53
|
||||
2025-01-01 10:08,8,8.34,Down,4,Yes,21
|
||||
2025-01-01 18:51,12,10.28,Down,4,Yes,47
|
||||
2025-01-01 14:17,2,13.44,Up,4,No,44
|
||||
2025-01-01 13:21,10,11.07,Up,4,No,41
|
||||
2025-01-01 07:00,12,8.78,Down,8,No,57
|
||||
2025-01-01 17:27,9,15.93,Up,4,No,30
|
||||
2025-01-01 09:34,5,15.34,Up,2,Yes,46
|
||||
2025-01-01 06:15,10,14.71,Down,8,No,70
|
||||
2025-01-01 10:34,12,4.57,Down,1,Yes,11
|
||||
2025-01-01 13:47,6,7.79,Up,3,No,43
|
||||
2025-01-01 11:49,10,18.68,Down,3,No,31
|
||||
2025-01-01 07:47,1,15.75,Down,5,No,57
|
||||
2025-01-01 12:05,11,10.82,Down,3,No,11
|
||||
2025-01-01 14:16,8,22.84,Up,6,No,58
|
||||
2025-01-01 10:49,5,19.11,Up,6,Yes,63
|
||||
2025-01-01 14:37,8,0.96,Up,1,No,10
|
||||
2025-01-01 07:17,1,15.33,Down,5,No,54
|
||||
2025-01-01 07:54,7,11.21,Down,1,No,10
|
||||
2025-01-01 12:00,12,13.15,Up,4,No,40
|
||||
2025-01-01 12:07,4,13.66,Down,3,No,36
|
||||
2025-01-01 17:01,8,5.28,Down,2,No,12
|
||||
2025-01-01 12:04,2,6.8,Up,1,No,33
|
||||
2025-01-01 12:49,4,8.88,Down,5,No,50
|
||||
2025-01-01 11:29,5,13.7,Up,1,No,10
|
||||
2025-01-01 16:39,5,8.64,Down,3,No,21
|
||||
2025-01-01 06:23,5,15.39,Up,5,No,52
|
||||
2025-01-01 15:02,7,13.46,Up,4,No,44
|
||||
2025-01-01 11:16,7,6.64,Up,1,No,10
|
||||
2025-01-01 09:37,7,16.7,Down,8,Yes,73
|
||||
2025-01-01 11:51,2,7.56,Down,1,No,10
|
||||
2025-01-01 16:43,3,11.66,Down,4,No,42
|
||||
2025-01-01 09:43,4,16.48,Down,2,Yes,16
|
||||
2025-01-01 11:39,2,9.92,Down,4,No,42
|
||||
2025-01-01 19:26,1,8.06,Up,1,Yes,12
|
||||
2025-01-01 19:09,1,2.98,Down,4,Yes,52
|
||||
2025-01-01 16:25,2,12.39,Up,3,No,32
|
||||
2025-01-01 06:37,10,18.04,Up,3,No,36
|
||||
2025-01-01 11:58,5,12.72,Down,5,No,35
|
||||
2025-01-01 06:03,4,13.11,Down,3,No,35
|
||||
2025-01-01 08:37,10,9.06,Up,2,Yes,13
|
||||
2025-01-01 07:50,8,12.68,Down,4,No,37
|
||||
2025-01-01 08:42,5,21.53,Up,5,Yes,61
|
||||
2025-01-01 07:40,2,9.09,Down,6,No,66
|
||||
2025-01-01 12:08,11,16.1,Up,3,No,29
|
||||
2025-01-01 14:46,2,12.7,Down,6,No,53
|
||||
2025-01-01 13:01,9,20.52,Down,4,No,59
|
||||
2025-01-01 14:55,7,16.5,Up,5,No,54
|
||||
2025-01-01 16:48,8,13.07,Down,5,No,71
|
||||
2025-01-01 07:01,11,11.81,Down,4,No,43
|
||||
2025-01-01 14:22,8,7.37,Up,4,No,49
|
||||
2025-01-01 10:38,9,5.18,Up,6,Yes,65
|
||||
2025-01-01 10:35,7,14.62,Down,3,Yes,20
|
||||
2025-01-01 16:04,4,21.42,Down,7,No,61
|
||||
2025-01-01 16:37,12,14.32,Up,4,No,47
|
||||
2025-01-01 08:27,11,10.27,Down,4,Yes,29
|
||||
2025-01-01 11:23,8,11.09,Up,1,No,10
|
||||
2025-01-01 16:53,12,13.53,Up,5,No,45
|
||||
2025-01-01 19:10,12,13.64,Up,3,Yes,21
|
||||
2025-01-01 13:51,3,10.06,Down,4,No,36
|
||||
2025-01-01 17:53,10,16.84,Up,3,No,33
|
||||
2025-01-01 16:55,10,4.93,Down,2,No,46
|
||||
2025-01-01 12:57,4,11.9,Down,5,No,37
|
||||
2025-01-01 09:18,8,18.19,Up,5,Yes,57
|
||||
2025-01-01 11:25,12,12.19,Down,1,No,10
|
||||
2025-01-01 08:26,10,13.01,Up,1,Yes,25
|
||||
2025-01-01 12:43,6,11.42,Down,6,No,47
|
||||
2025-01-01 06:17,3,12.52,Up,6,No,57
|
||||
2025-01-01 15:17,11,15.09,Up,1,No,10
|
||||
2025-01-01 18:50,11,14.29,Up,5,Yes,41
|
||||
2025-01-01 06:52,3,13.27,Down,2,No,10
|
||||
2025-01-01 14:33,7,5.58,Down,1,No,14
|
||||
2025-01-01 17:36,9,13.65,Down,6,No,52
|
||||
2025-01-01 06:56,5,15.4,Down,2,No,34
|
||||
2025-01-01 11:42,7,6.06,Down,4,No,26
|
||||
2025-01-01 15:32,4,18.08,Down,2,No,13
|
||||
2025-01-01 06:57,6,11.86,Down,6,No,49
|
||||
2025-01-01 10:41,9,14.29,Down,3,Yes,32
|
||||
2025-01-01 18:36,7,14.66,Up,6,Yes,63
|
||||
2025-01-01 19:56,3,10.71,Up,9,Yes,100
|
||||
2025-01-01 06:52,3,9.19,Up,5,No,37
|
||||
2025-01-01 18:02,7,19.33,Up,1,Yes,22
|
||||
2025-01-01 08:04,6,4.47,Down,1,Yes,10
|
||||
2025-01-01 10:50,12,18.99,Up,4,Yes,42
|
||||
2025-01-01 18:16,1,16.43,Down,4,Yes,33
|
||||
2025-01-01 19:04,2,6.14,Up,3,Yes,33
|
||||
2025-01-01 09:51,2,12.4,Up,5,Yes,42
|
||||
2025-01-01 18:49,4,20.75,Down,5,Yes,48
|
||||
2025-01-01 19:58,7,11.86,Up,6,Yes,70
|
||||
2025-01-01 19:54,10,11.84,Down,1,Yes,10
|
||||
2025-01-01 17:13,4,14.36,Down,6,No,52
|
||||
2025-01-01 15:35,11,14.17,Down,6,No,75
|
||||
2025-01-01 06:33,4,8.09,Down,2,No,10
|
||||
2025-01-01 17:06,12,8.71,Down,4,No,36
|
||||
2025-01-01 17:02,9,20.67,Down,3,No,25
|
||||
2025-01-01 15:47,1,14.32,Down,3,No,29
|
||||
2025-01-01 14:14,10,10.18,Up,2,No,23
|
||||
2025-01-01 18:52,8,15.15,Up,4,Yes,53
|
||||
2025-01-01 19:42,10,6.08,Up,1,Yes,14
|
||||
2025-01-01 19:39,4,12.72,Up,6,Yes,65
|
||||
2025-01-01 10:38,8,10.66,Down,5,Yes,42
|
||||
2025-01-01 11:43,8,9.67,Up,3,No,34
|
||||
2025-01-01 11:53,1,13.08,Down,2,No,24
|
||||
2025-01-01 09:30,2,10.87,Down,2,Yes,11
|
||||
2025-01-01 09:19,12,13.44,Up,2,Yes,10
|
||||
2025-01-01 11:30,8,11.72,Down,4,No,32
|
||||
2025-01-01 10:35,9,12.67,Up,3,Yes,23
|
||||
2025-01-01 18:53,1,12.09,Down,3,Yes,40
|
||||
2025-01-01 08:01,11,9.95,Down,7,Yes,70
|
||||
2025-01-01 16:58,3,8.65,Down,4,No,42
|
||||
2025-01-01 07:09,3,7.43,Up,3,No,32
|
||||
2025-01-01 19:05,11,6.57,Down,4,Yes,34
|
||||
2025-01-01 13:18,12,3.2,Down,4,No,40
|
||||
2025-01-01 13:47,4,4.6,Up,5,No,35
|
||||
2025-01-01 15:00,5,18.01,Up,2,No,15
|
||||
2025-01-01 06:03,11,14.7,Down,1,No,10
|
||||
2025-01-01 06:38,8,8.74,Up,3,No,24
|
||||
2025-01-01 12:05,6,8.49,Up,4,No,38
|
||||
2025-01-01 07:11,6,6.15,Down,3,No,36
|
||||
2025-01-01 09:59,11,8.45,Down,3,Yes,22
|
||||
2025-01-01 06:23,4,17.46,Down,5,No,61
|
||||
2025-01-01 08:26,10,14.85,Up,6,Yes,56
|
||||
2025-01-01 08:39,9,18.72,Up,1,Yes,10
|
||||
2025-01-01 11:18,7,6.44,Up,2,No,15
|
||||
2025-01-01 12:53,3,11.58,Down,4,No,31
|
||||
2025-01-01 13:31,9,7.35,Up,2,No,28
|
||||
2025-01-01 17:46,8,10.02,Up,5,No,62
|
||||
2025-01-01 08:30,12,6.42,Down,1,Yes,10
|
||||
2025-01-01 10:16,9,15.65,Down,4,Yes,55
|
||||
2025-01-01 07:46,8,14.64,Down,1,No,10
|
||||
2025-01-01 08:45,8,12.66,Up,2,Yes,21
|
||||
2025-01-01 17:52,7,15.63,Up,9,No,84
|
||||
2025-01-01 12:10,6,18.98,Up,4,No,41
|
||||
2025-01-01 18:04,6,19.5,Down,4,Yes,21
|
||||
2025-01-01 17:16,11,28.13,Up,4,No,40
|
||||
2025-01-01 17:27,9,7.1,Down,4,No,30
|
||||
2025-01-01 15:38,8,10.08,Down,4,No,44
|
||||
2025-01-01 15:21,12,11.43,Down,4,No,36
|
||||
2025-01-01 13:38,6,3.07,Down,5,No,46
|
||||
2025-01-01 15:04,7,14.05,Down,5,No,32
|
||||
2025-01-01 06:27,8,5.64,Up,3,No,21
|
||||
2025-01-01 19:31,6,8.08,Up,2,Yes,22
|
||||
2025-01-01 19:18,12,5.36,Down,3,Yes,20
|
||||
2025-01-01 06:57,9,10.63,Down,3,No,31
|
||||
2025-01-01 07:39,11,15.61,Up,5,No,44
|
||||
2025-01-01 13:19,8,11.37,Down,6,No,55
|
||||
2025-01-01 18:48,1,14.68,Down,4,Yes,40
|
||||
2025-01-01 10:40,8,16.47,Down,1,Yes,10
|
||||
2025-01-01 08:09,9,15.73,Up,3,Yes,28
|
||||
2025-01-01 07:35,11,11.77,Down,3,No,45
|
||||
2025-01-01 18:36,2,15.92,Up,8,Yes,87
|
||||
2025-01-01 16:54,8,15.32,Up,5,No,35
|
||||
2025-01-01 12:11,1,12.83,Up,1,No,10
|
||||
2025-01-01 13:09,11,15.41,Up,6,No,57
|
||||
2025-01-01 19:24,6,12.41,Down,2,Yes,18
|
||||
2025-01-01 07:33,3,6.19,Up,1,No,14
|
||||
2025-01-01 13:01,11,7.6,Up,2,No,22
|
||||
2025-01-01 11:26,6,11.39,Down,1,No,11
|
||||
2025-01-01 17:23,7,21.29,Up,1,No,10
|
||||
2025-01-01 11:52,7,13.64,Up,5,No,55
|
||||
2025-01-01 19:01,11,16.93,Up,2,Yes,18
|
||||
2025-01-01 11:42,8,13.58,Down,6,No,66
|
||||
2025-01-01 12:36,10,10.01,Up,4,No,33
|
||||
2025-01-01 06:00,1,11.06,Down,5,No,47
|
||||
2025-01-01 13:59,6,16.71,Down,2,No,10
|
||||
2025-01-01 11:03,3,10.77,Down,5,No,43
|
||||
2025-01-01 16:28,7,9.37,Down,3,No,34
|
||||
2025-01-01 18:47,6,8.98,Down,1,Yes,10
|
||||
2025-01-01 15:10,2,6.3,Up,3,No,33
|
||||
2025-01-01 11:21,3,9.71,Up,6,No,41
|
||||
2025-01-01 06:51,6,21.05,Up,6,No,61
|
||||
2025-01-01 11:49,7,16.17,Down,5,No,48
|
||||
2025-01-01 18:32,9,13.67,Down,1,Yes,30
|
||||
2025-01-01 08:04,4,12.1,Down,5,Yes,34
|
||||
2025-01-01 07:03,11,10.82,Up,7,No,59
|
||||
2025-01-01 16:49,9,15.76,Up,8,No,89
|
||||
2025-01-01 07:25,4,2.38,Down,3,No,43
|
||||
2025-01-01 07:43,12,11.82,Up,6,No,71
|
||||
2025-01-01 19:49,1,15.37,Up,4,Yes,36
|
||||
2025-01-01 14:30,11,16.16,Up,4,No,38
|
||||
2025-01-01 10:28,1,7.35,Up,1,Yes,11
|
||||
2025-01-01 10:58,3,12.48,Up,4,Yes,35
|
||||
2025-01-01 07:52,8,16.85,Down,3,No,16
|
||||
2025-01-01 06:00,10,12.56,Down,6,No,48
|
||||
2025-01-01 08:09,8,14.26,Up,5,Yes,65
|
||||
2025-01-01 10:13,3,7.63,Up,4,Yes,38
|
||||
2025-01-01 09:06,2,11.15,Down,3,Yes,19
|
||||
2025-01-01 08:29,9,12.86,Up,3,Yes,40
|
||||
2025-01-01 07:44,7,2.58,Down,2,No,12
|
||||
2025-01-01 08:53,1,12.68,Up,2,Yes,28
|
||||
2025-01-01 10:59,8,5.2,Down,3,Yes,22
|
||||
2025-01-01 19:25,12,6.43,Up,5,Yes,48
|
||||
2025-01-01 08:07,6,10.73,Up,1,Yes,10
|
||||
2025-01-01 16:45,1,10.39,Down,6,No,59
|
||||
2025-01-01 13:30,8,14.97,Up,2,No,10
|
||||
2025-01-01 06:12,3,13.65,Up,7,No,64
|
||||
2025-01-01 09:37,9,14.65,Down,6,Yes,51
|
||||
2025-01-01 08:31,1,0.16,Up,2,Yes,23
|
||||
2025-01-01 19:35,3,11.43,Down,4,Yes,31
|
||||
2025-01-01 08:13,11,11.85,Down,3,Yes,31
|
||||
2025-01-01 17:24,8,18.63,Up,10,No,100
|
||||
2025-01-01 11:37,2,19.98,Down,3,No,24
|
||||
2025-01-01 08:44,9,12.23,Down,4,Yes,50
|
||||
2025-01-01 16:13,6,4.97,Up,4,No,51
|
||||
2025-01-01 07:51,6,20.32,Down,6,No,54
|
||||
2025-01-01 18:41,11,8.69,Up,5,Yes,45
|
||||
2025-01-01 13:39,2,10.25,Down,8,No,63
|
||||
2025-01-01 18:38,7,19.98,Up,4,Yes,28
|
||||
2025-01-01 18:29,12,11.16,Down,2,Yes,25
|
||||
2025-01-01 20:00,5,13.8,Down,3,No,11
|
||||
2025-01-01 13:00,4,16.64,Up,3,No,36
|
||||
2025-01-01 13:07,2,11.6,Up,4,No,49
|
||||
2025-01-01 08:55,4,19.87,Up,4,Yes,55
|
||||
2025-01-01 07:19,1,12.67,Up,2,No,16
|
||||
2025-01-01 09:41,7,15.21,Up,4,Yes,28
|
||||
2025-01-01 09:01,7,9.04,Down,2,Yes,26
|
||||
2025-01-01 13:47,5,7.71,Up,1,No,20
|
||||
2025-01-01 12:20,9,17.77,Up,5,No,43
|
||||
2025-01-01 09:05,10,11.32,Up,6,Yes,48
|
||||
2025-01-01 09:21,6,9.39,Up,6,Yes,45
|
||||
2025-01-01 16:32,10,17.17,Down,2,No,34
|
||||
2025-01-01 16:56,8,16.98,Down,6,No,67
|
||||
2025-01-01 13:37,3,13.61,Up,4,No,39
|
||||
2025-01-01 09:02,5,9.96,Down,7,Yes,68
|
||||
2025-01-01 08:38,5,10.57,Up,8,Yes,72
|
||||
2025-01-01 10:18,12,2.11,Up,1,Yes,11
|
||||
2025-01-01 19:23,3,11.51,Down,3,Yes,21
|
||||
2025-01-01 13:32,6,11.13,Down,4,No,31
|
||||
2025-01-01 07:25,1,12.5,Down,4,No,49
|
||||
2025-01-01 13:04,6,13.37,Down,2,No,10
|
||||
2025-01-01 12:18,4,17.42,Up,1,No,10
|
||||
2025-01-01 08:50,1,17.38,Up,4,Yes,47
|
||||
2025-01-01 12:03,4,16.04,Down,2,No,10
|
||||
2025-01-01 11:55,8,10.94,Down,2,No,11
|
||||
2025-01-01 11:08,9,17.54,Up,4,No,47
|
||||
2025-01-01 13:22,1,8.45,Up,5,No,67
|
||||
2025-01-01 17:15,9,13.62,Up,4,No,51
|
||||
2025-01-01 06:35,4,14.73,Up,4,No,31
|
||||
2025-01-01 07:10,1,6.0,Up,6,No,57
|
||||
2025-01-01 16:54,7,11.66,Up,3,No,24
|
||||
2025-01-01 19:04,6,11.01,Down,2,Yes,21
|
||||
2025-01-01 19:44,12,11.7,Down,2,Yes,10
|
||||
2025-01-01 17:30,4,13.29,Down,5,No,65
|
||||
2025-01-01 10:33,9,6.57,Up,4,Yes,32
|
||||
2025-01-01 09:14,11,15.82,Up,3,Yes,21
|
||||
2025-01-01 13:32,12,16.46,Down,5,No,59
|
||||
2025-01-01 08:13,12,6.77,Down,2,Yes,29
|
||||
2025-01-01 18:32,1,10.72,Down,1,Yes,14
|
||||
2025-01-01 14:49,4,8.54,Down,1,No,10
|
||||
2025-01-01 10:49,2,10.78,Up,1,Yes,10
|
||||
2025-01-01 08:58,12,17.33,Down,4,Yes,27
|
||||
2025-01-01 06:28,3,13.88,Up,4,No,34
|
||||
2025-01-01 10:41,5,13.23,Down,6,Yes,58
|
||||
2025-01-01 17:25,1,14.26,Down,7,No,65
|
||||
2025-01-01 19:39,9,13.03,Up,3,Yes,26
|
||||
2025-01-01 07:48,5,1.91,Up,5,No,47
|
||||
2025-01-01 09:10,12,12.74,Down,4,Yes,36
|
||||
2025-01-01 16:16,2,13.04,Down,5,No,50
|
||||
2025-01-01 14:45,6,13.38,Up,3,No,38
|
||||
2025-01-01 14:51,7,15.08,Up,2,No,26
|
||||
2025-01-01 06:32,7,11.85,Down,1,No,10
|
||||
2025-01-01 12:50,5,13.29,Down,1,No,10
|
||||
2025-01-01 09:36,7,10.52,Down,3,Yes,13
|
||||
2025-01-01 10:34,3,4.95,Up,5,Yes,50
|
||||
2025-01-01 07:28,1,8.18,Down,6,No,67
|
||||
2025-01-01 08:09,2,7.85,Down,7,Yes,69
|
||||
2025-01-01 13:52,1,6.16,Up,7,No,51
|
||||
2025-01-01 12:52,12,15.16,Up,3,No,43
|
||||
2025-01-01 06:50,11,8.89,Up,4,No,19
|
||||
2025-01-01 11:03,2,19.31,Up,6,No,59
|
||||
2025-01-01 11:00,7,12.59,Down,1,No,10
|
||||
2025-01-01 15:54,4,16.59,Up,6,No,69
|
||||
2025-01-01 14:14,5,4.41,Up,3,No,20
|
||||
|
+1162
File diff suppressed because it is too large.
Load diff
+606
@@ -0,0 +1,606 @@
|
||||
# some funny
|
||||
|
||||
## import
|
||||
|
||||
|
||||
|
||||
```python
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
import seaborn as sns
|
||||
from sklearn.decomposition import PCA
|
||||
from sklearn.preprocessing import StandardScaler
|
||||
```
|
||||
|
||||
## read
|
||||
|
||||
|
||||
|
||||
```python
|
||||
# read
|
||||
apple = pd.read_csv("apple_quality.csv")
|
||||
elevator = pd.read_csv("elevator_traffic_dataset.csv")
|
||||
|
||||
# show basic info
|
||||
print(apple.info())
|
||||
print(elevator.info())
|
||||
|
||||
```
|
||||
|
||||
<class 'pandas.core.frame.DataFrame'>
|
||||
RangeIndex: 4000 entries, 0 to 3999
|
||||
Data columns (total 9 columns):
|
||||
# Column Non-Null Count Dtype
|
||||
--- ------ -------------- -----
|
||||
0 A_id 4000 non-null int64
|
||||
1 Size 4000 non-null float64
|
||||
2 Weight 4000 non-null float64
|
||||
3 Sweetness 4000 non-null float64
|
||||
4 Crunchiness 4000 non-null float64
|
||||
5 Juiciness 4000 non-null float64
|
||||
6 Ripeness 4000 non-null float64
|
||||
7 Acidity 4000 non-null float64
|
||||
8 Quality 4000 non-null object
|
||||
dtypes: float64(7), int64(1), object(1)
|
||||
memory usage: 281.4+ KB
|
||||
None
|
||||
<class 'pandas.core.frame.DataFrame'>
|
||||
RangeIndex: 300 entries, 0 to 299
|
||||
Data columns (total 7 columns):
|
||||
# Column Non-Null Count Dtype
|
||||
--- ------ -------------- -----
|
||||
0 timestamp 300 non-null object
|
||||
1 floor_requested 300 non-null int64
|
||||
2 wait_time_seconds 300 non-null float64
|
||||
3 direction 300 non-null object
|
||||
4 people_count 300 non-null int64
|
||||
5 peak_hour 300 non-null object
|
||||
6 load_percent 300 non-null int64
|
||||
dtypes: float64(1), int64(3), object(3)
|
||||
memory usage: 16.5+ KB
|
||||
None
|
||||
|
||||
|
||||
## Questions 1.2
|
||||
|
||||
- Discrete or continuous
|
||||
- Discrete = fixed values (0/1, categories)
|
||||
- Continuous = real numbers (height, weight)
|
||||
- Quantitative or qualitative
|
||||
- Quantitative = numeric, measurable
|
||||
- Qualitative = descriptive (color, gender)
|
||||
- Numerical or categorical
|
||||
- Numerical = numbers
|
||||
- Categorical = labels (even if encoded as numbers)
|
||||
|
||||
|
||||
### Apple
|
||||
|
||||
| Column | Discrete / Continuous | Quant / Qual | Numerical / Categorical | Notes |
|
||||
| ------------- | --------------------- | ------------ | ----------------------- | ------------------------------------------------- |
|
||||
| `A_id` | Discrete | Qualitative | Categorical | ID → **exclude from PCA** |
|
||||
| `Size` | Continuous | Quantitative | Numerical | Negative = centered / standardized value (normal) |
|
||||
| `Weight` | Continuous | Quantitative | Numerical | Same |
|
||||
| `Sweetness` | Continuous | Quantitative | Numerical | Sensor score |
|
||||
| `Crunchiness` | Continuous | Quantitative | Numerical | Sensor score |
|
||||
| `Juiciness` | Continuous | Quantitative | Numerical | Sensor score |
|
||||
| `Ripeness` | Continuous | Quantitative | Numerical | Sensor score |
|
||||
| `Acidity` | Continuous | Quantitative | Numerical | Sensor score |
|
||||
| `Quality` | Discrete | Qualitative | Categorical | **Label (Good/Bad)** |
|
||||
|
||||
|
||||
### Elevator
|
||||
|
||||
| Column | Discrete / Continuous | Quant / Qual | Numerical / Categorical | Notes |
|
||||
| ------------------- | --------------------- | ------------ | ----------------------- | ----------------------------- |
|
||||
| `timestamp` | Continuous (time) | Quantitative | Numerical | Usually **excluded from PCA** |
|
||||
| `floor_requested` | Discrete | Quantitative | Numerical | Integers, ordered |
|
||||
| `wait_time_seconds` | Continuous | Quantitative | Numerical | Good PCA feature |
|
||||
| `direction` | Discrete | Qualitative | Categorical | Label (Up/Down) |
|
||||
| `people_count` | Discrete | Quantitative | Numerical | Count |
|
||||
| `peak_hour` | Discrete | Qualitative | Categorical | Label (Yes/No) |
|
||||
| `load_percent` | Continuous | Quantitative | Numerical | 0–100 |
|
||||
|
||||
|
||||
## Clean the Data
|
||||
|
||||
We need light preparation
|
||||
|
||||
|
||||
|
||||
### Apple: drop ID & encode quality label
|
||||
|
||||
|
||||
|
||||
```python
|
||||
X_apple = apple.drop(columns=["A_id", "Quality"])
|
||||
y_apple = apple["Quality"]
|
||||
|
||||
X_apple.head()
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<style scoped>
|
||||
.dataframe tbody tr th:only-of-type {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.dataframe tbody tr th {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.dataframe thead th {
|
||||
text-align: right;
|
||||
}
|
||||
</style>
|
||||
<table border="1" class="dataframe">
|
||||
<thead>
|
||||
<tr style="text-align: right;">
|
||||
<th></th>
|
||||
<th>Size</th>
|
||||
<th>Weight</th>
|
||||
<th>Sweetness</th>
|
||||
<th>Crunchiness</th>
|
||||
<th>Juiciness</th>
|
||||
<th>Ripeness</th>
|
||||
<th>Acidity</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>0</th>
|
||||
<td>-3.970049</td>
|
||||
<td>-2.512336</td>
|
||||
<td>5.346330</td>
|
||||
<td>-1.012009</td>
|
||||
<td>1.844900</td>
|
||||
<td>0.329840</td>
|
||||
<td>-0.491590</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>1</th>
|
||||
<td>-1.195217</td>
|
||||
<td>-2.839257</td>
|
||||
<td>3.664059</td>
|
||||
<td>1.588232</td>
|
||||
<td>0.853286</td>
|
||||
<td>0.867530</td>
|
||||
<td>-0.722809</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>2</th>
|
||||
<td>-0.292024</td>
|
||||
<td>-1.351282</td>
|
||||
<td>-1.738429</td>
|
||||
<td>-0.342616</td>
|
||||
<td>2.838636</td>
|
||||
<td>-0.038033</td>
|
||||
<td>2.621636</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>3</th>
|
||||
<td>-0.657196</td>
|
||||
<td>-2.271627</td>
|
||||
<td>1.324874</td>
|
||||
<td>-0.097875</td>
|
||||
<td>3.637970</td>
|
||||
<td>-3.413761</td>
|
||||
<td>0.790723</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>4</th>
|
||||
<td>1.364217</td>
|
||||
<td>-1.296612</td>
|
||||
<td>-0.384658</td>
|
||||
<td>-0.553006</td>
|
||||
<td>3.030874</td>
|
||||
<td>-1.303849</td>
|
||||
<td>0.501984</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
### Elevator: encode direction & drop timestamp
|
||||
|
||||
|
||||
|
||||
```python
|
||||
elev = elevator.copy()
|
||||
|
||||
# encode categorical
|
||||
elev = pd.get_dummies(elev, columns=["direction"], drop_first=True)
|
||||
|
||||
# drop timestamp
|
||||
X_elev = elev.drop(columns=["timestamp", "peak_hour"])
|
||||
y_elev = elev["peak_hour"]
|
||||
X_elev.head()
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<style scoped>
|
||||
.dataframe tbody tr th:only-of-type {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.dataframe tbody tr th {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.dataframe thead th {
|
||||
text-align: right;
|
||||
}
|
||||
</style>
|
||||
<table border="1" class="dataframe">
|
||||
<thead>
|
||||
<tr style="text-align: right;">
|
||||
<th></th>
|
||||
<th>floor_requested</th>
|
||||
<th>wait_time_seconds</th>
|
||||
<th>people_count</th>
|
||||
<th>load_percent</th>
|
||||
<th>direction_Up</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>0</th>
|
||||
<td>5</td>
|
||||
<td>16.53</td>
|
||||
<td>5</td>
|
||||
<td>53</td>
|
||||
<td>False</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>1</th>
|
||||
<td>12</td>
|
||||
<td>18.98</td>
|
||||
<td>3</td>
|
||||
<td>20</td>
|
||||
<td>False</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>2</th>
|
||||
<td>4</td>
|
||||
<td>19.35</td>
|
||||
<td>1</td>
|
||||
<td>10</td>
|
||||
<td>False</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>3</th>
|
||||
<td>8</td>
|
||||
<td>3.22</td>
|
||||
<td>4</td>
|
||||
<td>31</td>
|
||||
<td>True</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>4</th>
|
||||
<td>6</td>
|
||||
<td>17.32</td>
|
||||
<td>4</td>
|
||||
<td>50</td>
|
||||
<td>True</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
## Question 1.4
|
||||
|
||||
There are labels!
|
||||
|
||||
for Apple is `Quality`
|
||||
|
||||
for elevator we may have `peak_hour` as weak label
|
||||
|
||||
PCA is unsupervised, so labels are not used in PCA, only for visualization or interpretation.
|
||||
|
||||
|
||||
## Summary Statistics
|
||||
|
||||
- Mean: average of a feature
|
||||
- Variance: how spread out values are
|
||||
- Covariance: how two features move together
|
||||
- Correlation: normalized covariance (range -1 to 1)
|
||||
|
||||
Mean, variance, covariance, and correlation are not defined for categorical features unless encoded. Therefore, PCA is applied only to numerical features.
|
||||
|
||||
|
||||
|
||||
```python
|
||||
print("Apple mean:\n", X_apple.mean())
|
||||
print("\nApple variance:\n", X_apple.var())
|
||||
print("\nApple covariance:\n", X_apple.cov())
|
||||
print("\nApple correlation:\n", X_apple.corr())
|
||||
```
|
||||
|
||||
Apple mean:
|
||||
Size -0.503015
|
||||
Weight -0.989547
|
||||
Sweetness -0.470479
|
||||
Crunchiness 0.985478
|
||||
Juiciness 0.512118
|
||||
Ripeness 0.498277
|
||||
Acidity 0.076877
|
||||
dtype: float64
|
||||
|
||||
Apple variance:
|
||||
Size 3.717410
|
||||
Weight 2.568029
|
||||
Sweetness 3.776962
|
||||
Crunchiness 1.967728
|
||||
Juiciness 3.726003
|
||||
Ripeness 3.513476
|
||||
Acidity 4.453238
|
||||
dtype: float64
|
||||
|
||||
Apple covariance:
|
||||
Size Weight Sweetness Crunchiness Juiciness Ripeness \
|
||||
Size 3.717410 -0.527422 -1.216599 0.459425 -0.070312 -0.487070
|
||||
Weight -0.527422 2.568029 -0.480381 -0.215535 -0.285396 -0.732395
|
||||
Sweetness -1.216599 -0.480381 3.776962 -0.102373 0.359690 -0.997409
|
||||
Crunchiness 0.459425 -0.215535 -0.102373 1.967728 -0.702944 -0.531084
|
||||
Juiciness -0.070312 -0.285396 0.359690 -0.702944 3.726003 -0.351485
|
||||
Ripeness -0.487070 -0.732395 -0.997409 -0.531084 -0.351485 3.513476
|
||||
Acidity 0.798357 0.055508 0.352699 0.207045 1.013117 -0.801667
|
||||
|
||||
Acidity
|
||||
Size 0.798357
|
||||
Weight 0.055508
|
||||
Sweetness 0.352699
|
||||
Crunchiness 0.207045
|
||||
Juiciness 1.013117
|
||||
Ripeness -0.801667
|
||||
Acidity 4.453238
|
||||
|
||||
Apple correlation:
|
||||
Size Weight Sweetness Crunchiness Juiciness Ripeness \
|
||||
Size 1.000000 -0.170702 -0.324680 0.169868 -0.018892 -0.134773
|
||||
Weight -0.170702 1.000000 -0.154246 -0.095882 -0.092263 -0.243824
|
||||
Sweetness -0.324680 -0.154246 1.000000 -0.037552 0.095882 -0.273800
|
||||
Crunchiness 0.169868 -0.095882 -0.037552 1.000000 -0.259607 -0.201982
|
||||
Juiciness -0.018892 -0.092263 0.095882 -0.259607 1.000000 -0.097144
|
||||
Ripeness -0.134773 -0.243824 -0.273800 -0.201982 -0.097144 1.000000
|
||||
Acidity 0.196218 0.016414 0.085999 0.069943 0.248714 -0.202669
|
||||
|
||||
Acidity
|
||||
Size 0.196218
|
||||
Weight 0.016414
|
||||
Sweetness 0.085999
|
||||
Crunchiness 0.069943
|
||||
Juiciness 0.248714
|
||||
Ripeness -0.202669
|
||||
Acidity 1.000000
|
||||
|
||||
|
||||
|
||||
```python
|
||||
print("Elevator mean:\n", X_elev.mean())
|
||||
print("\nElevator variance:\n", X_elev.var())
|
||||
print("\nElevator covariance:\n", X_elev.cov())
|
||||
print("\nElevator correlation:\n", X_elev.corr())
|
||||
```
|
||||
|
||||
Elevator mean:
|
||||
floor_requested 6.683333
|
||||
wait_time_seconds 12.227300
|
||||
people_count 3.713333
|
||||
load_percent 36.250000
|
||||
direction_Up 0.503333
|
||||
dtype: float64
|
||||
|
||||
Elevator variance:
|
||||
floor_requested 11.942865
|
||||
wait_time_seconds 20.445000
|
||||
people_count 3.589788
|
||||
load_percent 378.362040
|
||||
direction_Up 0.250825
|
||||
dtype: float64
|
||||
|
||||
Elevator covariance:
|
||||
floor_requested wait_time_seconds people_count \
|
||||
floor_requested 11.942865 1.237570 -0.539242
|
||||
wait_time_seconds 1.237570 20.445000 1.335444
|
||||
people_count -0.539242 1.335444 3.589788
|
||||
load_percent -6.087793 15.086062 33.001672
|
||||
direction_Up 0.123133 0.099156 0.041093
|
||||
|
||||
load_percent direction_Up
|
||||
floor_requested -6.087793 0.123133
|
||||
wait_time_seconds 15.086062 0.099156
|
||||
people_count 33.001672 0.041093
|
||||
load_percent 378.362040 1.027592
|
||||
direction_Up 1.027592 0.250825
|
||||
|
||||
Elevator correlation:
|
||||
floor_requested wait_time_seconds people_count \
|
||||
floor_requested 1.000000 0.079199 -0.082356
|
||||
wait_time_seconds 0.079199 1.000000 0.155883
|
||||
people_count -0.082356 0.155883 1.000000
|
||||
load_percent -0.090563 0.171525 0.895463
|
||||
direction_Up 0.071143 0.043787 0.043306
|
||||
|
||||
load_percent direction_Up
|
||||
floor_requested -0.090563 0.071143
|
||||
wait_time_seconds 0.171525 0.043787
|
||||
people_count 0.895463 0.043306
|
||||
load_percent 1.000000 0.105483
|
||||
direction_Up 0.105483 1.000000
|
||||
|
||||
|
||||
### Most Correlated Pairs
|
||||
|
||||
|
||||
|
||||
```python
|
||||
sns.heatmap(X_apple.corr(), annot=True)
|
||||
plt.title("Apple Correlation Matrix")
|
||||
plt.show()
|
||||
|
||||
sns.heatmap(X_elev.corr(), annot=True)
|
||||
plt.title("Elevator Correlation Matrix")
|
||||
plt.show()
|
||||
```
|
||||
|
||||
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
#### apple
|
||||
|
||||
size vs. sweetness? sweetness vs. ripeness? juiciness vs crunchiness? juiciness vs acidity? idek
|
||||
|
||||
#### elevator
|
||||
|
||||
load percent vs people count.
|
||||
wait time seconds vs people count? wait time seconds vs load percent?
|
||||
|
||||
|
||||
### cov
|
||||
|
||||
|
||||
|
||||
```python
|
||||
sns.heatmap(X_apple.cov(), annot=True)
|
||||
plt.title("Apple covariance")
|
||||
plt.show()
|
||||
|
||||
sns.heatmap(X_elev.cov(), annot=True)
|
||||
plt.title("Elevator covariance")
|
||||
plt.show()
|
||||
```
|
||||
|
||||
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
## Question 1.7
|
||||
|
||||
There are no missing data.
|
||||
|
||||
|
||||
## Standardize
|
||||
|
||||
|
||||
|
||||
```python
|
||||
scaler = StandardScaler()
|
||||
|
||||
X_apple_scaled = scaler.fit_transform(X_apple)
|
||||
X_elev_scaled = scaler.fit_transform(X_elev)
|
||||
|
||||
```
|
||||
|
||||
## PCA Fit & Transform
|
||||
|
||||
|
||||
|
||||
```python
|
||||
pca_apple = PCA()
|
||||
apple_pcs = pca_apple.fit_transform(X_apple_scaled)
|
||||
|
||||
print("Explained variance ratio:", pca_apple.explained_variance_ratio_)
|
||||
|
||||
```
|
||||
|
||||
Explained variance ratio: [0.21614201 0.20861653 0.17947635 0.16370152 0.10115033 0.08706457
|
||||
0.04384867]
|
||||
|
||||
|
||||
|
||||
```python
|
||||
pca_elev = PCA()
|
||||
elev_pcs = pca_elev.fit_transform(X_elev_scaled)
|
||||
|
||||
print("Explained variance ratio:", pca_elev.explained_variance_ratio_)
|
||||
|
||||
```
|
||||
|
||||
Explained variance ratio: [0.39472121 0.22406513 0.19121082 0.16957634 0.0204265 ]
|
||||
|
||||
|
||||
## question 2.1
|
||||
|
||||
What PCA actually does:
|
||||
|
||||
- Takes many correlated features
|
||||
- Rotates the space
|
||||
- Finds new axes (principal components)
|
||||
- PC1 = most variance
|
||||
- PC2 = second most, orthogonal
|
||||
|
||||
### Is there any difference while using principal components with highest and lowest values?
|
||||
|
||||
Using lowest-variance components loses information and mostly captures noise.
|
||||
|
||||
## 2D PCA Plot
|
||||
|
||||
|
||||
|
||||
```python
|
||||
plt.figure()
|
||||
plt.scatter(
|
||||
apple_pcs[:, 0], apple_pcs[:, 1], c=(y_apple == "good").astype(int), cmap="coolwarm"
|
||||
)
|
||||
plt.xlabel("PC1")
|
||||
plt.ylabel("PC2")
|
||||
plt.title("Apple PCA 2D")
|
||||
plt.colorbar(label="Good=1 Bad=0")
|
||||
plt.show()
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
|
||||
```python
|
||||
plt.figure()
|
||||
plt.scatter(
|
||||
elev_pcs[:, 0], elev_pcs[:, 1], c=(y_elev == "Yes").astype(int), cmap="viridis"
|
||||
)
|
||||
plt.xlabel("PC1")
|
||||
plt.ylabel("PC2")
|
||||
plt.title("Elevator PCA 2D")
|
||||
plt.colorbar(label="Peak hour (1=Yes)")
|
||||
plt.show()
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||

|
||||
|
||||
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Reference in new issue
Block a user