File size: 51,028 Bytes
2258da0
 
 
 
 
 
 
 
9871318
 
 
2258da0
 
 
 
 
 
 
 
 
 
 
 
 
9871318
 
 
 
2258da0
9871318
 
 
2258da0
9871318
 
 
 
 
 
 
 
2258da0
 
 
 
9871318
2258da0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0728ca7
 
 
 
 
 
 
 
 
 
2258da0
 
9871318
2258da0
 
 
 
0728ca7
 
 
 
 
 
 
2258da0
0728ca7
 
 
 
 
 
2258da0
 
 
 
0728ca7
 
 
 
 
2258da0
0728ca7
2258da0
0728ca7
 
2258da0
0728ca7
 
 
2258da0
 
 
 
0728ca7
 
 
 
 
2258da0
0728ca7
2258da0
0728ca7
 
2258da0
0728ca7
 
 
2258da0
 
 
 
0728ca7
 
 
 
 
2258da0
0728ca7
2258da0
0728ca7
 
2258da0
0728ca7
 
 
2258da0
 
 
 
0728ca7
 
 
 
 
 
 
2258da0
0728ca7
 
 
 
 
 
2258da0
 
 
 
0728ca7
 
 
 
 
 
 
2258da0
0728ca7
 
 
 
 
 
2258da0
 
 
 
0728ca7
 
 
 
 
 
 
2258da0
0728ca7
 
 
 
 
 
2258da0
 
 
 
0728ca7
 
 
 
2258da0
 
0728ca7
2258da0
0728ca7
 
2258da0
0728ca7
 
 
2258da0
 
 
 
0728ca7
 
 
 
 
2258da0
0728ca7
2258da0
0728ca7
 
2258da0
0728ca7
 
 
2258da0
 
 
 
0728ca7
 
 
 
 
 
 
2258da0
0728ca7
 
 
 
 
 
2258da0
 
 
0728ca7
2258da0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0728ca7
 
2258da0
 
 
 
 
 
0728ca7
 
 
 
 
 
 
2258da0
0728ca7
 
 
2258da0
0728ca7
 
2258da0
 
 
 
0728ca7
 
 
 
 
2258da0
0728ca7
2258da0
0728ca7
 
2258da0
 
0728ca7
 
2258da0
 
 
 
0728ca7
 
 
 
 
2258da0
0728ca7
2258da0
0728ca7
 
2258da0
 
0728ca7
 
2258da0
 
 
 
0728ca7
 
 
 
 
2258da0
0728ca7
2258da0
0728ca7
 
2258da0
 
0728ca7
 
2258da0
 
 
 
0728ca7
 
 
 
 
 
 
2258da0
0728ca7
 
 
2258da0
0728ca7
 
2258da0
 
 
 
0728ca7
 
 
 
 
 
 
2258da0
0728ca7
 
 
2258da0
0728ca7
 
2258da0
 
 
 
0728ca7
 
 
 
 
 
 
2258da0
0728ca7
 
 
2258da0
0728ca7
 
2258da0
 
 
 
0728ca7
 
 
 
2258da0
 
0728ca7
2258da0
0728ca7
 
2258da0
 
0728ca7
 
2258da0
 
 
 
0728ca7
 
 
 
 
2258da0
0728ca7
2258da0
0728ca7
 
2258da0
 
0728ca7
 
2258da0
 
 
 
0728ca7
 
 
 
 
 
 
2258da0
0728ca7
 
 
2258da0
0728ca7
 
2258da0
 
 
 
 
 
 
0728ca7
 
 
 
 
 
 
 
 
 
2258da0
 
0728ca7
 
 
 
 
 
 
 
 
 
2258da0
 
0728ca7
 
 
 
 
 
 
 
 
 
2258da0
 
0728ca7
 
 
 
 
 
 
 
 
 
2258da0
0728ca7
 
 
 
 
 
 
 
 
 
 
2258da0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9871318
2258da0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0728ca7
 
2258da0
0728ca7
 
 
 
2258da0
 
 
 
 
 
 
0728ca7
 
 
 
 
 
 
2258da0
 
 
 
 
 
 
0728ca7
 
 
 
 
 
 
2258da0
 
 
 
 
 
 
0728ca7
 
 
 
 
 
 
2258da0
 
 
 
 
 
 
0728ca7
 
 
 
 
 
2258da0
 
 
 
 
0728ca7
 
 
2258da0
 
 
 
 
 
 
 
 
 
 
 
 
 
0728ca7
 
 
 
 
 
 
2258da0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0728ca7
 
 
 
 
 
 
2258da0
 
 
 
 
 
 
0728ca7
 
2258da0
0728ca7
 
 
 
2258da0
 
 
 
 
0728ca7
 
2258da0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0728ca7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2258da0
 
 
 
0728ca7
2258da0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0728ca7
 
2258da0
0728ca7
 
 
 
2258da0
 
 
 
 
 
 
0728ca7
 
 
 
 
 
 
2258da0
 
 
 
 
 
 
0728ca7
 
 
 
 
 
 
2258da0
 
 
 
 
 
 
0728ca7
 
 
 
 
 
 
2258da0
 
 
 
 
 
 
0728ca7
 
 
 
 
 
2258da0
 
 
 
 
0728ca7
 
 
2258da0
 
 
 
 
 
 
 
 
 
 
 
 
 
0728ca7
 
 
 
 
 
 
2258da0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0728ca7
 
 
 
 
 
 
2258da0
 
 
 
 
 
 
0728ca7
 
2258da0
0728ca7
 
 
 
2258da0
 
 
 
 
0728ca7
 
2258da0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0728ca7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2258da0
 
 
 
 
 
 
 
 
 
 
 
0728ca7
2258da0
 
 
 
 
 
0728ca7
 
2258da0
0728ca7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2258da0
0728ca7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2258da0
0728ca7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2258da0
 
 
 
0728ca7
 
 
 
 
 
 
 
 
 
 
 
 
 
2258da0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0728ca7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2258da0
 
 
 
 
0728ca7
 
2258da0
 
 
 
0728ca7
 
 
 
 
2258da0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0728ca7
 
 
 
2258da0
 
 
0728ca7
2258da0
0728ca7
2258da0
 
0728ca7
2258da0
 
0728ca7
 
2258da0
 
 
0728ca7
 
 
2258da0
0728ca7
2258da0
0728ca7
2258da0
 
 
 
0728ca7
 
 
2258da0
0728ca7
2258da0
0728ca7
2258da0
0728ca7
 
 
 
 
2258da0
0728ca7
2258da0
0728ca7
2258da0
0728ca7
2258da0
 
 
0728ca7
2258da0
0728ca7
2258da0
 
 
0728ca7
 
 
 
 
 
