library(readxl)
library(mlr3)
library(mlr3verse)
library(mlr3learners)
library(ggpubr)
## Loading required package: ggplot2
library(ggplot2)
library(data.table)
library(skimr)
##
## Attaching package: 'skimr'
## The following object is masked from 'package:mlr3':
##
## partition
library(readxl)
Level_Risiko_Investasi <- read_excel("~/Statistik ekonomi industri/Level_Risiko_Investasi.xlsx")
View(Level_Risiko_Investasi)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:data.table':
##
## between, first, last
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
Level_Risiko_Investasi$`Risk Level` <- as.factor(Level_Risiko_Investasi$`Risk Level`)
summary(Level_Risiko_Investasi)
## Country X1 X2 X3
## Length:100 Min. : 4.20 Min. : 434.5 Min. : 13.63
## Class :character 1st Qu.:15.93 1st Qu.: 4265.9 1st Qu.: 42.96
## Mode :character Median :18.58 Median : 11659.1 Median : 70.42
## Mean :18.97 Mean : 22641.6 Mean : 191.94
## 3rd Qu.:21.80 3rd Qu.: 34815.2 3rd Qu.: 130.63
## Max. :47.50 Max. :124340.4 Max. :6908.35
## NA's :12
## X4 X5 X6 X7
## Min. :-0.151 Min. :-0.8862 Min. :-5.135 Min. :-9.84530
## 1st Qu.: 0.869 1st Qu.: 0.4419 1st Qu.: 1.765 1st Qu.:-1.18720
## Median : 1.700 Median : 1.1402 Median : 2.984 Median : 0.07155
## Mean : 3.263 Mean : 1.2019 Mean : 3.076 Mean : 0.10804
## 3rd Qu.: 3.939 3rd Qu.: 1.9502 3rd Qu.: 4.305 3rd Qu.: 1.94108
## Max. :36.703 Max. : 4.4021 Max. :10.076 Max. : 6.07120
##
## X8 X9 X10 X11
## Min. : 34.82 Min. :-1955.72 Min. : 1.171 Min. : 0.3357
## 1st Qu.: 76.95 1st Qu.: -14.11 1st Qu.: 32.813 1st Qu.: 1.9250
## Median : 90.19 Median : 12.67 Median : 106.872 Median : 3.9000
## Mean : 99.94 Mean : -13.58 Mean : 582.318 Mean : 5.5346
## 3rd Qu.:113.39 3rd Qu.: 36.67 3rd Qu.: 366.370 3rd Qu.: 7.9500
## Max. :359.14 Max. : 456.49 Max. :14866.703 Max. :26.9780
## NA's :7 NA's :17
## X12 X13 X14 Risk Level
## Min. :12.67 Min. :10.95 Min. : 0.120 high:54
## 1st Qu.:20.79 1st Qu.:19.06 1st Qu.: 4.818 low :46
## Median :23.40 Median :24.28 Median : 6.800
## Mean :24.96 Mean :24.48 Mean : 8.441
## 3rd Qu.:28.38 3rd Qu.:29.36 3rd Qu.:10.500
## Max. :46.83 Max. :55.09 Max. :24.650
## NA's :11
A <- ggplot(Level_Risiko_Investasi, aes(x=X1, y= 'Risk_Level')) +
geom_boxplot()+
labs(x = "Capital adequacy ratio (%) average from last 5 years",
y = "Risk Level")
B <- ggplot(Level_Risiko_Investasi, aes(x=X2, y= 'Risk_Level')) +
geom_boxplot()+
labs(x = "GDP per capita (USD)",
y = "Risk Level")
C <- ggplot(Level_Risiko_Investasi, aes(x=X3, y= 'Risk_Level')) +
geom_boxplot()+
labs(x = "Gross External Debt (% of GDP) average from last 5 years",
y = "Risk Level")
D <- ggplot(Level_Risiko_Investasi, aes(x=X4, y= 'Risk_Level')) +
geom_boxplot()+
labs(x = "growth of consumer price (%) average from last 5 years",
y = "Risk Level")
E <- ggplot(Level_Risiko_Investasi, aes(x=X5, y= 'Risk_Level')) +
geom_boxplot()+
labs(x = "growth of population (%) average from last 5 years",
y = "Risk Level")
G <- ggplot(Level_Risiko_Investasi, aes(x=X6, y= 'Risk_Level')) +
geom_boxplot()+
labs(x = "growth of Real GDP (%) average from last 5 years",
y = "Risk Level")
H <- ggplot(Level_Risiko_Investasi, aes(x=X7, y= 'Risk_Level')) +
geom_boxplot()+
labs(x = "growth of Real GDP per cap. (%) average from last 5 years",
y = "Risk Level")
I <- ggplot(Level_Risiko_Investasi, aes(x=X8, y= 'Risk_Level')) +
geom_boxplot()+
labs(x = "Loan-deposit ratio (%) average from last 5 years",
y = "Risk Level")
J <- ggplot(Level_Risiko_Investasi, aes(x=X9, y= 'Risk_Level')) +
geom_boxplot()+
labs(x = "Net External Debt (% of GDP) average from last 5 years",
y = "Risk Level")
K <- ggplot(Level_Risiko_Investasi, aes(x=X10, y= 'Risk_Level')) +
geom_boxplot()+
labs(x = "Nominal GDP (USD bn)",
y = "Risk Level")
L <- ggplot(Level_Risiko_Investasi, aes(x=X11, y= 'Risk_Level')) +
geom_boxplot()+
labs(x = "Non-performing loans (% of gross loans) average from last 5 years",
y = "Risk Level")
M <- ggplot(Level_Risiko_Investasi, aes(x=X12, y= 'Risk_Level')) +
geom_boxplot()+
labs(x = "percentage of gross domestic investment to GDP (%) average from last 5 years",
y = "Risk Level")
N <- ggplot(Level_Risiko_Investasi, aes(x=X13, y= 'Risk_Level')) +
geom_boxplot()+
labs(x = "percentage of gross domestic saving to GDP (%) average from last 5 years",
y = "Risk Level")
O <- ggplot(Level_Risiko_Investasi, aes(x=X14, y= 'Risk_Level')) +
geom_boxplot()+
labs(x = "unemployment rate (% labour force) average from last 5 years",
y = "Risk Level")
ggarrange(A, B, C , D,
ncol = 2, nrow = 2)
## Warning: Removed 12 rows containing non-finite outside the scale range
## (`stat_boxplot()`).

ggarrange(E, G, H , I,
ncol = 2, nrow = 2)
## Warning: Removed 7 rows containing non-finite outside the scale range
## (`stat_boxplot()`).

ggarrange(J, K, L , M,
ncol = 2, nrow = 2)
## Warning: Removed 17 rows containing non-finite outside the scale range
## (`stat_boxplot()`).

ggarrange(J, K, L , M,
ncol = 2, nrow = 2)
## Warning: Removed 17 rows containing non-finite outside the scale range
## (`stat_boxplot()`).

library(mlr3)
colnames(Level_Risiko_Investasi)
## [1] "Country" "X1" "X2" "X3" "X4"
## [6] "X5" "X6" "X7" "X8" "X9"
## [11] "X10" "X11" "X12" "X13" "X14"
## [16] "Risk Level"
colnames(Level_Risiko_Investasi) <- make.names(colnames(Level_Risiko_Investasi))
task_investment = TaskClassif$new(id="investment",backend = Level_Risiko_Investasi, target = "Risk.Level", positive= "low")
#Impute missing variabel
task_investment$missings()
## Risk.Level Country X1 X10 X11 X12 X13
## 0 0 12 0 17 0 0
## X14 X2 X3 X4 X5 X6 X7
## 11 0 0 0 0 0 0
## X8 X9
## 7 0
library(mlr3pipelines)
imp_missind = po("missind")
imp_num = po("imputehist", affect_columns = selector_type("numeric"))
task_ext = imp_missind$train(list(task_investment))[[1]]
task_ext$data()
## Risk.Level missing_X1 missing_X11 missing_X14 missing_X8 Country
## <fctr> <fctr> <fctr> <fctr> <fctr> <char>
## 1: low present present present present AD
## 2: low present present present present AE
## 3: low present present missing present AE-AZ
## 4: low missing missing missing present AE-RK
## 5: high present present present present AM
## 6: high missing present present present AO
## 7: high present present present missing AR
## 8: low present present present present AT
## 9: low present present present present AU
## 10: high present present present present AW
## 11: high present missing present present AZ
## 12: high present present present present BD
## 13: low present missing present present BE
## 14: low present present present present BG
## 15: high present missing present missing BH
## 16: high present present present present BJ
## 17: high present missing present present BO
## 18: high present missing present present BR
## 19: high missing present present present BY
## 20: low present present present present CA
## 21: high present present missing present CG
## 22: low present present present present CH
## 23: high missing present present present CI
## 24: low present present present present CL
## 25: high present present missing present CM
## 26: low present present present present CN
## 27: high present present present present CO
## 28: high present present present present CR
## 29: high present present present present CV
## 30: high present missing present present CY
## 31: low present present present present CZ
## 32: low present missing present present DE
## 33: low present present present present DK
## 34: high present present present present DO
## 35: high present missing present present EC
## 36: low present present present present EE
## 37: high present present present present EG
## 38: low present present present present ES
## 39: high missing present present missing ET
## 40: low present present present present FI
## 41: low present present present present FR
## 42: high missing present present present GA
## 43: low present present present present GB
## 44: high present present present present GE
## 45: high present present missing present GH
## 46: high present present present present GR
## 47: high present present present present GT
## 48: low present present present present HK
## 49: high present present present present HR
## 50: low present present present present HU
## 51: low present present present present ID
## 52: low present present present present IE
## 53: low missing present present present IL
## 54: high present present present present IN
## 55: high missing missing present missing IQ
## 56: low present present present present IS
## 57: high present missing present present IT
## 58: high present present present present JM
## 59: high present present present present JO
## 60: low present present present present JP
## 61: high present present present present KE
## 62: low present present present present KR
## 63: low missing missing missing missing KW
## 64: low present present present present KZ
## 65: high present present present present LK
## 66: high present present present present LS
## 67: high present present missing missing LS
## 68: low present present present present LT
## 69: low present present present present LU
## 70: low present present present present LV
## 71: high present present present present MA
## 72: high present present present present MK
## 73: high missing present present present MN
## 74: low present present present present MO
## 75: low present present present present MT
## 76: high present present present present MV
## 77: high present present present present MX
## 78: low present present present present MY
## 79: high present present missing present MZ
## 80: high present present present present NA
## 81: high present present present present NG
## 82: high present present present present NI
## 83: low present missing present present NL
## 84: low present missing present present NO
## 85: low missing missing present present NZ
## 86: high present present missing present OM
## 87: high present present present present PA
## 88: low present present present present PE
## 89: low present present present present PH
## 90: high present present present present PK
## 91: low present present present present PL
## 92: low present present present present PT
## 93: high present present present present PY
## 94: low present present present present QA
## 95: high present present present present RO
## 96: high present present present present RS
## 97: low present missing present present RU
## 98: high present present missing present RW
## 99: low missing missing missing missing SA
## 100: high present present present present SC
## Risk.Level missing_X1 missing_X11 missing_X14 missing_X8 Country
task_ext = imp_num$train(list(task_investment))[[1]]
task_ext$data()
## Risk.Level Country X10 X12 X13 X2 X3
## <fctr> <char> <num> <num> <num> <num> <num>
## 1: low AD 2.857862 23.08410 26.94344 38674.6160 172.75400
## 2: low AE 352.910575 24.85976 32.47740 40105.1201 103.52280
## 3: low AE-AZ 199.928422 20.39940 31.03926 76037.9968 31.03626
## 4: low AE-RK 10.108892 21.69104 17.30888 27882.8286 24.78532
## 5: high AM 12.645460 19.40300 15.11172 4251.3977 89.61882
## 6: high AO 62.485865 31.12380 20.57210 2033.8999 57.05566
## 7: high AR 375.190755 16.71368 13.81918 9203.4287 43.25546
## 8: low AT 429.980978 24.78244 26.89982 53174.2385 159.39690
## 9: low AU 1359.132847 24.28828 22.49670 63972.3400 121.98890
## 10: high AW 2.383969 21.13634 24.49756 24642.7034 92.84624
## 11: high AZ 42.607177 23.63816 29.44668 5083.2568 43.35272
## 12: high BD 347.147671 32.70006 32.19390 2323.5586 19.74352
## 13: low BE 514.176961 24.55938 24.73148 49537.5785 256.72570
## 14: low BG 69.103768 20.46028 23.25440 11288.8489 70.29080
## 15: high BH 34.539229 31.14198 28.74462 22003.1172 214.20080
## 16: high BJ 15.355253 23.40036 19.12786 1420.6492 49.56500
## 17: high BO 37.238307 20.84156 16.34698 3372.3576 32.27932
## 18: high BR 1444.733210 15.49512 13.50872 7372.9153 35.67380
## 19: high BY 60.258857 28.15432 18.39389 6453.9238 69.54962
## 20: low CA 1721.506090 23.26748 20.61472 51704.8992 117.76010
## 21: high CG 9.707663 46.82746 35.13040 2378.0444 70.34826
## 22: low CH 749.017673 24.41888 32.83370 89770.8521 275.61690
## 23: high CI 61.348608 20.82476 19.42264 2594.7038 35.68100
## 24: low CL 252.940034 22.48684 20.37026 15986.3031 65.82414
## 25: high CM 40.349134 28.82414 25.75278 1690.8639 39.74812
## 26: low CN 14866.703370 43.17774 44.69396 12226.6610 13.63044
## 27: high CO 271.346897 22.22970 18.09570 5859.6535 47.58910
## 28: high CR 61.520675 17.93502 15.88014 11954.5890 44.98044
## 29: high CV 1.703701 35.67148 32.54966 3466.2500 115.31060
## 30: high CY 23.804052 17.90342 14.38300 30630.2905 1026.49500
## 31: low CZ 243.530380 27.97028 30.60572 27044.7929 79.21186
## 32: low DE 3793.593164 20.71144 28.03106 50891.5812 165.29300
## 33: low DK 355.184032 22.06322 29.24874 67565.6556 155.84030
## 34: high DO 79.001191 23.77748 23.65308 8172.2496 42.49502
## 35: high EC 98.808010 26.15664 26.23654 5830.4242 49.66284
## 36: low EE 30.960228 26.20832 28.47148 26427.0455 84.20358
## 37: high EG 361.845786 15.78406 11.70278 3756.4221 31.92960
## 38: low ES 1278.325953 19.68004 22.06638 30488.0476 176.49180
## 39: high ET 107.795527 39.33340 31.44122 891.6737 33.04222
## 40: low FI 270.625631 23.67910 22.42012 53937.2819 257.89490
## 41: low FR 2609.943503 23.40664 22.34918 44939.9046 247.44200
## 42: high GA 15.062255 32.40134 32.38396 7803.8309 39.13694
## 43: low GB 2707.744043 17.99490 14.01296 46723.9041 406.04150
## 44: high GE 15.891616 27.43172 19.16908 4422.7082 104.45110
## 45: high GH 67.471195 26.24074 23.15904 2353.8541 59.62672
## 46: high GR 188.985393 12.66678 10.94992 19404.1830 239.31940
## 47: high GT 77.604632 14.07878 15.21612 4478.2807 34.07538
## 48: low HK 349.444713 21.19750 24.59920 50214.6484 446.31540
## 49: high HR 56.170837 21.94236 25.00206 16617.8744 89.53644
## 50: low HU 155.013041 24.36458 27.06952 18224.0904 115.04970
## 51: low ID 1062.299663 33.99662 32.80276 4223.4646 35.44648
## 52: low IE 417.683180 34.89774 43.30982 91715.2029 815.34610
## 53: low IL 403.526464 21.12638 24.84940 50813.0432 26.75248
## 54: high IN 2660.261329 31.20112 30.23156 2218.5362 20.80796
## 55: high IQ 165.493038 19.14184 22.59400 4270.7893 37.55918
## 56: low IS 21.714538 20.96484 26.28896 66458.8741 108.86200
## 57: high IT 1880.708359 17.86622 20.23166 34641.2557 129.37690
## 58: high JM 13.812422 22.55048 21.29292 4938.6880 90.75014
## 59: high JO 43.697563 18.98000 11.38420 4433.1037 70.49410
## 60: low JP 5043.573440 25.31864 27.87758 40838.2838 75.76394
## 61: high KE 100.470001 17.13230 11.00750 2025.2907 52.90428
## 62: low KR 1631.134780 30.95906 36.10606 35337.0758 26.36510
## 63: low KW 105.949023 26.68898 32.14778 30276.8754 47.57912
## 64: low KZ 171.239891 26.82074 26.28400 10589.0517 56.21532
## 65: high LK 80.676726 29.69044 27.95642 3822.1732 59.36342
## 66: high LS 1.844513 28.89906 16.64574 1010.6177 61.18192
## 67: high LS 19.129116 33.45200 30.12460 2637.6890 85.47152
## 68: low LT 55.761983 19.48272 20.31900 22636.1217 78.06336
## 69: low LU 73.055370 18.38978 34.25134 124340.3835 6908.35200
## 70: low LV 33.430044 22.67616 23.11992 19638.1070 134.37960
## 71: high MA 112.869983 32.29572 29.09784 3301.6090 45.30954
## 72: high MK 12.263700 32.41148 31.85910 6571.8228 72.20372
## 73: high MN 13.269000 32.50458 24.22642 4393.3037 218.85680
## 74: low MO 24.333081 19.61144 55.08932 52074.0604 194.62240
## 75: low MT 14.474956 22.98726 29.32880 31441.2784 761.28590
## 76: high MV 3.767023 20.09944 25.59820 8656.5566 35.18078
## 77: high MX 1073.915464 22.74344 21.51140 9729.2631 37.27282
## 78: low MY 336.664465 24.38356 27.92792 11363.6075 65.23842
## 79: high MZ 14.374968 42.66772 15.14566 434.4606 356.19670
## 80: high NA 10.710329 20.90098 13.32220 5051.3480 60.48620
## 81: high NG 401.028628 18.31216 18.87146 2149.7791 24.81464
## 82: high NI 12.621466 29.94454 26.86952 1986.7204 83.97706
## 83: low NL 910.005594 21.16826 30.30356 57230.6715 512.18330
## 84: low NO 362.571122 28.22544 32.62790 82858.2833 155.89490
## 85: low NZ 208.833638 23.66948 21.26348 48925.4692 103.06840
## 86: high OM 64.648375 26.17416 14.67168 14957.4883 88.59674
## 87: high PA 52.938074 41.14624 36.51452 13872.7952 156.66240
## 88: low PE 204.753978 21.80948 20.42292 6528.2061 35.38870
## 89: low PH 363.429119 24.97170 24.32906 3658.9600 32.33956
## 90: high PK 262.232162 16.10420 12.78448 1406.1297 29.25594
## 91: low PL 594.155788 20.15800 20.38070 17732.6481 67.90290
## 92: low PT 230.736935 17.22924 18.41932 25282.8171 203.15930
## 93: high PY 35.304238 21.36214 23.25368 5054.1153 43.10920
## 94: low QA 146.400549 42.35736 46.79924 55338.4835 108.79850
## 95: high RO 248.716040 23.69546 20.98926 14981.8900 52.57054
## 96: high RS 52.960139 20.81872 17.03374 8768.7320 86.54676
## 97: low RU 1471.003881 22.78718 27.47832 10274.3779 33.40582
## 98: high RW 10.332054 22.69110 11.11020 825.5581 52.98370
## 99: low SA 700.117867 29.55294 29.68834 21664.6362 48.19680
## 100: high SC 1.170879 34.72552 17.38966 13490.5158 109.22200
## Risk.Level Country X10 X12 X13 X2 X3
## X4 X5 X6 X7 X9 X1 X11
## <num> <num> <num> <num> <num> <num> <num>
## 1: 0.68000 1.2206 1.78560 -2.0843 -26.52000 17.50000 8.00000000
## 2: 1.76600 0.8698 2.65884 -0.7254 -13.59890 18.20000 8.15500000
## 3: 2.63056 1.4893 1.85034 -1.9008 -56.24160 18.70000 8.15500000
## 4: 1.29416 1.7530 2.23192 -1.1355 24.78532 26.44762 3.17053673
## 5: 1.44000 0.2562 4.74800 2.3318 47.27262 14.00000 6.60000000
## 6: 22.35646 3.3422 -0.87800 -5.2032 15.44938 23.45056 10.30000000
## 7: 36.70346 0.9657 -0.23680 -3.7297 -5.01348 23.25270 10.60000000
## 8: 1.52348 0.7259 1.88048 -0.3001 15.36980 18.57400 2.01900000
## 9: 1.65124 1.4790 2.44592 0.0306 57.95768 15.70000 0.96000000
## 10: 1.21694 0.7972 2.06486 -4.7211 28.09668 33.50000 5.00000000
## 11: 6.85276 1.0510 0.39070 -1.7366 -174.36800 25.30120 2.84329314
## 12: 5.81200 1.0568 7.39000 6.0712 4.91586 4.20000 7.70000000
## 13: 1.64000 0.5259 1.70044 -0.4905 -18.98450 19.31880 1.23844212
## 14: 0.77854 -0.7095 3.61996 2.7008 -12.95970 22.74060 5.79840000
## 15: 1.82200 4.4021 2.80902 -3.2531 -51.11920 20.00000 0.03617548
## 16: 0.22520 2.7684 4.87736 2.2133 20.59038 10.50000 17.00000000
## 17: 2.92384 1.4362 3.95132 -0.0467 -20.17800 12.28000 1.08377715
## 18: 5.72400 0.7789 -0.46082 -1.3423 10.01940 19.14000 16.62575693
## 19: 8.39000 0.0197 0.10000 0.6603 42.60472 16.41862 4.82920000
## 20: 1.67406 1.1918 1.79828 -0.5879 45.53354 16.09560 0.53330000
## 21: 2.03374 2.5889 -5.13500 -8.1338 54.86688 22.30000 24.40000000
## 22: 0.00116 0.8402 1.88522 0.1733 -152.44500 19.30000 0.75000000
## 23: 0.75212 2.5779 7.29640 3.3099 7.37624 19.23326 8.80000000
## 24: 2.97824 1.2484 1.97106 -0.8925 14.00910 14.28000 1.72290000
## 25: 1.54052 2.6442 4.35350 0.7177 26.04546 9.10000 20.00000000
## 26: 2.00000 0.4575 6.64354 5.2661 -26.98080 14.70450 1.83960000
## 27: 4.70940 1.3766 2.44972 -0.8876 9.92820 17.20000 3.18000000
## 28: 1.34600 0.9961 3.24766 0.7026 1.74676 13.28400 2.70000000
## 29: 0.37920 1.1636 3.92138 -0.4036 51.37952 19.42000 9.52000000
## 30: -0.15102 0.1535 4.62534 2.8078 456.48640 16.00000 17.78682712
## 31: 1.57500 0.2067 3.72134 1.3165 -16.61460 21.37960 2.65620000
## 32: 1.20768 0.4835 1.62892 -0.1226 -15.64810 18.58000 0.87814641
## 33: 0.54000 0.3613 2.68708 1.3106 -5.59082 22.60000 1.80000000
## 34: 2.22228 0.9213 6.05690 2.4036 20.97700 18.65000 1.85000000
## 35: 1.23328 1.7062 0.50846 -2.7675 8.90856 13.40000 9.18904943
## 36: 2.03974 0.2136 3.94866 2.6995 -13.26730 25.31200 0.37910000
## 37: 16.16054 2.0540 4.44796 2.2412 11.90716 20.10000 3.90000000
## 38: 0.71830 0.3949 2.84406 -0.4857 83.40662 16.98220 2.85120000
## 39: 10.37682 2.6572 9.06000 5.5428 27.57822 15.05297 11.10000000
## 40: 0.67100 0.2165 1.82644 0.9465 68.78926 20.10000 1.40000000
## 41: 0.99026 0.2532 1.63728 -0.4225 36.80590 19.65010 2.84150000
## 42: 2.80396 2.7047 2.25300 -1.5934 29.34950 22.46771 11.20000000
## 43: 1.53050 0.6090 1.70254 -1.3484 31.42504 21.60000 1.21570000
## 44: 3.93800 -0.0317 4.12018 2.3147 62.38444 17.60000 2.30000000
## 45: 12.94200 2.2431 5.29400 2.6949 47.67084 15.00000 15.00000000
## 46: 0.26994 -0.2217 0.75896 -0.5866 134.16510 16.66430 26.97800000
## 47: 3.74200 1.9677 3.40778 0.3178 2.81678 16.10000 1.83010000
## 48: 2.43600 0.8510 1.99164 -0.5657 -283.26700 20.70000 0.90240000
## 49: 0.55302 -0.7565 3.00696 1.6712 32.12062 25.50000 7.17760000
## 50: 1.84622 -0.2417 4.07978 2.5449 11.68846 18.28020 0.92500000
## 51: 3.94398 1.1454 5.03546 2.5001 9.73972 23.90000 3.06000000
## 52: 0.32334 1.1977 10.07624 4.5268 -345.29200 25.46920 3.54060000
## 53: 0.14240 1.6423 3.36048 0.7084 -47.40690 22.38967 1.47600000
## 54: 4.24752 1.0491 6.72450 2.6258 0.68776 13.60000 9.50000000
## 55: 0.44192 2.4876 3.80000 -1.3546 1.49128 12.18001 7.44451577
## 56: 0.41926 2.0438 4.63556 0.3121 28.71610 24.82000 2.90220000
## 57: 0.65218 -0.0396 0.98170 -0.8850 50.94154 16.00000 2.64983658
## 58: 3.60208 0.4806 1.18000 -1.4606 38.11946 14.30000 2.80000000
## 59: 1.37566 1.9443 2.02956 -0.6875 10.63962 17.93000 5.40000000
## 60: 0.51938 -0.1929 0.91240 -0.1394 -44.36040 17.30000 1.07340000
## 61: 6.28796 2.8000 5.62820 1.9242 39.30272 18.44440 14.13900000
## 62: 1.09614 0.3751 2.77248 1.6542 -26.86070 14.80000 1.00000000
## 63: 1.88400 1.9857 0.13772 -3.7375 -271.87800 19.80436 6.30448496
## 64: 7.95000 1.3350 3.00000 0.9054 -38.63250 26.97000 7.90000000
## 65: 4.21800 0.8755 3.67800 1.0805 46.95208 16.50000 5.30000000
## 66: 5.00340 0.7958 0.39388 -3.2384 12.39604 22.95200 4.19910000
## 67: 1.81194 1.5534 6.57820 3.6709 72.94226 11.00000 3.20000000
## 68: 1.69862 -0.8862 3.42028 3.7273 16.85362 21.80730 0.99150000
## 69: 1.17428 2.0218 3.22626 0.0792 -1955.72000 23.90000 1.02800000
## 70: 1.70144 -0.7032 3.13634 2.3134 22.27304 24.96800 3.52210000
## 71: 1.18800 1.2641 3.09514 -0.4997 15.76728 15.20000 8.35150000
## 72: 0.62200 0.0389 2.77890 1.0689 23.32864 16.69660 3.26130000
## 73: 4.98958 1.8006 4.25820 0.9093 180.83030 17.91980 11.67880000
## 74: 2.78282 1.2126 -1.66952 -9.8453 -213.14400 14.50000 0.33570000
## 75: 1.32032 3.1949 6.53774 -0.1381 -212.97000 23.96000 3.66290000
## 76: 0.88000 3.5095 6.30000 -3.6495 -0.57864 47.50000 8.30000000
## 77: 4.02524 1.1350 2.01104 -1.4444 8.52064 17.70000 2.42920000
## 78: 1.91000 1.3474 4.87800 1.3926 -16.25250 18.30000 1.66000000
## 79: 9.04260 2.9384 3.92880 -0.4276 282.81000 26.00000 11.80000000
## 80: 4.85712 1.8806 0.75446 -3.5756 19.01378 15.20000 6.40000000
## 81: 12.94034 2.6197 1.19458 -2.3145 -2.27422 15.40000 6.00000000
## 82: 4.34306 1.0414 1.37996 -1.0152 50.63570 21.75000 4.10000000
## 83: 1.17730 0.5927 2.21984 0.4875 12.94086 18.90260 7.79444227
## 84: 2.61900 0.8375 1.46654 0.1530 -35.66660 23.10000 0.86812773
## 85: 1.20152 2.0008 3.39204 0.0639 51.69554 16.27818 0.16207098
## 86: 0.76000 2.3197 1.99976 -2.3013 20.96404 19.10000 4.20000000
## 87: 0.42400 1.6872 4.58302 -1.8406 39.83066 16.25000 2.15000000
## 88: 2.69720 1.0511 3.17022 -0.7479 -20.74610 15.58880 4.12760000
## 89: 2.49528 1.4217 6.56308 1.9917 -12.25290 14.93960 1.67360000
## 90: 4.73824 1.8710 4.29018 1.5142 20.46164 17.20000 9.10000000
## 91: 0.80874 -0.0948 4.34840 3.1314 27.71838 20.14900 3.71230000
## 92: 0.83600 -0.3333 2.53122 0.9934 86.35888 16.70000 6.20000000
## 93: 3.52000 1.2931 2.96754 0.8830 9.42000 19.10000 4.90000000
## 94: 0.82252 2.3456 1.66590 -2.3610 1.28492 18.80000 2.00000000
## 95: 1.51808 -0.5878 4.71770 3.9390 18.74188 23.20000 4.05800000
## 96: 1.90000 -0.5088 3.17400 3.1268 38.24144 21.80000 5.00000000
## 97: 6.72076 0.1073 0.97740 0.6743 -30.73920 12.70000 3.53957990
## 98: 4.20636 2.6417 7.36908 2.2852 36.62538 23.30000 4.50000000
## 99: 0.76200 2.5009 1.56022 -2.5833 -62.91130 17.38485 9.89159727
## 100: 1.18702 1.0858 3.51306 -1.1137 31.39798 19.02000 3.87000000
## X4 X5 X6 X7 X9 X1 X11
## X14 X8
## <num> <num>
## 1: 3.0000000 55.00000
## 2: 2.4500000 102.52738
## 3: 4.0012729 102.52738
## 4: 6.1227110 102.52738
## 5: 18.5000000 166.80851
## 6: 10.5000000 34.81845
## 7: 11.0500000 86.72631
## 8: 6.0000000 116.41876
## 9: 5.4478000 191.74943
## 10: 8.0000000 80.54508
## 11: 7.0000000 110.63987
## 12: 5.0000000 78.40700
## 13: 6.0000000 90.42874
## 14: 5.3000000 72.99709
## 15: 4.0000000 99.28911
## 16: 2.3000000 81.54536
## 17: 8.5000000 101.29834
## 18: 13.9500000 76.95112
## 19: 4.5000000 149.03716
## 20: 7.4503000 106.86400
## 21: 0.4479229 84.09314
## 22: 3.1728000 82.50000
## 23: 12.0000000 83.29876
## 24: 10.0000000 116.51738
## 25: 21.3311380 87.68676
## 26: 4.9000000 94.22575
## 27: 13.0000000 117.32727
## 28: 15.0000000 125.26214
## 29: 15.8000000 67.45486
## 30: 7.8000000 68.15254
## 31: 3.4000000 76.50765
## 32: 4.8177000 138.35724
## 33: 5.4000000 359.13886
## 34: 5.7000000 80.10580
## 35: 7.2000000 99.71869
## 36: 6.4000000 104.68417
## 37: 7.0000000 53.29829
## 38: 16.1639000 117.48908
## 39: 18.0000000 133.94440
## 40: 7.8000000 175.16013
## 41: 9.3242000 139.57196
## 42: 19.0000000 72.26748
## 43: 5.5665000 91.33396
## 44: 20.0000000 145.18138
## 45: 8.0796108 50.13182
## 46: 18.3000000 89.84441
## 47: 4.0000000 72.98978
## 48: 6.5000000 68.82672
## 49: 7.5000000 82.18115
## 50: 4.4000000 79.03623
## 51: 6.5000000 96.57359
## 52: 6.5000000 84.42461
## 53: 4.5000000 85.93030
## 54: 7.5000000 73.69553
## 55: 13.5000000 97.04223
## 56: 7.8000000 160.95762
## 57: 10.8839000 111.19617
## 58: 8.5000000 88.86704
## 59: 22.0000000 93.88143
## 60: 2.7383000 70.95343
## 61: 11.4537000 87.40996
## 62: 4.0000000 123.99717
## 63: 16.6258051 77.76807
## 64: 5.1000000 83.52300
## 65: 5.0000000 89.13270
## 66: 24.6500000 59.50145
## 67: 6.5395818 103.57823
## 68: 9.0000000 68.23179
## 69: 6.8000000 42.65388
## 70: 8.1000000 77.92536
## 71: 11.5000000 102.28671
## 72: 16.3000000 94.67722
## 73: 7.3000000 77.34337
## 74: 2.4000000 81.91411
## 75: 4.3000000 67.94252
## 76: 6.5000000 78.58290
## 77: 4.0000000 99.03247
## 78: 4.0000000 113.38897
## 79: 20.3901327 49.29687
## 80: 23.0000000 91.29415
## 81: 22.0000000 64.18761
## 82: 4.5000000 84.09234
## 83: 4.6000000 161.74143
## 84: 4.2000000 207.31980
## 85: 4.8000000 138.38958
## 86: 5.4687202 148.12624
## 87: 12.0000000 121.21618
## 88: 9.7000000 116.71299
## 89: 8.5000000 74.25542
## 90: 6.5000000 61.34609
## 91: 6.2000000 93.36164
## 92: 7.1000000 113.24087
## 93: 5.5000000 104.13747
## 94: 0.1200000 163.71672
## 95: 5.0000000 74.41554
## 96: 9.7000000 90.19331
## 97: 5.4000000 122.72076
## 98: 2.6755697 111.94390
## 99: 7.3604209 133.56272
## 100: 4.5000000 45.41537
## X14 X8
task_ext = imp_num$train(list(task_investment))[[1]]
task_ext$data()
## Risk.Level Country X10 X12 X13 X2 X3
## <fctr> <char> <num> <num> <num> <num> <num>
## 1: low AD 2.857862 23.08410 26.94344 38674.6160 172.75400
## 2: low AE 352.910575 24.85976 32.47740 40105.1201 103.52280
## 3: low AE-AZ 199.928422 20.39940 31.03926 76037.9968 31.03626
## 4: low AE-RK 10.108892 21.69104 17.30888 27882.8286 24.78532
## 5: high AM 12.645460 19.40300 15.11172 4251.3977 89.61882
## 6: high AO 62.485865 31.12380 20.57210 2033.8999 57.05566
## 7: high AR 375.190755 16.71368 13.81918 9203.4287 43.25546
## 8: low AT 429.980978 24.78244 26.89982 53174.2385 159.39690
## 9: low AU 1359.132847 24.28828 22.49670 63972.3400 121.98890
## 10: high AW 2.383969 21.13634 24.49756 24642.7034 92.84624
## 11: high AZ 42.607177 23.63816 29.44668 5083.2568 43.35272
## 12: high BD 347.147671 32.70006 32.19390 2323.5586 19.74352
## 13: low BE 514.176961 24.55938 24.73148 49537.5785 256.72570
## 14: low BG 69.103768 20.46028 23.25440 11288.8489 70.29080
## 15: high BH 34.539229 31.14198 28.74462 22003.1172 214.20080
## 16: high BJ 15.355253 23.40036 19.12786 1420.6492 49.56500
## 17: high BO 37.238307 20.84156 16.34698 3372.3576 32.27932
## 18: high BR 1444.733210 15.49512 13.50872 7372.9153 35.67380
## 19: high BY 60.258857 28.15432 18.39389 6453.9238 69.54962
## 20: low CA 1721.506090 23.26748 20.61472 51704.8992 117.76010
## 21: high CG 9.707663 46.82746 35.13040 2378.0444 70.34826
## 22: low CH 749.017673 24.41888 32.83370 89770.8521 275.61690
## 23: high CI 61.348608 20.82476 19.42264 2594.7038 35.68100
## 24: low CL 252.940034 22.48684 20.37026 15986.3031 65.82414
## 25: high CM 40.349134 28.82414 25.75278 1690.8639 39.74812
## 26: low CN 14866.703370 43.17774 44.69396 12226.6610 13.63044
## 27: high CO 271.346897 22.22970 18.09570 5859.6535 47.58910
## 28: high CR 61.520675 17.93502 15.88014 11954.5890 44.98044
## 29: high CV 1.703701 35.67148 32.54966 3466.2500 115.31060
## 30: high CY 23.804052 17.90342 14.38300 30630.2905 1026.49500
## 31: low CZ 243.530380 27.97028 30.60572 27044.7929 79.21186
## 32: low DE 3793.593164 20.71144 28.03106 50891.5812 165.29300
## 33: low DK 355.184032 22.06322 29.24874 67565.6556 155.84030
## 34: high DO 79.001191 23.77748 23.65308 8172.2496 42.49502
## 35: high EC 98.808010 26.15664 26.23654 5830.4242 49.66284
## 36: low EE 30.960228 26.20832 28.47148 26427.0455 84.20358
## 37: high EG 361.845786 15.78406 11.70278 3756.4221 31.92960
## 38: low ES 1278.325953 19.68004 22.06638 30488.0476 176.49180
## 39: high ET 107.795527 39.33340 31.44122 891.6737 33.04222
## 40: low FI 270.625631 23.67910 22.42012 53937.2819 257.89490
## 41: low FR 2609.943503 23.40664 22.34918 44939.9046 247.44200
## 42: high GA 15.062255 32.40134 32.38396 7803.8309 39.13694
## 43: low GB 2707.744043 17.99490 14.01296 46723.9041 406.04150
## 44: high GE 15.891616 27.43172 19.16908 4422.7082 104.45110
## 45: high GH 67.471195 26.24074 23.15904 2353.8541 59.62672
## 46: high GR 188.985393 12.66678 10.94992 19404.1830 239.31940
## 47: high GT 77.604632 14.07878 15.21612 4478.2807 34.07538
## 48: low HK 349.444713 21.19750 24.59920 50214.6484 446.31540
## 49: high HR 56.170837 21.94236 25.00206 16617.8744 89.53644
## 50: low HU 155.013041 24.36458 27.06952 18224.0904 115.04970
## 51: low ID 1062.299663 33.99662 32.80276 4223.4646 35.44648
## 52: low IE 417.683180 34.89774 43.30982 91715.2029 815.34610
## 53: low IL 403.526464 21.12638 24.84940 50813.0432 26.75248
## 54: high IN 2660.261329 31.20112 30.23156 2218.5362 20.80796
## 55: high IQ 165.493038 19.14184 22.59400 4270.7893 37.55918
## 56: low IS 21.714538 20.96484 26.28896 66458.8741 108.86200
## 57: high IT 1880.708359 17.86622 20.23166 34641.2557 129.37690
## 58: high JM 13.812422 22.55048 21.29292 4938.6880 90.75014
## 59: high JO 43.697563 18.98000 11.38420 4433.1037 70.49410
## 60: low JP 5043.573440 25.31864 27.87758 40838.2838 75.76394
## 61: high KE 100.470001 17.13230 11.00750 2025.2907 52.90428
## 62: low KR 1631.134780 30.95906 36.10606 35337.0758 26.36510
## 63: low KW 105.949023 26.68898 32.14778 30276.8754 47.57912
## 64: low KZ 171.239891 26.82074 26.28400 10589.0517 56.21532
## 65: high LK 80.676726 29.69044 27.95642 3822.1732 59.36342
## 66: high LS 1.844513 28.89906 16.64574 1010.6177 61.18192
## 67: high LS 19.129116 33.45200 30.12460 2637.6890 85.47152
## 68: low LT 55.761983 19.48272 20.31900 22636.1217 78.06336
## 69: low LU 73.055370 18.38978 34.25134 124340.3835 6908.35200
## 70: low LV 33.430044 22.67616 23.11992 19638.1070 134.37960
## 71: high MA 112.869983 32.29572 29.09784 3301.6090 45.30954
## 72: high MK 12.263700 32.41148 31.85910 6571.8228 72.20372
## 73: high MN 13.269000 32.50458 24.22642 4393.3037 218.85680
## 74: low MO 24.333081 19.61144 55.08932 52074.0604 194.62240
## 75: low MT 14.474956 22.98726 29.32880 31441.2784 761.28590
## 76: high MV 3.767023 20.09944 25.59820 8656.5566 35.18078
## 77: high MX 1073.915464 22.74344 21.51140 9729.2631 37.27282
## 78: low MY 336.664465 24.38356 27.92792 11363.6075 65.23842
## 79: high MZ 14.374968 42.66772 15.14566 434.4606 356.19670
## 80: high NA 10.710329 20.90098 13.32220 5051.3480 60.48620
## 81: high NG 401.028628 18.31216 18.87146 2149.7791 24.81464
## 82: high NI 12.621466 29.94454 26.86952 1986.7204 83.97706
## 83: low NL 910.005594 21.16826 30.30356 57230.6715 512.18330
## 84: low NO 362.571122 28.22544 32.62790 82858.2833 155.89490
## 85: low NZ 208.833638 23.66948 21.26348 48925.4692 103.06840
## 86: high OM 64.648375 26.17416 14.67168 14957.4883 88.59674
## 87: high PA 52.938074 41.14624 36.51452 13872.7952 156.66240
## 88: low PE 204.753978 21.80948 20.42292 6528.2061 35.38870
## 89: low PH 363.429119 24.97170 24.32906 3658.9600 32.33956
## 90: high PK 262.232162 16.10420 12.78448 1406.1297 29.25594
## 91: low PL 594.155788 20.15800 20.38070 17732.6481 67.90290
## 92: low PT 230.736935 17.22924 18.41932 25282.8171 203.15930
## 93: high PY 35.304238 21.36214 23.25368 5054.1153 43.10920
## 94: low QA 146.400549 42.35736 46.79924 55338.4835 108.79850
## 95: high RO 248.716040 23.69546 20.98926 14981.8900 52.57054
## 96: high RS 52.960139 20.81872 17.03374 8768.7320 86.54676
## 97: low RU 1471.003881 22.78718 27.47832 10274.3779 33.40582
## 98: high RW 10.332054 22.69110 11.11020 825.5581 52.98370
## 99: low SA 700.117867 29.55294 29.68834 21664.6362 48.19680
## 100: high SC 1.170879 34.72552 17.38966 13490.5158 109.22200
## Risk.Level Country X10 X12 X13 X2 X3
## X4 X5 X6 X7 X9 X1 X11
## <num> <num> <num> <num> <num> <num> <num>
## 1: 0.68000 1.2206 1.78560 -2.0843 -26.52000 17.50000 8.00000000
## 2: 1.76600 0.8698 2.65884 -0.7254 -13.59890 18.20000 8.15500000
## 3: 2.63056 1.4893 1.85034 -1.9008 -56.24160 18.70000 8.15500000
## 4: 1.29416 1.7530 2.23192 -1.1355 24.78532 11.88705 4.23290619
## 5: 1.44000 0.2562 4.74800 2.3318 47.27262 14.00000 6.60000000
## 6: 22.35646 3.3422 -0.87800 -5.2032 15.44938 17.82804 10.30000000
## 7: 36.70346 0.9657 -0.23680 -3.7297 -5.01348 23.25270 10.60000000
## 8: 1.52348 0.7259 1.88048 -0.3001 15.36980 18.57400 2.01900000
## 9: 1.65124 1.4790 2.44592 0.0306 57.95768 15.70000 0.96000000
## 10: 1.21694 0.7972 2.06486 -4.7211 28.09668 33.50000 5.00000000
## 11: 6.85276 1.0510 0.39070 -1.7366 -174.36800 25.30120 0.42086657
## 12: 5.81200 1.0568 7.39000 6.0712 4.91586 4.20000 7.70000000
## 13: 1.64000 0.5259 1.70044 -0.4905 -18.98450 19.31880 3.44357924
## 14: 0.77854 -0.7095 3.61996 2.7008 -12.95970 22.74060 5.79840000
## 15: 1.82200 4.4021 2.80902 -3.2531 -51.11920 20.00000 4.21202563
## 16: 0.22520 2.7684 4.87736 2.2133 20.59038 10.50000 17.00000000
## 17: 2.92384 1.4362 3.95132 -0.0467 -20.17800 12.28000 2.88724281
## 18: 5.72400 0.7789 -0.46082 -1.3423 10.01940 19.14000 5.86985900
## 19: 8.39000 0.0197 0.10000 0.6603 42.60472 11.80385 4.82920000
## 20: 1.67406 1.1918 1.79828 -0.5879 45.53354 16.09560 0.53330000
## 21: 2.03374 2.5889 -5.13500 -8.1338 54.86688 22.30000 24.40000000
## 22: 0.00116 0.8402 1.88522 0.1733 -152.44500 19.30000 0.75000000
## 23: 0.75212 2.5779 7.29640 3.3099 7.37624 25.66680 8.80000000
## 24: 2.97824 1.2484 1.97106 -0.8925 14.00910 14.28000 1.72290000
## 25: 1.54052 2.6442 4.35350 0.7177 26.04546 9.10000 20.00000000
## 26: 2.00000 0.4575 6.64354 5.2661 -26.98080 14.70450 1.83960000
## 27: 4.70940 1.3766 2.44972 -0.8876 9.92820 17.20000 3.18000000
## 28: 1.34600 0.9961 3.24766 0.7026 1.74676 13.28400 2.70000000
## 29: 0.37920 1.1636 3.92138 -0.4036 51.37952 19.42000 9.52000000
## 30: -0.15102 0.1535 4.62534 2.8078 456.48640 16.00000 4.60759820
## 31: 1.57500 0.2067 3.72134 1.3165 -16.61460 21.37960 2.65620000
## 32: 1.20768 0.4835 1.62892 -0.1226 -15.64810 18.58000 14.88900539
## 33: 0.54000 0.3613 2.68708 1.3106 -5.59082 22.60000 1.80000000
## 34: 2.22228 0.9213 6.05690 2.4036 20.97700 18.65000 1.85000000
## 35: 1.23328 1.7062 0.50846 -2.7675 8.90856 13.40000 3.16014707
## 36: 2.03974 0.2136 3.94866 2.6995 -13.26730 25.31200 0.37910000
## 37: 16.16054 2.0540 4.44796 2.2412 11.90716 20.10000 3.90000000
## 38: 0.71830 0.3949 2.84406 -0.4857 83.40662 16.98220 2.85120000
## 39: 10.37682 2.6572 9.06000 5.5428 27.57822 16.09167 11.10000000
## 40: 0.67100 0.2165 1.82644 0.9465 68.78926 20.10000 1.40000000
## 41: 0.99026 0.2532 1.63728 -0.4225 36.80590 19.65010 2.84150000
## 42: 2.80396 2.7047 2.25300 -1.5934 29.34950 22.36646 11.20000000
## 43: 1.53050 0.6090 1.70254 -1.3484 31.42504 21.60000 1.21570000
## 44: 3.93800 -0.0317 4.12018 2.3147 62.38444 17.60000 2.30000000
## 45: 12.94200 2.2431 5.29400 2.6949 47.67084 15.00000 15.00000000
## 46: 0.26994 -0.2217 0.75896 -0.5866 134.16510 16.66430 26.97800000
## 47: 3.74200 1.9677 3.40778 0.3178 2.81678 16.10000 1.83010000
## 48: 2.43600 0.8510 1.99164 -0.5657 -283.26700 20.70000 0.90240000
## 49: 0.55302 -0.7565 3.00696 1.6712 32.12062 25.50000 7.17760000
## 50: 1.84622 -0.2417 4.07978 2.5449 11.68846 18.28020 0.92500000
## 51: 3.94398 1.1454 5.03546 2.5001 9.73972 23.90000 3.06000000
## 52: 0.32334 1.1977 10.07624 4.5268 -345.29200 25.46920 3.54060000
## 53: 0.14240 1.6423 3.36048 0.7084 -47.40690 21.68356 1.47600000
## 54: 4.24752 1.0491 6.72450 2.6258 0.68776 13.60000 9.50000000
## 55: 0.44192 2.4876 3.80000 -1.3546 1.49128 21.36254 2.24129853
## 56: 0.41926 2.0438 4.63556 0.3121 28.71610 24.82000 2.90220000
## 57: 0.65218 -0.0396 0.98170 -0.8850 50.94154 16.00000 7.74724177
## 58: 3.60208 0.4806 1.18000 -1.4606 38.11946 14.30000 2.80000000
## 59: 1.37566 1.9443 2.02956 -0.6875 10.63962 17.93000 5.40000000
## 60: 0.51938 -0.1929 0.91240 -0.1394 -44.36040 17.30000 1.07340000
## 61: 6.28796 2.8000 5.62820 1.9242 39.30272 18.44440 14.13900000
## 62: 1.09614 0.3751 2.77248 1.6542 -26.86070 14.80000 1.00000000
## 63: 1.88400 1.9857 0.13772 -3.7375 -271.87800 22.90714 2.49856299
## 64: 7.95000 1.3350 3.00000 0.9054 -38.63250 26.97000 7.90000000
## 65: 4.21800 0.8755 3.67800 1.0805 46.95208 16.50000 5.30000000
## 66: 5.00340 0.7958 0.39388 -3.2384 12.39604 22.95200 4.19910000
## 67: 1.81194 1.5534 6.57820 3.6709 72.94226 11.00000 3.20000000
## 68: 1.69862 -0.8862 3.42028 3.7273 16.85362 21.80730 0.99150000
## 69: 1.17428 2.0218 3.22626 0.0792 -1955.72000 23.90000 1.02800000
## 70: 1.70144 -0.7032 3.13634 2.3134 22.27304 24.96800 3.52210000
## 71: 1.18800 1.2641 3.09514 -0.4997 15.76728 15.20000 8.35150000
## 72: 0.62200 0.0389 2.77890 1.0689 23.32864 16.69660 3.26130000
## 73: 4.98958 1.8006 4.25820 0.9093 180.83030 22.21156 11.67880000
## 74: 2.78282 1.2126 -1.66952 -9.8453 -213.14400 14.50000 0.33570000
## 75: 1.32032 3.1949 6.53774 -0.1381 -212.97000 23.96000 3.66290000
## 76: 0.88000 3.5095 6.30000 -3.6495 -0.57864 47.50000 8.30000000
## 77: 4.02524 1.1350 2.01104 -1.4444 8.52064 17.70000 2.42920000
## 78: 1.91000 1.3474 4.87800 1.3926 -16.25250 18.30000 1.66000000
## 79: 9.04260 2.9384 3.92880 -0.4276 282.81000 26.00000 11.80000000
## 80: 4.85712 1.8806 0.75446 -3.5756 19.01378 15.20000 6.40000000
## 81: 12.94034 2.6197 1.19458 -2.3145 -2.27422 15.40000 6.00000000
## 82: 4.34306 1.0414 1.37996 -1.0152 50.63570 21.75000 4.10000000
## 83: 1.17730 0.5927 2.21984 0.4875 12.94086 18.90260 0.07633647
## 84: 2.61900 0.8375 1.46654 0.1530 -35.66660 23.10000 13.37583971
## 85: 1.20152 2.0008 3.39204 0.0639 51.69554 20.41625 6.28961012
## 86: 0.76000 2.3197 1.99976 -2.3013 20.96404 19.10000 4.20000000
## 87: 0.42400 1.6872 4.58302 -1.8406 39.83066 16.25000 2.15000000
## 88: 2.69720 1.0511 3.17022 -0.7479 -20.74610 15.58880 4.12760000
## 89: 2.49528 1.4217 6.56308 1.9917 -12.25290 14.93960 1.67360000
## 90: 4.73824 1.8710 4.29018 1.5142 20.46164 17.20000 9.10000000
## 91: 0.80874 -0.0948 4.34840 3.1314 27.71838 20.14900 3.71230000
## 92: 0.83600 -0.3333 2.53122 0.9934 86.35888 16.70000 6.20000000
## 93: 3.52000 1.2931 2.96754 0.8830 9.42000 19.10000 4.90000000
## 94: 0.82252 2.3456 1.66590 -2.3610 1.28492 18.80000 2.00000000
## 95: 1.51808 -0.5878 4.71770 3.9390 18.74188 23.20000 4.05800000
## 96: 1.90000 -0.5088 3.17400 3.1268 38.24144 21.80000 5.00000000
## 97: 6.72076 0.1073 0.97740 0.6743 -30.73920 12.70000 8.95650140
## 98: 4.20636 2.6417 7.36908 2.2852 36.62538 23.30000 4.50000000
## 99: 0.76200 2.5009 1.56022 -2.5833 -62.91130 10.45472 3.18675839
## 100: 1.18702 1.0858 3.51306 -1.1137 31.39798 19.02000 3.87000000
## X4 X5 X6 X7 X9 X1 X11
## X14 X8
## <num> <num>
## 1: 3.0000000 55.00000
## 2: 2.4500000 102.52738
## 3: 8.3968305 102.52738
## 4: 1.8593272 102.52738
## 5: 18.5000000 166.80851
## 6: 10.5000000 34.81845
## 7: 11.0500000 79.21757
## 8: 6.0000000 116.41876
## 9: 5.4478000 191.74943
## 10: 8.0000000 80.54508
## 11: 7.0000000 110.63987
## 12: 5.0000000 78.40700
## 13: 6.0000000 90.42874
## 14: 5.3000000 72.99709
## 15: 4.0000000 54.23093
## 16: 2.3000000 81.54536
## 17: 8.5000000 101.29834
## 18: 13.9500000 76.95112
## 19: 4.5000000 149.03716
## 20: 7.4503000 106.86400
## 21: 7.6800593 84.09314
## 22: 3.1728000 82.50000
## 23: 12.0000000 83.29876
## 24: 10.0000000 116.51738
## 25: 3.8761446 87.68676
## 26: 4.9000000 94.22575
## 27: 13.0000000 117.32727
## 28: 15.0000000 125.26214
## 29: 15.8000000 67.45486
## 30: 7.8000000 68.15254
## 31: 3.4000000 76.50765
## 32: 4.8177000 138.35724
## 33: 5.4000000 359.13886
## 34: 5.7000000 80.10580
## 35: 7.2000000 99.71869
## 36: 6.4000000 104.68417
## 37: 7.0000000 53.29829
## 38: 16.1639000 117.48908
## 39: 18.0000000 87.60959
## 40: 7.8000000 175.16013
## 41: 9.3242000 139.57196
## 42: 19.0000000 72.26748
## 43: 5.5665000 91.33396
## 44: 20.0000000 145.18138
## 45: 9.7169530 50.13182
## 46: 18.3000000 89.84441
## 47: 4.0000000 72.98978
## 48: 6.5000000 68.82672
## 49: 7.5000000 82.18115
## 50: 4.4000000 79.03623
## 51: 6.5000000 96.57359
## 52: 6.5000000 84.42461
## 53: 4.5000000 85.93030
## 54: 7.5000000 73.69553
## 55: 13.5000000 124.71192
## 56: 7.8000000 160.95762
## 57: 10.8839000 111.19617
## 58: 8.5000000 88.86704
## 59: 22.0000000 93.88143
## 60: 2.7383000 70.95343
## 61: 11.4537000 87.40996
## 62: 4.0000000 123.99717
## 63: 19.2597711 42.82884
## 64: 5.1000000 83.52300
## 65: 5.0000000 89.13270
## 66: 24.6500000 59.50145
## 67: 14.3235600 51.99074
## 68: 9.0000000 68.23179
## 69: 6.8000000 42.65388
## 70: 8.1000000 77.92536
## 71: 11.5000000 102.28671
## 72: 16.3000000 94.67722
## 73: 7.3000000 77.34337
## 74: 2.4000000 81.91411
## 75: 4.3000000 67.94252
## 76: 6.5000000 78.58290
## 77: 4.0000000 99.03247
## 78: 4.0000000 113.38897
## 79: 5.8642572 49.29687
## 80: 23.0000000 91.29415
## 81: 22.0000000 64.18761
## 82: 4.5000000 84.09234
## 83: 4.6000000 161.74143
## 84: 4.2000000 207.31980
## 85: 4.8000000 138.38958
## 86: 0.6457195 148.12624
## 87: 12.0000000 121.21618
## 88: 9.7000000 116.71299
## 89: 8.5000000 74.25542
## 90: 6.5000000 61.34609
## 91: 6.2000000 93.36164
## 92: 7.1000000 113.24087
## 93: 5.5000000 104.13747
## 94: 0.1200000 163.71672
## 95: 5.0000000 74.41554
## 96: 9.7000000 90.19331
## 97: 5.4000000 122.72076
## 98: 7.8347525 111.94390
## 99: 4.3385839 67.91735
## 100: 4.5000000 45.41537
## X14 X8
learner_rf <- lrn("classif.ranger",predict_type="prob",importance="impurity")
#Split Data
set.seed(913)
resample_investment=rsmp("holdout", ratio = 0.8)
resample_investment$instantiate(task=task_ext)
#Intepretasi Model
learner_rf$train(task=task_ext)
learner_rf$model$variable.importance
## Country X10 X12 X13 X2 X3 X4
## 0.7449951 4.6366429 1.3090532 2.7031156 11.5505485 2.2187840 2.6916075
## X5 X6 X7 X9 X1 X11 X14
## 1.4943194 0.8241701 0.8898537 5.6952519 1.0527404 3.9962004 2.1976392
## X8
## 1.2733853
#dataframe
library(dplyr)
library(ggplot2)
importance <- data.frame(Predictors = names(learner_rf$model$variable.importance),
impurity = learner_rf$model$variable.importance)
rownames(importance) <- NULL
importance <- importance %>% arrange(desc(impurity))
#grafik
ggplot(importance,
aes(x=impurity,
y=reorder(Predictors,impurity))) +
geom_col(fill = "steelblue")+
geom_text(aes(label=round(impurity,2)),hjust=1.2)