2258da0
 
 
 
 
 
 
 
 
0728ca7
 
 
 
 
 
 
 
 
 
 
 
 
 
9871318
0728ca7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2258da0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0728ca7
 
2258da0
 
 
 
 
 
 
 
 
 
 
0728ca7
 
 
 
2258da0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "faad7818",
   "metadata": {},
   "source": [
    "# Synthetic Dummy Data Generator (UMKM)\n",
    "Notebook ini membuat data sintetis yang meniru pola data bisnis riil UMKM untuk analisis operasional, NLP, dan klasifikasi bisnis.\n",
    "\n",
    "Fitur utama yang dihasilkan:\n",
    "\n",
    "- Monthly_Revenue (IDR)\n",
    "- Net_Profit_Margin (%)\n",
    "- Burn_Rate_Ratio\n",
    "- Transaction_Count\n",
    "- Avg_Historical_Rating\n",
    "- Review_Text\n",
    "- Review_Volatility\n",
    "- Business_Tenure_Months\n",
    "- Repeat_Order_Rate (%)\n",
    "- Digital_Adoption_Score\n",
    "- Peak_Hour_Latency\n",
    "- Location_Competitiveness\n",
    "- Sentiment_Score (-1.0 s/d 1.0)\n",
    "- Class (Elite, Growth, Struggling, Critical)\n",
    "\n",
    "Karakteristik realisme yang dimodelkan:\n",
    "\n",
    "- Korelasi antar fitur operasional (contoh: adopsi digital cenderung meningkatkan retensi dan rating)\n",
    "- Trade-off bisnis (kompetisi tinggi dan latency tinggi menekan profitabilitas)\n",
    "- Distribusi finansial tidak simetris (AOV lognormal)\n",
    "- Noise terkontrol agar data tidak terlalu \"rapi\"\n",
    "- Review teks konsisten dengan sinyal kualitas (rating, volatility, latency)\n",
    "- Sentiment score diekstrak dari `Review_Text`\n",
    "\n",
    "Catatan target:\n",
    "\n",
    "- Variabel target adalah `Class` (kolom paling kanan)\n",
    "- Klasifikasi menggunakan threshold berbasis persentil agar distribusi kelas lebih seimbang\n",
    "- Urutan kelas: `Elite`, `Growth`, `Struggling`, `Critical`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "af962614",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Generated 150000 rows -> synthetic_umkm_data.csv\n",
      "\n",
      "Preview:\n"
     ]
    },
    {
     "data": {
      "application/vnd.microsoft.datawrangler.viewer.v0+json": {
       "columns": [
        {
         "name": "index",
         "rawType": "int64",
         "type": "integer"
        },
        {
         "name": "ID",
         "rawType": "int32",
         "type": "integer"
        },
        {
         "name": "Monthly_Revenue",
         "rawType": "int32",
         "type": "integer"
        },
        {
         "name": "Net_Profit_Margin (%)",
         "rawType": "float64",
         "type": "float"
        },
        {
         "name": "Burn_Rate_Ratio",
         "rawType": "float64",
         "type": "float"
        },
        {
         "name": "Transaction_Count",
         "rawType": "int32",
         "type": "integer"
        },
        {
         "name": "Avg_Historical_Rating",
         "rawType": "float64",
         "type": "float"
        },
        {
         "name": "Review_Text",
         "rawType": "object",
         "type": "string"
        },
        {
         "name": "Review_Volatility",
         "rawType": "float64",
         "type": "float"
        },
        {
         "name": "Business_Tenure_Months",
         "rawType": "int32",
         "type": "integer"
        },
        {
         "name": "Repeat_Order_Rate (%)",
         "rawType": "float64",
         "type": "float"
        },
        {
         "name": "Digital_Adoption_Score",
         "rawType": "float64",
         "type": "float"
        },
        {
         "name": "Peak_Hour_Latency",
         "rawType": "object",
         "type": "string"
        },
        {
         "name": "Location_Competitiveness",
         "rawType": "int32",
         "type": "integer"
        },
        {
         "name": "Sentiment_Score",
         "rawType": "float64",
         "type": "float"
        },
        {
         "name": "Class",
         "rawType": "object",
         "type": "string"
        }
       ],
       "ref": "f3816b53-8a85-4cea-a3c9-d8cfc2031baa",
       "rows": [
        [
         "0",
         "1",
         "6680716",
         "22.72",
         "0.811",
         "161",
         "4.75",
         "Transaksi digital lancar, proses checkout tidak ribet. Ad eius dolore qui.",
         "0.313",
         "105",
         "19.4",
         "4.24",
         "Low",
         "9",
         "-0.25",
         "Growth"
        ],
        [
         "1",
         "2",
         "5819101",
         "4.46",
         "0.968",
         "104",
         "4.21",
         "Harga dan kualitas seimbang, pengalaman biasa saja. Assumenda in adipisci dolor magnam ad dicta.",
         "0.632",
         "95",
         "14.87",
         "1.27",
         "Med",
         "10",
         "0.0",
         "Growth"
        ],
        [
         "2",
         "3",
         "5236404",
         "-10.12",
         "1.047",
         "102",
         "3.51",
         "Pelayanan standar, masih bisa ditingkatkan.",
         "0.47",
         "17",
         "21.0",
         "3.37",
         "Med",
         "8",
         "0.0",
         "Struggling"
        ],
        [
         "3",
         "4",
         "8043552",
         "0.04",
         "0.969",
         "99",
         "4.33",
         "Transaksi digital lancar, proses checkout tidak ribet.",
         "0.206",
         "109",
         "30.62",
         "5.41",
         "Low",
         "13",
         "-0.25",
         "Growth"
        ],
        [
         "4",
         "5",
         "6071256",
         "4.22",
         "0.954",
         "115",
         "4.34",
         "Selalu repeat order karena kualitasnya terjaga. In ipsum eius sit quis cum in.",
         "0.232",
         "74",
         "20.87",
         "2.67",
         "Low",
         "7",
         "0.25",
         "Growth"
        ],
        [
         "5",
         "6",
         "6683141",
         "29.68",
         "0.727",
         "108",
         "4.54",
         "Pengiriman cepat, admin komunikatif. Culpa vero excepturi at atque.",
         "0.185",
         "23",
         "26.35",
         "5.59",
         "Low",
         "16",
         "0.55",
         "Elite"
        ],
        [
         "6",
         "7",
         "14123932",
         "15.28",
         "0.86",
         "167",
         "4.54",
         "Produk cukup baik, kadang waktu tunggu agak lama. Nobis rem quas modi voluptate fugiat.",
         "0.434",
         "105",
         "22.15",
         "3.95",
         "Med",
         "6",
         "0.0",
         "Growth"
        ],
        [
         "7",
         "8",
         "8483571",
         "8.51",
         "0.862",
         "180",
         "4.83",
         "Selalu repeat order karena kualitasnya terjaga.",
         "0.346",
         "124",
         "23.17",
         "7.59",
         "Low",
         "10",
         "0.25",
         "Growth"
        ],
        [
         "8",
         "9",
         "14900709",
         "6.0",
         "0.908",
         "135",
         "4.86",
         "Selalu repeat order karena kualitasnya terjaga. Eos occaecati suscipit facere deleniti architecto optio.",
         "0.285",
         "77",
         "15.85",
         "6.56",
         "Low",
         "7",
         "0.25",
         "Growth"
        ],
        [
         "9",
         "10",
         "9232562",
         "-13.64",
         "1.085",
         "89",
         "4.39",
         "Transaksi digital lancar, proses checkout tidak ribet.",
         "0.182",
         "90",
         "17.3",
         "3.22",
         "Low",
         "9",
         "-0.25",
         "Struggling"
        ]
       ],
       "shape": {
        "columns": 15,
        "rows": 10
       }
      },
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>ID</th>\n",
       "      <th>Monthly_Revenue</th>\n",
       "      <th>Net_Profit_Margin (%)</th>\n",
       "      <th>Burn_Rate_Ratio</th>\n",
       "      <th>Transaction_Count</th>\n",
       "      <th>Avg_Historical_Rating</th>\n",
       "      <th>Review_Text</th>\n",
       "      <th>Review_Volatility</th>\n",
       "      <th>Business_Tenure_Months</th>\n",
       "      <th>Repeat_Order_Rate (%)</th>\n",
       "      <th>Digital_Adoption_Score</th>\n",
       "      <th>Peak_Hour_Latency</th>\n",
       "      <th>Location_Competitiveness</th>\n",
       "      <th>Sentiment_Score</th>\n",
       "      <th>Class</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>6680716</td>\n",
       "      <td>22.72</td>\n",
       "      <td>0.811</td>\n",
       "      <td>161</td>\n",
       "      <td>4.75</td>\n",
       "      <td>Transaksi digital lancar, proses checkout tida...</td>\n",
       "      <td>0.313</td>\n",
       "      <td>105</td>\n",
       "      <td>19.40</td>\n",
       "      <td>4.24</td>\n",
       "      <td>Low</td>\n",
       "      <td>9</td>\n",
       "      <td>-0.25</td>\n",
       "      <td>Growth</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>5819101</td>\n",
       "      <td>4.46</td>\n",
       "      <td>0.968</td>\n",
       "      <td>104</td>\n",
       "      <td>4.21</td>\n",
       "      <td>Harga dan kualitas seimbang, pengalaman biasa ...</td>\n",
       "      <td>0.632</td>\n",
       "      <td>95</td>\n",
       "      <td>14.87</td>\n",
       "      <td>1.27</td>\n",
       "      <td>Med</td>\n",
       "      <td>10</td>\n",
       "      <td>0.00</td>\n",
       "      <td>Growth</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>5236404</td>\n",
       "      <td>-10.12</td>\n",
       "      <td>1.047</td>\n",
       "      <td>102</td>\n",
       "      <td>3.51</td>\n",
       "      <td>Pelayanan standar, masih bisa ditingkatkan.</td>\n",
       "      <td>0.470</td>\n",
       "      <td>17</td>\n",
       "      <td>21.00</td>\n",
       "      <td>3.37</td>\n",
       "      <td>Med</td>\n",
       "      <td>8</td>\n",
       "      <td>0.00</td>\n",
       "      <td>Struggling</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>8043552</td>\n",
       "      <td>0.04</td>\n",
       "      <td>0.969</td>\n",
       "      <td>99</td>\n",
       "      <td>4.33</td>\n",
       "      <td>Transaksi digital lancar, proses checkout tida...</td>\n",
       "      <td>0.206</td>\n",
       "      <td>109</td>\n",
       "      <td>30.62</td>\n",
       "      <td>5.41</td>\n",
       "      <td>Low</td>\n",
       "      <td>13</td>\n",
       "      <td>-0.25</td>\n",
       "      <td>Growth</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>6071256</td>\n",
       "      <td>4.22</td>\n",
       "      <td>0.954</td>\n",
       "      <td>115</td>\n",
       "      <td>4.34</td>\n",
       "      <td>Selalu repeat order karena kualitasnya terjaga...</td>\n",
       "      <td>0.232</td>\n",
       "      <td>74</td>\n",
       "      <td>20.87</td>\n",
       "      <td>2.67</td>\n",
       "      <td>Low</td>\n",
       "      <td>7</td>\n",
       "      <td>0.25</td>\n",
       "      <td>Growth</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>6</td>\n",
       "      <td>6683141</td>\n",
       "      <td>29.68</td>\n",
       "      <td>0.727</td>\n",
       "      <td>108</td>\n",
       "      <td>4.54</td>\n",
       "      <td>Pengiriman cepat, admin komunikatif. Culpa ver...</td>\n",
       "      <td>0.185</td>\n",
       "      <td>23</td>\n",
       "      <td>26.35</td>\n",
       "      <td>5.59</td>\n",
       "      <td>Low</td>\n",
       "      <td>16</td>\n",
       "      <td>0.55</td>\n",
       "      <td>Elite</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>7</td>\n",
       "      <td>14123932</td>\n",
       "      <td>15.28</td>\n",
       "      <td>0.860</td>\n",
       "      <td>167</td>\n",
       "      <td>4.54</td>\n",
       "      <td>Produk cukup baik, kadang waktu tunggu agak la...</td>\n",
       "      <td>0.434</td>\n",
       "      <td>105</td>\n",
       "      <td>22.15</td>\n",
       "      <td>3.95</td>\n",
       "      <td>Med</td>\n",
       "      <td>6</td>\n",
       "      <td>0.00</td>\n",
       "      <td>Growth</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>8</td>\n",
       "      <td>8483571</td>\n",
       "      <td>8.51</td>\n",
       "      <td>0.862</td>\n",
       "      <td>180</td>\n",
       "      <td>4.83</td>\n",
       "      <td>Selalu repeat order karena kualitasnya terjaga.</td>\n",
       "      <td>0.346</td>\n",
       "      <td>124</td>\n",
       "      <td>23.17</td>\n",
       "      <td>7.59</td>\n",
       "      <td>Low</td>\n",
       "      <td>10</td>\n",
       "      <td>0.25</td>\n",
       "      <td>Growth</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>9</td>\n",
       "      <td>14900709</td>\n",
       "      <td>6.00</td>\n",
       "      <td>0.908</td>\n",
       "      <td>135</td>\n",
       "      <td>4.86</td>\n",
       "      <td>Selalu repeat order karena kualitasnya terjaga...</td>\n",
       "      <td>0.285</td>\n",
       "      <td>77</td>\n",
       "      <td>15.85</td>\n",
       "      <td>6.56</td>\n",
       "      <td>Low</td>\n",
       "      <td>7</td>\n",
       "      <td>0.25</td>\n",
       "      <td>Growth</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>10</td>\n",
       "      <td>9232562</td>\n",
       "      <td>-13.64</td>\n",
       "      <td>1.085</td>\n",
       "      <td>89</td>\n",
       "      <td>4.39</td>\n",
       "      <td>Transaksi digital lancar, proses checkout tida...</td>\n",
       "      <td>0.182</td>\n",
       "      <td>90</td>\n",
       "      <td>17.30</td>\n",
       "      <td>3.22</td>\n",
       "      <td>Low</td>\n",
       "      <td>9</td>\n",
       "      <td>-0.25</td>\n",
       "      <td>Struggling</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   ID  Monthly_Revenue  Net_Profit_Margin (%)  Burn_Rate_Ratio  \\\n",
       "0   1          6680716                  22.72            0.811   \n",
       "1   2          5819101                   4.46            0.968   \n",
       "2   3          5236404                 -10.12            1.047   \n",
       "3   4          8043552                   0.04            0.969   \n",
       "4   5          6071256                   4.22            0.954   \n",
       "5   6          6683141                  29.68            0.727   \n",
       "6   7         14123932                  15.28            0.860   \n",
       "7   8          8483571                   8.51            0.862   \n",
       "8   9         14900709                   6.00            0.908   \n",
       "9  10          9232562                 -13.64            1.085   \n",
       "\n",
       "   Transaction_Count  Avg_Historical_Rating  \\\n",
       "0                161                   4.75   \n",
       "1                104                   4.21   \n",
       "2                102                   3.51   \n",
       "3                 99                   4.33   \n",
       "4                115                   4.34   \n",
       "5                108                   4.54   \n",
       "6                167                   4.54   \n",
       "7                180                   4.83   \n",
       "8                135                   4.86   \n",
       "9                 89                   4.39   \n",
       "\n",
       "                                         Review_Text  Review_Volatility  \\\n",
       "0  Transaksi digital lancar, proses checkout tida...              0.313   \n",
       "1  Harga dan kualitas seimbang, pengalaman biasa ...              0.632   \n",
       "2        Pelayanan standar, masih bisa ditingkatkan.              0.470   \n",
       "3  Transaksi digital lancar, proses checkout tida...              0.206   \n",
       "4  Selalu repeat order karena kualitasnya terjaga...              0.232   \n",
       "5  Pengiriman cepat, admin komunikatif. Culpa ver...              0.185   \n",
       "6  Produk cukup baik, kadang waktu tunggu agak la...              0.434   \n",
       "7    Selalu repeat order karena kualitasnya terjaga.              0.346   \n",
       "8  Selalu repeat order karena kualitasnya terjaga...              0.285   \n",
       "9  Transaksi digital lancar, proses checkout tida...              0.182   \n",
       "\n",
       "   Business_Tenure_Months  Repeat_Order_Rate (%)  Digital_Adoption_Score  \\\n",
       "0                     105                  19.40                    4.24   \n",
       "1                      95                  14.87                    1.27   \n",
       "2                      17                  21.00                    3.37   \n",
       "3                     109                  30.62                    5.41   \n",
       "4                      74                  20.87                    2.67   \n",
       "5                      23                  26.35                    5.59   \n",
       "6                     105                  22.15                    3.95   \n",
       "7                     124                  23.17                    7.59   \n",
       "8                      77                  15.85                    6.56   \n",
       "9                      90                  17.30                    3.22   \n",
       "\n",
       "  Peak_Hour_Latency  Location_Competitiveness  Sentiment_Score       Class  \n",
       "0               Low                         9            -0.25      Growth  \n",
       "1               Med                        10             0.00      Growth  \n",
       "2               Med                         8             0.00  Struggling  \n",
       "3               Low                        13            -0.25      Growth  \n",
       "4               Low                         7             0.25      Growth  \n",
       "5               Low                        16             0.55       Elite  \n",
       "6               Med                         6             0.00      Growth  \n",
       "7               Low                        10             0.25      Growth  \n",
       "8               Low                         7             0.25      Growth  \n",
       "9               Low                         9            -0.25  Struggling  "
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "Summary stats:\n"
     ]
    },
    {
     "data": {
      "application/vnd.microsoft.datawrangler.viewer.v0+json": {
       "columns": [
        {
         "name": "index",
         "rawType": "object",
         "type": "string"
        },
        {
         "name": "count",
         "rawType": "object",
         "type": "unknown"
        },
        {
         "name": "unique",
         "rawType": "object",
         "type": "unknown"
        },
        {
         "name": "top",
         "rawType": "object",
         "type": "unknown"
        },
        {
         "name": "freq",
         "rawType": "object",
         "type": "unknown"
        },
        {
         "name": "mean",
         "rawType": "object",
         "type": "unknown"
        },
        {
         "name": "std",
         "rawType": "object",
         "type": "unknown"
        },
        {
         "name": "min",
         "rawType": "object",
         "type": "unknown"
        },
        {
         "name": "25%",
         "rawType": "object",
         "type": "unknown"
        },
        {
         "name": "50%",
         "rawType": "object",
         "type": "unknown"
        },
        {
         "name": "75%",
         "rawType": "object",
         "type": "unknown"
        },
        {
         "name": "max",
         "rawType": "object",
         "type": "unknown"
        }
       ],
       "ref": "97626024-31ed-4e88-8d10-a524d1d63c40",
       "rows": [
        [
         "ID",
         "150000.0",
         null,
         null,
         null,
         "75000.5",
         "43301.414526548666",
         "1.0",
         "37500.75",
         "75000.5",
         "112500.25",
         "150000.0"
        ],
        [
         "Monthly_Revenue",
         "150000.0",
         null,
         null,
         null,
         "8451726.379766667",
         "5291163.126671218",
         "1500000.0",
         "4745883.75",
         "7245678.5",
         "10830255.25",
         "82067536.0"
        ],
        [
         "Net_Profit_Margin (%)",
         "150000.0",
         null,
         null,
         null,
         "1.8422716666666668",
         "15.002406129333442",
         "-35.0",
         "-8.43",
         "2.16",
         "12.31",
         "45.0"
        ],
        [
         "Burn_Rate_Ratio",
         "150000.0",
         null,
         null,
         null,
         "0.9698845333333335",
         "0.14403925496022033",
         "0.437",
         "0.869",
         "0.966",
         "1.067",
         "1.55"
        ],
        [
         "Transaction_Count",
         "150000.0",
         null,
         null,
         null,
         "117.76666666666667",
         "42.61849251746928",
         "9.0",
         "86.0",
         "117.0",
         "149.0",
         "285.0"
        ],
        [
         "Avg_Historical_Rating",
         "150000.0",
         null,
         null,
         null,
         "4.061106533333334",
         "0.5216979171021869",
         "1.5",
         "3.77",
         "4.1",
         "4.41",
         "5.0"
        ],
        [
         "Review_Text",
         "150000",
         "45139",
         "Produk cukup baik, kadang waktu tunggu agak lama.",
         "11632",
         null,
         null,
         null,
         null,
         null,
         null,
         null
        ],
        [
         "Review_Volatility",
         "150000.0",
         null,
         null,
         null,
         "0.4072028",
         "0.16680582218068832",
         "0.06",
         "0.278",
         "0.405",
         "0.526",
         "0.99"
        ],
        [
         "Business_Tenure_Months",
         "150000.0",
         null,
         null,
         null,
         "91.00684",
         "51.10473615861304",
         "3.0",
         "47.0",
         "91.0",
         "135.0",
         "179.0"
        ],
        [
         "Repeat_Order_Rate (%)",
         "150000.0",
         null,
         null,
         null,
         "19.98052113333334",
         "8.021928124041764",
         "2.0",
         "14.45",
         "19.95",
         "25.43",
         "54.06"
        ],
        [
         "Digital_Adoption_Score",
         "150000.0",
         null,
         null,
         null,
         "3.5468941333333333",
         "1.670303095351794",
         "1.0",
         "2.26",
         "3.48",
         "4.69",
         "10.0"
        ],
        [
         "Peak_Hour_Latency",
         "150000",
         "3",
         "Med",
         "68695",
         null,
         null,
         null,
         null,
         null,
         null,
         null
        ],
        [
         "Location_Competitiveness",
         "150000.0",
         null,
         null,
         null,
         "8.998806666666667",
         "2.8286024669263194",
         "1.0",
         "7.0",
         "9.0",
         "11.0",
         "23.0"
        ],
        [
         "Sentiment_Score",
         "150000.0",
         null,
         null,
         null,
         "-0.018946333333333332",
         "0.32053378095387564",
         "-0.65",
         "-0.25",
         "0.0",
         "0.0",
         "0.8"
        ],
        [
         "Class",
         "150000",
         "4",
         "Growth",
         "85678",
         null,
         null,
         null,
         null,
         null,
         null,
         null
        ]
       ],
       "shape": {
        "columns": 11,
        "rows": 15
       }
      },
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>count</th>\n",
       "      <th>unique</th>\n",
       "      <th>top</th>\n",
       "      <th>freq</th>\n",
       "      <th>mean</th>\n",
       "      <th>std</th>\n",
       "      <th>min</th>\n",
       "      <th>25%</th>\n",
       "      <th>50%</th>\n",
       "      <th>75%</th>\n",
       "      <th>max</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>ID</th>\n",
       "      <td>150000.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>75000.5</td>\n",
       "      <td>43301.414527</td>\n",
       "      <td>1.0</td>\n",
       "      <td>37500.75</td>\n",
       "      <td>75000.5</td>\n",
       "      <td>112500.25</td>\n",
       "      <td>150000.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Monthly_Revenue</th>\n",
       "      <td>150000.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>8451726.379767</td>\n",
       "      <td>5291163.126671</td>\n",
       "      <td>1500000.0</td>\n",
       "      <td>4745883.75</td>\n",
       "      <td>7245678.5</td>\n",
       "      <td>10830255.25</td>\n",
       "      <td>82067536.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Net_Profit_Margin (%)</th>\n",
       "      <td>150000.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1.842272</td>\n",
       "      <td>15.002406</td>\n",
       "      <td>-35.0</td>\n",
       "      <td>-8.43</td>\n",
       "      <td>2.16</td>\n",
       "      <td>12.31</td>\n",
       "      <td>45.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Burn_Rate_Ratio</th>\n",
       "      <td>150000.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.969885</td>\n",
       "      <td>0.144039</td>\n",
       "      <td>0.437</td>\n",
       "      <td>0.869</td>\n",
       "      <td>0.966</td>\n",
       "      <td>1.067</td>\n",
       "      <td>1.55</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Transaction_Count</th>\n",
       "      <td>150000.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>117.766667</td>\n",
       "      <td>42.618493</td>\n",
       "      <td>9.0</td>\n",
       "      <td>86.0</td>\n",
       "      <td>117.0</td>\n",
       "      <td>149.0</td>\n",
       "      <td>285.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Avg_Historical_Rating</th>\n",
       "      <td>150000.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>4.061107</td>\n",
       "      <td>0.521698</td>\n",
       "      <td>1.5</td>\n",
       "      <td>3.77</td>\n",
       "      <td>4.1</td>\n",
       "      <td>4.41</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Review_Text</th>\n",
       "      <td>150000</td>\n",
       "      <td>45139</td>\n",
       "      <td>Produk cukup baik, kadang waktu tunggu agak lama.</td>\n",
       "      <td>11632</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Review_Volatility</th>\n",
       "      <td>150000.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.407203</td>\n",
       "      <td>0.166806</td>\n",
       "      <td>0.06</td>\n",
       "      <td>0.278</td>\n",
       "      <td>0.405</td>\n",
       "      <td>0.526</td>\n",
       "      <td>0.99</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Business_Tenure_Months</th>\n",
       "      <td>150000.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>91.00684</td>\n",
       "      <td>51.104736</td>\n",
       "      <td>3.0</td>\n",
       "      <td>47.0</td>\n",
       "      <td>91.0</td>\n",
       "      <td>135.0</td>\n",
       "      <td>179.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Repeat_Order_Rate (%)</th>\n",
       "      <td>150000.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>19.980521</td>\n",
       "      <td>8.021928</td>\n",
       "      <td>2.0</td>\n",
       "      <td>14.45</td>\n",
       "      <td>19.95</td>\n",
       "      <td>25.43</td>\n",
       "      <td>54.06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Digital_Adoption_Score</th>\n",
       "      <td>150000.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>3.546894</td>\n",
       "      <td>1.670303</td>\n",
       "      <td>1.0</td>\n",
       "      <td>2.26</td>\n",
       "      <td>3.48</td>\n",
       "      <td>4.69</td>\n",
       "      <td>10.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Peak_Hour_Latency</th>\n",
       "      <td>150000</td>\n",
       "      <td>3</td>\n",
       "      <td>Med</td>\n",
       "      <td>68695</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Location_Competitiveness</th>\n",
       "      <td>150000.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>8.998807</td>\n",
       "      <td>2.828602</td>\n",
       "      <td>1.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>23.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Sentiment_Score</th>\n",
       "      <td>150000.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>-0.018946</td>\n",
       "      <td>0.320534</td>\n",
       "      <td>-0.65</td>\n",
       "      <td>-0.25</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Class</th>\n",
       "      <td>150000</td>\n",
       "      <td>4</td>\n",
       "      <td>Growth</td>\n",
       "      <td>85678</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                             count unique  \\\n",
       "ID                        150000.0    NaN   \n",
       "Monthly_Revenue           150000.0    NaN   \n",
       "Net_Profit_Margin (%)     150000.0    NaN   \n",
       "Burn_Rate_Ratio           150000.0    NaN   \n",
       "Transaction_Count         150000.0    NaN   \n",
       "Avg_Historical_Rating     150000.0    NaN   \n",
       "Review_Text                 150000  45139   \n",
       "Review_Volatility         150000.0    NaN   \n",
       "Business_Tenure_Months    150000.0    NaN   \n",
       "Repeat_Order_Rate (%)     150000.0    NaN   \n",
       "Digital_Adoption_Score    150000.0    NaN   \n",
       "Peak_Hour_Latency           150000      3   \n",
       "Location_Competitiveness  150000.0    NaN   \n",
       "Sentiment_Score           150000.0    NaN   \n",
       "Class                       150000      4   \n",
       "\n",
       "                                                                        top  \\\n",
       "ID                                                                      NaN   \n",
       "Monthly_Revenue                                                         NaN   \n",
       "Net_Profit_Margin (%)                                                   NaN   \n",
       "Burn_Rate_Ratio                                                         NaN   \n",
       "Transaction_Count                                                       NaN   \n",
       "Avg_Historical_Rating                                                   NaN   \n",
       "Review_Text               Produk cukup baik, kadang waktu tunggu agak lama.   \n",
       "Review_Volatility                                                       NaN   \n",
       "Business_Tenure_Months                                                  NaN   \n",
       "Repeat_Order_Rate (%)                                                   NaN   \n",
       "Digital_Adoption_Score                                                  NaN   \n",
       "Peak_Hour_Latency                                                       Med   \n",
       "Location_Competitiveness                                                NaN   \n",
       "Sentiment_Score                                                         NaN   \n",
       "Class                                                                Growth   \n",
       "\n",
       "                           freq            mean             std        min  \\\n",
       "ID                          NaN         75000.5    43301.414527        1.0   \n",
       "Monthly_Revenue             NaN  8451726.379767  5291163.126671  1500000.0   \n",
       "Net_Profit_Margin (%)       NaN        1.842272       15.002406      -35.0   \n",
       "Burn_Rate_Ratio             NaN        0.969885        0.144039      0.437   \n",
       "Transaction_Count           NaN      117.766667       42.618493        9.0   \n",
       "Avg_Historical_Rating       NaN        4.061107        0.521698        1.5   \n",
       "Review_Text               11632             NaN             NaN        NaN   \n",
       "Review_Volatility           NaN        0.407203        0.166806       0.06   \n",
       "Business_Tenure_Months      NaN        91.00684       51.104736        3.0   \n",
       "Repeat_Order_Rate (%)       NaN       19.980521        8.021928        2.0   \n",
       "Digital_Adoption_Score      NaN        3.546894        1.670303        1.0   \n",
       "Peak_Hour_Latency         68695             NaN             NaN        NaN   \n",
       "Location_Competitiveness    NaN        8.998807        2.828602        1.0   \n",
       "Sentiment_Score             NaN       -0.018946        0.320534      -0.65   \n",
       "Class                     85678             NaN             NaN        NaN   \n",
       "\n",
       "                                 25%        50%          75%         max  \n",
       "ID                          37500.75    75000.5    112500.25    150000.0  \n",
       "Monthly_Revenue           4745883.75  7245678.5  10830255.25  82067536.0  \n",
       "Net_Profit_Margin (%)          -8.43       2.16        12.31        45.0  \n",
       "Burn_Rate_Ratio                0.869      0.966        1.067        1.55  \n",
       "Transaction_Count               86.0      117.0        149.0       285.0  \n",
       "Avg_Historical_Rating           3.77        4.1         4.41         5.0  \n",
       "Review_Text                      NaN        NaN          NaN         NaN  \n",
       "Review_Volatility              0.278      0.405        0.526        0.99  \n",
       "Business_Tenure_Months          47.0       91.0        135.0       179.0  \n",
       "Repeat_Order_Rate (%)          14.45      19.95        25.43       54.06  \n",
       "Digital_Adoption_Score          2.26       3.48         4.69        10.0  \n",
       "Peak_Hour_Latency                NaN        NaN          NaN         NaN  \n",
       "Location_Competitiveness         7.0        9.0         11.0        23.0  \n",
       "Sentiment_Score                -0.25        0.0          0.0         0.8  \n",
       "Class                            NaN        NaN          NaN         NaN  "
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "Class counts:\n",
      "Class\n",
      "Growth        85678\n",
      "Struggling    41571\n",
      "Critical      12561\n",
      "Elite         10190\n",
      "Name: count, dtype: int64\n"
     ]
    }
   ],
   "source": [
    "import random\n",
    "from typing import List\n",
    "\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "from faker import Faker\n",
    "\n",
    "# Reproducibility\n",
    "SEED = 42\n",
    "np.random.seed(SEED)\n",
    "random.seed(SEED)\n",
    "fake = Faker(\"id_ID\")\n",
    "Faker.seed(SEED)\n",
    "\n",
    "# Config\n",
    "N_SAMPLES = 150000\n",
    "OUTPUT_CSV = \"synthetic_umkm_data.csv\"\n",
    "\n",
    "# Review templates aligned with sentiment\n",
    "POSITIVE_REVIEWS = [\n",
    "    \"Pelayanan cepat dan ramah, pesanan selalu tepat.\",\n",
    "    \"Kualitas produk konsisten, harga masih masuk akal.\",\n",
    "    \"Aplikasi pemesanan mudah dipakai dan responsif.\",\n",
    "    \"Pengiriman cepat, admin komunikatif.\",\n",
    "    \"Selalu repeat order karena kualitasnya terjaga.\",\n",
    "    \"Transaksi digital lancar, proses checkout tidak ribet.\",\n",
    "]\n",
    "\n",
    "NEUTRAL_REVIEWS = [\n",
    "    \"Produk cukup baik, kadang waktu tunggu agak lama.\",\n",
    "    \"Pelayanan standar, masih bisa ditingkatkan.\",\n",
    "    \"Harga dan kualitas seimbang, pengalaman biasa saja.\",\n",
    "    \"Kadang stok kosong saat jam ramai.\",\n",
    "    \"Secara umum oke, hanya respon chat kadang lambat.\",\n",
    "]\n",
    "\n",
    "NEGATIVE_REVIEWS = [\n",
    "    \"Pesanan sering terlambat saat jam sibuk.\",\n",
    "    \"Kualitas tidak konsisten, kadang bagus kadang kurang.\",\n",
    "    \"Respons admin lambat dan informasi kurang jelas.\",\n",
    "    \"Proses pembayaran sering bermasalah.\",\n",
    "    \"Harga naik tapi layanan tidak membaik.\",\n",
    "    \"Sudah beberapa kali order, pengalaman makin menurun.\",\n",
    "]\n",
    "\n",
    "\n",
    "def clamp(x: np.ndarray, low: float, high: float) -> np.ndarray:\n",
    "    return np.clip(x, low, high)\n",
    "\n",
    "\n",
    "def pick_review(rating: float, volatility: float, latency: str) -> str:\n",
    "    \"\"\"Generate review text coherent with quality signal.\"\"\"\n",
    "    base_pool: List[str]\n",
    "\n",
    "    if rating >= 4.2 and volatility < 0.45 and latency == \"Low\":\n",
    "        base_pool = POSITIVE_REVIEWS\n",
    "    elif rating < 3.4 or latency == \"High\":\n",
    "        base_pool = NEGATIVE_REVIEWS\n",
    "    else:\n",
    "        base_pool = NEUTRAL_REVIEWS\n",
    "\n",
    "    text = random.choice(base_pool)\n",
    "\n",
    "    # Add slight random variation so reviews don't look templated\n",
    "    if random.random() < 0.3:\n",
    "        text += \" \" + fake.sentence(nb_words=6)\n",
    "    return text\n",
    "\n",
    "\n",
    "def calculate_sentiment_score(review_text: str) -> float:\n",
    "    \"\"\"Convert review text into sentiment score in range [-1.0, 1.0].\"\"\"\n",
    "    review_lower = review_text.lower()\n",
    "\n",
    "    positive_keywords = {\n",
    "        \"cepat\": 0.30,\n",
    "        \"ramah\": 0.30,\n",
    "        \"mudah\": 0.25,\n",
    "        \"responsif\": 0.30,\n",
    "        \"lancar\": 0.25,\n",
    "        \"komunikatif\": 0.25,\n",
    "        \"terjaga\": 0.25,\n",
    "        \"konsisten\": 0.20,\n",
    "        \"tepat\": 0.20,\n",
    "    }\n",
    "    negative_keywords = {\n",
    "        \"lambat\": -0.30,\n",
    "        \"tidak\": -0.20,\n",
    "        \"kurang\": -0.25,\n",
    "        \"bermasalah\": -0.35,\n",
    "        \"terlambat\": -0.35,\n",
    "        \"ribet\": -0.30,\n",
    "        \"buruk\": -0.40,\n",
    "        \"menurun\": -0.30,\n",
    "    }\n",
    "\n",
    "    score = 0.0\n",
    "    for word, weight in positive_keywords.items():\n",
    "        if word in review_lower:\n",
    "            score += weight\n",
    "    for word, weight in negative_keywords.items():\n",
    "        if word in review_lower:\n",
    "            score += weight\n",
    "\n",
    "    return float(clamp(np.array([score]), -1.0, 1.0)[0])\n",
    "\n",
    "\n",
    "# 1) Business maturity and competitiveness\n",
    "business_tenure = np.random.randint(3, 180, size=N_SAMPLES)  # months\n",
    "location_competitiveness = np.random.poisson(lam=8, size=N_SAMPLES) + 1\n",
    "\n",
    "# 2) Digital adoption (1-10), positively related with tenure (up to a limit)\n",
    "base_digital = 3.3 + 0.02 * np.sqrt(business_tenure)\n",
    "noise_digital = np.random.normal(0, 1.8, N_SAMPLES)\n",
    "digital_adoption = clamp(base_digital + noise_digital, 1, 10)\n",
    "\n",
    "# 3) Transaction count depends on maturity, digital, and local competition\n",
    "transaction_lambda = (\n",
    "    50\n",
    "    + 0.65 * business_tenure\n",
    "    + 8.5 * digital_adoption\n",
    "    - 2.4 * location_competitiveness\n",
    "    + np.random.normal(0, 18, N_SAMPLES)\n",
    ")\n",
    "transaction_lambda = clamp(transaction_lambda, 20, 900)\n",
    "transaction_count = np.random.poisson(transaction_lambda).astype(int)\n",
    "transaction_count = np.maximum(transaction_count, 5)\n",
    "\n",
    "# 4) Average order value (AOV) and monthly revenue\n",
    "aov = np.random.lognormal(mean=np.log(65000), sigma=0.45, size=N_SAMPLES)\n",
    "aov = clamp(aov, 12000, 450000)\n",
    "\n",
    "monthly_revenue = transaction_count * aov\n",
    "seasonality_noise = np.random.normal(1.0, 0.08, N_SAMPLES)\n",
    "monthly_revenue = monthly_revenue * seasonality_noise\n",
    "monthly_revenue = clamp(monthly_revenue, 1_500_000, 850_000_000)\n",
    "\n",
    "# 5) Peak hour latency category influenced by transaction pressure and digital adoption\n",
    "latency_score = (\n",
    "    0.0045 * transaction_count\n",
    "    - 0.28 * digital_adoption\n",
    "    + 0.09 * location_competitiveness\n",
    "    + np.random.normal(0, 0.9, N_SAMPLES)\n",
    ")\n",
    "\n",
    "peak_hour_latency = np.where(\n",
    "    latency_score < 0.0,\n",
    "    \"Low\",\n",
    "    np.where(latency_score < 1.3, \"Med\", \"High\")\n",
    ")\n",
    "\n",
    "# 6) Burn rate ratio (expense/revenue)\n",
    "latency_penalty = np.select(\n",
    "    [peak_hour_latency == \"Low\", peak_hour_latency == \"Med\", peak_hour_latency == \"High\"],\n",
    "    [0.0, 0.10, 0.22],\n",
    "    default=0.10,\n",
    ")\n",
    "\n",
    "burn_rate_ratio = (\n",
    "    0.80\n",
    "    + 0.015 * location_competitiveness\n",
    "    - 0.014 * digital_adoption\n",
    "    + latency_penalty\n",
    "    + np.random.normal(0, 0.10, N_SAMPLES)\n",
    ")\n",
    "burn_rate_ratio = clamp(burn_rate_ratio, 0.40, 1.55)\n",
    "\n",
    "# 7) Net profit margin (%), inverse relation with burn rate\n",
    "net_profit_margin = (\n",
    "    (1 - burn_rate_ratio) * 100\n",
    "    + 0.55 * (digital_adoption - 5)\n",
    "    - 0.18 * np.log1p(location_competitiveness)\n",
    "    + np.random.normal(0, 3.2, N_SAMPLES)\n",
    ")\n",
    "net_profit_margin = clamp(net_profit_margin, -35, 45)\n",
    "\n",
    "# 8) Repeat order rate (%), boosted by digital adoption and tenure\n",
    "repeat_order_rate = (\n",
    "    16\n",
    "    + 1.9 * digital_adoption\n",
    "    + 0.03 * business_tenure\n",
    "    - 0.6 * location_competitiveness\n",
    "    + np.random.normal(0, 7.0, N_SAMPLES)\n",
    ")\n",
    "repeat_order_rate = clamp(repeat_order_rate, 2, 90)\n",
    "\n",
    "# 9) Review volatility\n",
    "review_volatility = (\n",
    "    0.24\n",
    "    + 0.18 * (peak_hour_latency == \"Med\").astype(float)\n",
    "    + 0.34 * (peak_hour_latency == \"High\").astype(float)\n",
    "    + 0.06 * (burn_rate_ratio > 1.0).astype(float)\n",
    "    + np.random.normal(0, 0.09, N_SAMPLES)\n",
    ")\n",
    "review_volatility = clamp(review_volatility, 0.06, 1.30)\n",
    "\n",
    "# 10) Average historical rating (1-5)\n",
    "avg_historical_rating = (\n",
    "    3.95\n",
    "    + 0.08 * digital_adoption\n",
    "    + 0.016 * net_profit_margin\n",
    "    - 0.38 * review_volatility\n",
    "    - 0.12 * (peak_hour_latency == \"High\").astype(float)\n",
    "    + np.random.normal(0, 0.26, N_SAMPLES)\n",
    ")\n",
    "avg_historical_rating = clamp(avg_historical_rating, 1.0, 5.0)\n",
    "\n",
    "# 11) Review text generation coherent with rating/volatility/latency\n",
    "review_text = [\n",
    "    pick_review(rating=r, volatility=v, latency=l)\n",
    "    for r, v, l in zip(avg_historical_rating, review_volatility, peak_hour_latency)\n",
    "]\n",
    "\n",
    "# 12) Sentiment score derived from review text\n",
    "sentiment_scores = np.array([calculate_sentiment_score(text) for text in review_text])\n",
    "\n",
    "# Optional: post-adjustment for severe deficit businesses\n",
    "deficit_mask = burn_rate_ratio > 1.25\n",
    "avg_historical_rating[deficit_mask] = np.minimum(\n",
    "    avg_historical_rating[deficit_mask],\n",
    "    np.random.uniform(1.5, 3.5, deficit_mask.sum()),\n",
    ")\n",
    "repeat_order_rate[deficit_mask] = np.minimum(\n",
    "    repeat_order_rate[deficit_mask],\n",
    "    np.random.uniform(3, 30, deficit_mask.sum()),\n",
    ")\n",
    "\n",
    "# 13) Target Class with percentile-based thresholds (balanced by design)\n",
    "target_class = np.full(N_SAMPLES, \"Growth\", dtype=object)\n",
    "\n",
    "elite_mask = (\n",
    "    (net_profit_margin > np.percentile(net_profit_margin, 70))\n",
    "    & (burn_rate_ratio < np.percentile(burn_rate_ratio, 25))\n",
    "    & (repeat_order_rate > np.percentile(repeat_order_rate, 70))\n",
    "    & (avg_historical_rating > np.percentile(avg_historical_rating, 75))\n",
    ")\n",
    "\n",
    "critical_mask = (\n",
    "    (burn_rate_ratio > np.percentile(burn_rate_ratio, 92))\n",
    "    | ((business_tenure < 7) & (location_competitiveness >= 12))\n",
    "    | ((net_profit_margin < np.percentile(net_profit_margin, 5)) & (avg_historical_rating < 3.0))\n",
    ")\n",
    "\n",
    "struggling_mask = (\n",
    "    ((net_profit_margin < np.percentile(net_profit_margin, 35)) & (burn_rate_ratio > np.percentile(burn_rate_ratio, 60)))\n",
    "    | ((peak_hour_latency == \"High\") & (avg_historical_rating < np.percentile(avg_historical_rating, 40)))\n",
    "    | ((burn_rate_ratio > np.percentile(burn_rate_ratio, 75)) & (avg_historical_rating < np.percentile(avg_historical_rating, 65)))\n",
    ")\n",
    "\n",
    "target_class[elite_mask] = \"Elite\"\n",
    "target_class[struggling_mask] = \"Struggling\"\n",
    "target_class[critical_mask] = \"Critical\"\n",
    "\n",
    "# Final DataFrame (class at the rightmost position)\n",
    "df = pd.DataFrame(\n",
    "    {\n",
    "        \"ID\": np.arange(1, N_SAMPLES + 1),\n",
    "        \"Monthly_Revenue\": np.round(monthly_revenue, 0).astype(int),\n",
    "        \"Net_Profit_Margin (%)\": np.round(net_profit_margin, 2),\n",
    "        \"Burn_Rate_Ratio\": np.round(burn_rate_ratio, 3),\n",
    "        \"Transaction_Count\": transaction_count.astype(int),\n",
    "        \"Avg_Historical_Rating\": np.round(avg_historical_rating, 2),\n",
    "        \"Review_Text\": review_text,\n",
    "        \"Review_Volatility\": np.round(review_volatility, 3),\n",
    "        \"Business_Tenure_Months\": business_tenure.astype(int),\n",
    "        \"Repeat_Order_Rate (%)\": np.round(repeat_order_rate, 2),\n",
    "        \"Digital_Adoption_Score\": np.round(digital_adoption, 2),\n",
    "        \"Peak_Hour_Latency\": peak_hour_latency,\n",
    "        \"Location_Competitiveness\": location_competitiveness.astype(int),\n",
    "        \"Sentiment_Score\": np.round(sentiment_scores, 3),\n",
    "        \"Class\": target_class,\n",
    "    }\n",
    ")\n",
    "\n",
    "# Save and preview\n",
    "df.to_csv(OUTPUT_CSV, index=False)\n",
    "\n",
    "print(f\"Generated {len(df)} rows -> {OUTPUT_CSV}\")\n",
    "print(\"\\nPreview:\")\n",
    "display(df.head(10))\n",
    "\n",
    "print(\"\\nSummary stats:\")\n",
    "display(df.describe(include=\"all\").transpose())\n",
    "\n",
    "print(\"\\nClass counts:\")\n",
    "print(df[\"Class\"].value_counts())"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}