set.seed(913)
train_test_investment_forest = resample(task = task_ext,learner = learner_rf,resampling = resample_investment,store_models = TRUE)
## INFO [09:22:29.738] [mlr3] Applying learner 'classif.ranger' on task 'investment' (iter 1/1)
#Hasil Prediksi
prediksi_test = as.data.table(train_test_investment_forest$prediction())
head(prediksi_test)
## row_ids truth response prob.low prob.high
## <int> <fctr> <fctr> <num> <num>
## 1: 4 low high 0.3954730 0.60452698
## 2: 8 low low 0.8799452 0.12005476
## 3: 13 low low 0.9316444 0.06835556
## 4: 23 high high 0.1503659 0.84963413
## 5: 26 low low 0.7265238 0.27347619
## 6: 28 high high 0.2064619 0.79353810
#Confusion Matrix
train_test_investment_forest$prediction()$confusion
## truth
## response low high
## low 10 0
## high 1 9
accforest <- train_test_investment_forest$aggregate(list(msr("classif.acc"),msr("classif.specificity"),msr("classif.sensitivity")))
accforest
## classif.acc classif.specificity classif.sensitivity
## 0.9500000 1.0000000 0.9090909
#PLOT ROC
library(ggplot2)
library(mlr3)
library(mlr3viz)
library(precrec)
autoplot(train_test_investment_forest$prediction(), type = "roc")
