{"id":1099,"date":"2020-07-27T08:14:49","date_gmt":"2020-07-27T01:14:49","guid":{"rendered":"http:\/\/www.miai.vn\/?p=1099"},"modified":"2020-07-27T08:14:49","modified_gmt":"2020-07-27T01:14:49","slug":"da-ds-trien-khai-mo-hinh-du-bao-don-gian-chuong-1-2","status":"publish","type":"post","link":"https:\/\/miai.vn\/?p=1099","title":{"rendered":"[DA-DS] Tri\u1ec3n khai m\u00f4 h\u00ecnh d\u1ef1 b\u00e1o \u0111\u01a1n gi\u1ea3n (Ch\u01b0\u01a1ng 1\/2)"},"content":{"rendered":"\n<p>Ch\u00e0o c\u00e1c member M\u00ec AI, h\u00f4m nay ch\u00fang ta s\u1ebd c\u00f9ng t\u00ecm hi\u1ec3u c\u00e1ch tri\u1ec3n khai  m\u00f4 h\u00ecnh d\u1ef1 b\u00e1o \u0111\u01a1n gi\u1ea3n b\u1eb1ng Python. Ch\u00fa \u00fd \u0111\u00e2y ho\u00e0n to\u00e0n l\u00e0 ghi ch\u00e9p trong th\u1ef1c t\u1ebf l\u00e0m vi\u1ec7c n\u00ean n\u1ebfu c\u00f3 g\u00ec sai, c\u00e1c cao th\u1ee7 g\u00f3p \u00fd gi\u00fap \u0111\u1ec3 ho\u00e0n thi\u1ec7n nh\u00e9.<\/p>\n\n\n\n<p>Trong b\u00e0i vi\u1ebft s\u1ed1 4 ch\u00fang ta s\u1ebd ti\u1ebfp c\u1eadn vi\u1ec7c tri\u1ec3n khai m\u1ed9t m\u00f4 h\u00ecnh d\u1ef1 b\u00e1o tuy\u1ebfn t\u00ednh Linear Regression. \u0110\u00e2y l\u00e0 m\u00f4 h\u00ecnh \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng nhi\u1ec1u, c\u00f3 t\u00ednh \u1ee9ng d\u1ee5ng cao. Tr\u01b0\u1edbc khi v\u00e0o b\u00e0i vi\u1ebft s\u1ed1 4, m\u00ecnh t\u00f3m t\u1eaft qua m\u1ed9t ch\u00fat v\u1ec1 c\u00e1c n\u1ed9i dung ch\u00fang ta \u0111\u00e3 \u0111i qua trong 3 b\u00e0i tr\u01b0\u1edbc \u0111\u00e2y:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/www.miai.vn\/2020\/05\/29\/nhap-mon-data-analysis-voi-python\/\">B\u00e0i 1: ch\u00fang ta l\u00e0m quen v\u1edbi Python, c\u00e0i \u0111\u1eb7t \u1ee9ng d\u1ee5ng<\/a><\/li><li><a href=\"https:\/\/www.miai.vn\/2020\/06\/08\/da-ds-2-cac-thao-tac-co-ban-voi-du-lieu-bang-thu-vien-pandas\/\">B\u00e0i 2: ch\u00fang ta l\u00e0m quen v\u1edbi th\u01b0 vi\u1ec7n Pandas<\/a> n\u01a1i g\u1ea7n nh\u01b0 ch\u00fang ta l\u00e0m \u0111\u01b0\u1ee3c m\u1ecdi thao t\u00e1c v\u1edbi d\u1eef li\u1ec7u nh\u01b0 th\u00eam m\u1edbi, s\u1eeda, x\u00f3a, d\u1eef li\u1ec7u. B\u01b0\u1edbc n\u00e0y r\u1ea5t quan tr\u1ecdng v\u00ec d\u1eef li\u1ec7u l\u00e0 c\u01a1 s\u1edf \u0111\u1ec3 l\u00e0m m\u1ecdi th\u1ee9.<\/li><li><a href=\"https:\/\/www.miai.vn\/2020\/06\/18\/da-ds-thu-lam-da-topic-1-phan-tich-du-lieu-giao-dich-ngan-hang-dien-tu\/\">B\u00e0i 3: ch\u00fang ta l\u00e0m quen v\u1edbi vi\u1ec7c bi\u1ec3u di\u1ec5n d\u1eef li\u1ec7u l\u00ean m\u00f4 h\u00ecnh b\u1eb1ng th\u01b0 vi\u1ec7n matplotlib<\/a><\/li><\/ul>\n\n\n\n<p>B\u00e2y gi\u1edd ch\u00fang ta b\u01b0\u1edbc sang b\u00e0i s\u1ed1 4 \u0111\u1ec3 tr\u1ea3i nghi\u1ec7m vi\u1ec7c x\u00e2y d\u1ef1ng m\u1ed9t m\u00f4 h\u00ecnh d\u1ef1 b\u00e1o tuy\u1ebfn t\u00ednh. \u0110\u1ea7u ti\u00ean ch\u00fang ta c\u00f9ng xem qua \u0111\u1ecbnh ngh\u0129a c\u1ee7a H\u1ed3i quy tuy\u1ebfn t\u00ednh xem n\u00f3 l\u00e0 g\u00ec?<\/p>\n\n\n\n<ins class=\"adsbygoogle\" style=\"display:block\" data-ad-client=\"ca-pub-5095883280136027\" data-ad-slot=\"7735063137\" data-ad-format=\"auto\" data-full-width-responsive=\"true\"><\/ins>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script>\n\n\n\n<p>Data c\u1ee7a b\u00e0i n\u00e0y c\u00e1c b\u1ea1n t\u1ea3i <strong><a href=\"https:\/\/www.mediafire.com\/file\/up7b1cm5iz73qb1\/file\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">t\u1ea1i \u0111\u00e2y<\/a><\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Ph\u1ea7n 1 &#8211; H\u1ed3i quy tuy\u1ebfn t\u00ednh l\u00e0 g\u00ec?<\/h2>\n\n\n\n<p>H\u1ed3i quy tuy\u1ebfn t\u00ednh l\u00e0 m\u1ed9t ph\u01b0\u01a1ng ph\u00e1p \u0111\u1ec3 <strong>d\u1ef1 \u0111o\u00e1n bi\u1ebfn ph\u1ee5 thu\u1ed9c&nbsp;(Y)&nbsp;<\/strong>d\u1ef1a tr\u00ean gi\u00e1 tr\u1ecb c\u1ee7a 1 ho\u1eb7c nhi\u1ec1u <strong>bi\u1ebfn \u0111\u1ed9c l\u1eadp&nbsp;(X)<\/strong>, th\u00f4ng qua h\u00e0m tuy\u1ebfn t\u00ednh (linear).<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" src=\"https:\/\/github.com\/thangnch\/photos\/blob\/master\/Anh\/z01.png?raw=true\" alt=\"h\u1ed3i quy tuy\u1ebfn t\u00ednh\"\/><\/figure><\/div>\n\n\n\n<p>\u0110\u01b0\u1ee3c bi\u1ec3u di\u1ec5n b\u1eb1ng bi\u1ec3u th\u1ee9c: <strong>Y = \u03b2\u2080 + \u03b2\u2081x + \u03b2\u2082x + \u2026 + \u03b2\u1d62x + \u0190<\/strong><\/p>\n\n\n\n<p>Trong \u0111\u00f3:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Y<\/strong>: l\u00e0 bi\u1ebfn ph\u1ee5 thu\u1ed9c ch\u1ecbu \u1ea3nh h\u01b0\u1edfng b\u1edfi X<\/li><li><strong>X:<\/strong> l\u00e0 bi\u1ebfn \u0111\u1ed9c l\u1eadp t\u00e1c \u0111\u1ed9ng l\u00ean bi\u1ebfn ph\u1ee5 thu\u1ed9c Y<\/li><li><strong>\u03b2\u2080 + \u03b2\u2081x + \u03b2\u2082x + \u2026 + \u03b2\u1d62x:<\/strong> L\u00e0 h\u00e0m h\u1ed3i quy nhi\u1ec1u bi\u1ebfn s\u1ed1, s\u1ed1 l\u01b0\u1ee3ng bi\u1ebfn X s\u1ebd ph\u1ee5 thu\u1ed9c v\u00e0o h\u00e0m h\u1ed3i quy ta x\u00e2y d\u1ef1ng<\/li><li><strong>\u03b2\u2080:<\/strong> l\u00e0 gi\u00e1 tr\u1ecb \u01b0\u1edbc l\u01b0\u1ee3ng c\u1ee7a Y khi X \u0111\u1ea1t gi\u00e1 tr\u1ecb = 0<\/li><li><strong>\u03b2\u1d62:<\/strong> th\u1ec3 hi\u1ec7n \u0111\u1ed9 d\u1ed1c c\u1ee7a \u0111\u01b0\u1eddng h\u1ed3i quy tuy\u1ebfn t\u00ednh, \u0111o m\u1ee9c \u0111\u1ed9 thay \u0111\u1ed5i c\u1ee7a Y khi X thay \u0111\u1ed5i 1 \u0111\u01a1n v\u1ecb.<\/li><li><strong>\u0190:<\/strong> l\u00e0 ph\u1ea7n d\u01b0, l\u00e0 sai s\u1ed1, do c\u00e1c y\u1ebfu t\u1ed1 kh\u00e1c kh\u00f4ng t\u00ednh to\u00e1n \u0111\u01b0\u1ee3c t\u00e1c \u0111\u1ed9ng l\u00ean gi\u00e1 tr\u1ecb c\u1ee7a Y<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Ph\u1ea7n 2 &#8211; C\u00e1c b\u01b0\u1edbc tri\u1ec3n khai m\u00f4 h\u00ecnh d\u1ef1 b\u00e1o<\/h2>\n\n\n\n<p>N\u00e0o b\u00e2y gi\u1edd ch\u00fang ta b\u1eaft \u0111\u1ea7u v\u00e0o l\u00e0m m\u00f4 h\u00ecnh, h\u00e3y xem qua c\u00e1c b\u01b0\u1edbc tri\u1ec3n khai m\u1ed9t m\u00f4 h\u00ecnh. V\u1edbi m\u00ecnh n\u00f3 g\u1ed3m c\u00f3 5 b\u01b0\u1edbc tri\u1ec3n khai k\u1ef9 thu\u1eadt nh\u01b0 sau:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/github.com\/thangnch\/photos\/blob\/master\/Anh\/z02.png?raw=true\" alt=\"x\u00e2y d\u1ef1ng m\u00f4 h\u00ecnh, m\u00f4 h\u00ecnh d\u1ef1 b\u00e1o\" width=\"580\" height=\"60\"\/><\/figure>\n\n\n\n<p>Trong Ch\u01b0\u01a1ng 1 n\u00e0y ch\u00fang ta c\u00f9ng xem m\u1ed9t s\u1ed1 c\u00e1c k\u1ef9 thu\u1eadt v\u1ec1 li\u00ean quan \u0111\u1ebfn l\u00e0m vi\u1ec7c v\u1edbi BI\u1ebeN \u0111\u1ec3 chu\u1ea9n b\u1ecb tr\u01b0\u1edbc khi x\u00e2y d\u1ef1ng m\u00f4 h\u00ecnh. \u0110\u00e2y l\u00e0 b\u01b0\u1edbc l\u00e0m vi\u1ec7c m\u1ea5t nhi\u1ec1u th\u1eddi gian nh\u1ea5t trong vi\u1ec7c x\u00e2y d\u1ef1ng m\u00f4 h\u00ecnh, chi\u1ebfm \u0111\u1ebfn 80% th\u1eddi l\u01b0\u1ee3ng th\u1ef1c hi\u1ec7n, l\u00fd do b\u1edfi v\u00ec ch\u1ea5t l\u01b0\u1ee3ng c\u1ee7a m\u00f4 h\u00ecnh ph\u1ee5 thu\u1ed9c r\u1ea5t nhi\u1ec1u v\u00e0o ch\u1ea5t l\u01b0\u1ee3ng c\u1ee7a d\u1eef li\u1ec7u \u0111\u1ea7u v\u00e0o, th\u00f4ng th\u01b0\u1eddng vi\u1ec7c n\u00e0y c\u00f3 th\u1ec3 ph\u1ea3i l\u00e0m \u0111i l\u00e0m l\u1ea1i nhi\u1ec1u l\u1ea7n.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Ph\u1ea7n 3 &#8211; Chu\u1ea9n b\u1ecb d\u1eef li\u1ec7u, bi\u1ebfn cho m\u00f4 h\u00ecnh d\u1ef1 b\u00e1o<\/h2>\n\n\n\n<p>Nh\u01b0 n\u1ed9i dung trong Bi\u1ec3u th\u1ee9c to\u00e1n h\u1ecdc b\u00ean tr\u00ean ch\u00fang ta c\u1ea7n x\u00e1c \u0111\u1ecbnh c\u00e1c bi\u1ebfn X, Y \u0111\u1ec3 x\u00e2y d\u1ef1ng m\u00f4 h\u00ecnh.<\/p>\n\n\n\n<p>Trong b\u00e0i v\u00ed d\u1ee5 n\u00e0y ch\u00fang ta c\u00f9ng th\u1eed ph\u00e2n t\u00edch t\u00e1c \u0111\u1ed9ng c\u1ee7a y\u1ebfu t\u1ed1 kinh t\u1ebf v\u0129 m\u00f4 l\u00ean v\u1ea5n \u0111\u1ec1 n\u1ee3 x\u1ea5u trong ng\u00e2n h\u00e0ng. File m\u1eabu d\u1eef li\u1ec7u \u0111\u1ec3 tri\u1ec3n khai m\u00f4 h\u00ecnh h\u00f4m nay m\u00ecnh s\u1eed d\u1ee5ng l\u00e0 file csv g\u1ed3m c\u00e1c bi\u1ebfn:<\/p>\n\n\n\n<ins class=\"adsbygoogle\" style=\"display:block\" data-ad-client=\"ca-pub-5095883280136027\" data-ad-slot=\"7735063137\" data-ad-format=\"auto\" data-full-width-responsive=\"true\"><\/ins>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script>\n\n\n\n<ul class=\"wp-block-list\" type=\"1\"><li><strong>Inflation<\/strong>: T\u1ef7 l\u1ec7 l\u1ea1m ph\u00e1t<\/li><li><strong>Lending Interest Rate<\/strong>: T\u1ef7 l\u1ec7 bi\u1ebfn \u0111\u1ed9ng l\u00e3i su\u1ea5t<\/li><li><strong>Unemployment<\/strong>: T\u1ef7 l\u1ec7 bi\u1ebfn \u0111\u1ed9ng th\u1ea5t nghi\u1ec7p<\/li><li><strong>GDP<\/strong>: T\u1ef7 l\u1ec7 bi\u1ebfn \u0111\u1ed9ng GPD<\/li><li><strong>NPL<\/strong>: T\u1ef7 l\u1ec7 n\u1ee3 x\u1ea5u c\u1ee7a Ng\u00e2n h\u00e0ng<\/li><\/ul>\n\n\n\n<p>Nh\u01b0 v\u1eady ch\u00fang ta c\u00f3 c\u00e1c bi\u1ebfn:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Bi\u1ebfn \u0111\u1ed9c l\u1eadp X l\u00e0 Inflation, Lending Interest Rate, Unemployment, GDP<\/li><li>Bi\u1ebfn ph\u1ee5 thu\u1ed9c Y l\u00e0 NPL<\/li><\/ul>\n\n\n\n<p>\u0110\u1ed9 d\u00e0i d\u1eef li\u1ec7u m\u00ecnh \u0111\u00e3 chu\u1ea9n b\u1ecb \u1edf \u0111\u00e2y l\u00e0 14 n\u0103m. D\u1eef li\u1ec7u \u0111\u01b0\u1ee3c chu\u1ea9n b\u1ecb theo t\u1eebng n\u0103m. Ngo\u00e0i ra m\u00ecnh c\u00f3 l\u01b0u \u00fd kh\u00f4ng ph\u1ea3i l\u00e0 v\u1ea5n \u0111\u1ec1 v\u1ec1 k\u1ef9 thu\u1eadt nh\u01b0ng \u0111i\u1ec1u n\u00e0y r\u1ea5t quan tr\u1ecdng trong vi\u1ec7c x\u00e2y d\u1ef1ng m\u00f4 h\u00ecnh \u0111\u00f3 l\u00e0 b\u1ea1n x\u00e1c \u0111\u1ecbnh \u0111\u01b0\u1ee3c ngu\u1ed3n d\u1eef li\u1ec7u thu th\u1eadp l\u00e0 ngu\u1ed3n d\u1eef li\u1ec7u \u0111\u00fang \u0111\u1eafn, tin c\u1eady.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Ph\u1ea7n 4 &#8211; Ki\u1ec3m tra v\u00e0 l\u1ef1a ch\u1ecdn bi\u1ebfn cho m\u00f4 h\u00ecnh d\u1ef1 b\u00e1o<\/h2>\n\n\n\n<p>M\u1ee5c ti\u00eau c\u00e1c bi\u1ebfn \u0111\u01b0\u1ee3c l\u1ef1a ch\u1ecdn v\u00e0 \u0111\u01b0a v\u00e0o m\u00f4 h\u00ecnh ph\u1ea3i \u0111\u00e1p \u1ee9ng c\u00e1c ti\u00eau chu\u1ea9n nh\u01b0 sau:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Bi\u1ebfn ph\u1ee5 thu\u1ed9c (Y) trong m\u00f4 h\u00ecnh ph\u1ea3i l\u00e0 bi\u1ebfn li\u00ean t\u1ee5c<\/li><li>C\u00f3 m\u1ed1i quan h\u1ec7 tuy\u1ebfn t\u00ednh gi\u1eefa bi\u1ebfn ph\u1ee5 thu\u1ed9c Y v\u1edbi c\u00e1c bi\u1ebfn \u0111\u1ed9c l\u1eadp X<\/li><li>D\u1eef li\u1ec7u kh\u00f4ng c\u00f3 ch\u1ee9a c\u00e1c \u0111i\u1ec3m d\u1ecb bi\u1ec7t\/ outliers<\/li><li>Kh\u00f4ng c\u00f3 s\u1ef1 \u0111a c\u1ed9ng tuy\u1ebfn gi\u1eefa c\u00e1c bi\u1ebfn \u0111\u1ed9c l\u1eadp X. \u0110i\u1ec1u \u0111\u00f3 c\u00f3 ngh\u0129a c\u00e1c bi\u1ebfn \u0111\u1ed9c l\u1eadp trong m\u00f4 h\u00ecnh kh\u00f4ng c\u00f3 s\u1ef1 t\u01b0\u01a1ng quan cao v\u1edbi nhau.<\/li><\/ul>\n\n\n\n<p>\u0110\u1ec3 ki\u1ec3m tra bi\u1ebfn c\u00f3 \u0111\u00e1p \u1ee9ng \u0111\u01b0\u1ee3c c\u00e1c m\u1ee5c ti\u00eau tr\u00ean, h\u00f4m nay ch\u00fang ta c\u00f9ng l\u00e0m quen v\u00e0 s\u1eed d\u1ee5ng m\u1ed9t s\u1ed1 k\u1ef9 thu\u1eadt nh\u01b0 sau:<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Th\u1ebf n\u00e0o l\u00e0 Bi\u1ebfn r\u1eddi r\u1ea1c v\u00e0 Bi\u1ebfn li\u00ean t\u1ee5c?<\/strong><\/h4>\n\n\n\n<p>Bi\u1ebfn li\u00ean t\u1ee5c (continuous variable) l\u00e0 bi\u1ebfn s\u1ed1 c\u00f3 th\u1ec3 nh\u1eadn b\u1ea5t k\u1ef3 gi\u00e1 tr\u1ecb n\u00e0o trong m\u1ed9t kho\u1ea3ng nh\u1ea5t \u0111\u1ecbnh. V\u00ed d\u1ee5 c\u00e1c bi\u1ebfn trong b\u00e0i t\u1eadp n\u00e0y \u0111\u1ec1u l\u00e0 bi\u1ebfn li\u00ean t\u1ee5c.<\/p>\n\n\n\n<p>Bi\u1ebfn r\u1eddi r\u1ea1c (discrete variable) l\u00e0 bi\u1ebfn s\u1ed1 ch\u1ec9 nh\u1eadn c\u00e1c gi\u00e1 tr\u1ecb nguy\u00ean. V\u00ed d\u1ee5 bi\u1ebfn tr\u00ecnh \u0111\u1ed9 h\u1ecdc v\u1ea5n th\u00ec ch\u1ec9 nh\u1eadn c\u00e1c gi\u00e1 tr\u1ecb \u0110\u1ea1i h\u1ecdc, ho\u1eb7c Trung c\u1ea5p,\u2026 ch\u1ee9 kh\u00f4ng c\u00f3 c\u00e1c gi\u00e1 tr\u1ecb gi\u1eefa c\u1ee7a \u0110\u1ea1i h\u1ecdc v\u00e0 Trung c\u1ea5p.<\/p>\n\n\n\n<p>Trong b\u00e0i t\u1eadp n\u00e0y bi\u1ebfn Y x\u00e1c \u0111\u1ecbnh t\u1ef7 l\u1ec7 n\u1ee3 x\u1ea5u l\u00e0 Bi\u1ebfn li\u00ean t\u1ee5c, n\u00f3 c\u00f3 th\u1ec3 nh\u1eadn b\u1ea5t c\u1ee9 gi\u00e1 tr\u1ecb n\u00e0o \u00e0 do \u0111\u00f3 n\u00f3 \u0111\u00e1p \u1ee9ng y\u00eau c\u1ea7u \u0111\u1ec3 l\u00e0m m\u00f4 h\u00ecnh.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>M\u1ed9t s\u1ed1 c\u00e1c k\u1ef9 thu\u1eadt \u0111\u1ec3 ki\u1ec3m tra d\u1eef li\u1ec7u th\u1ed1ng k\u00ea<\/strong><\/h4>\n\n\n\n<p>Trong b\u00e0i vi\u1ebft tr\u01b0\u1edbc m\u00ecnh \u0111\u00e3 \u0111\u01b0a ra m\u1ed9t s\u1ed1 k\u1ef9 thu\u1eadt trong Pandas, h\u1eefu hi\u1ec7u g\u1ed3m c\u00f3 d\u00f9ng k\u1ef9 thu\u1eadt Describe: th\u1ed1ng k\u00ea m\u00f4 t\u1ea3 chu\u1ed7i gi\u00e1 tr\u1ecb \u0111\u1ec3 ch\u00fang ta s\u1eed d\u1ee5ng ki\u1ec3m tra bi\u1ebfn v\u00e0 x\u1eed l\u00fd c\u00e1c bi\u1ebfn l\u1ed7i nh\u01b0 bi\u1ebfn b\u1ecb Null, d\u1eef li\u1ec7u phi l\u00fd. Trong b\u00e0i n\u00e0y ch\u00fang ta c\u00f9ng xem th\u00eam m\u1ed9t s\u1ed1 k\u1ef9 thu\u1eadt m\u1edbi li\u00ean quan \u0111\u1ebfn ki\u1ec3m \u0111\u1ecbnh bi\u1ebfn.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\"><strong>Boxplots<\/strong><\/h5>\n\n\n\n<p>Bi\u1ec3u \u0111\u1ed3 ph\u00e2n t\u00edch t\u1eebng bi\u1ebfn chia chu\u1ed7i d\u1eef li\u1ec7u c\u1ee7a bi\u1ebfn th\u00e0nh c\u00e1c kho\u1ea3ng ph\u1ea7n t\u01b0 (quartiles) t\u1eeb \u0111\u00f3 ph\u00e1t hi\u1ec7n xem ph\u00e2n ph\u1ed1i c\u1ee7a bi\u1ebfn c\u00f3 t\u1ed1t kh\u00f4ng, c\u0169ng nh\u01b0 xem \u0111\u01b0\u1ee3c c\u00e1c \u0111i\u1ec3m d\u1ecb bi\u1ec7t \u0111\u1ec3 x\u1eed l\u00fd. C\u0169ng nh\u01b0 k\u1ef9 thu\u1eadt th\u1ed1ng k\u00ea m\u00f4 t\u1ea3 \u1edf Describe, nh\u01b0ng Boxplots bi\u1ec3u di\u1ec5n m\u1ed7i chu\u1ed7i gi\u00e1 tr\u1ecb th\u00e0nh m\u1ed9t h\u00ecnh h\u1ed9p th\u1ec3 hi\u1ec7n 5 gi\u00e1 tr\u1ecb th\u1ed1ng k\u00ea c\u1ee7a chu\u1ed7i d\u1eef li\u1ec7u:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Gi\u00e1 tr\u1ecb b\u00e9 nh\u1ea5t Minimum tr\u00ean r\u00e2u whiskers<\/li><li>T\u1ee9 ph\u00e2n v\u1ecb th\u1ee9 nh\u1ea5t Q1 = \u0111i\u1ec3m ph\u00e2n v\u1ecb 25%<\/li><li>T\u1ee9 ph\u00e2n v\u1ecb th\u1ee9 hai = medians = \u0111i\u1ec3m ph\u00e2n v\u1ecb 50%<\/li><li>T\u1ee9 ph\u00e2n v\u1ecb th\u1ee9 ba Q3 = \u0111i\u1ec3m ph\u00e2n v\u1ecb 75%<\/li><li>Gi\u00e1 tr\u1ecb l\u1edbn nh\u1ea5t Maximum tr\u00ean r\u00e2u whiskers<\/li><li>IQR = Q3 \u2013 Q1 \u0111\u01b0\u1ee3c g\u1ecdi kho\u1ea3ng b\u00ean trong ph\u00e2n v\u1ecb. IQR s\u1ebd quy\u1ebft \u0111\u1ecbnh \u0111\u1ed9 d\u00e0i c\u1ee7a 2 r\u00e2u Min v\u00e0 Max do \u0111\u00f3 hai gi\u00e1 tr\u1ecb n\u00e0y kh\u00f4ng ph\u1ea3i \u1edbi gi\u00e1 tr\u1ecb Minimum ho\u1eb7c Maximum c\u1ee7a c\u1ea3 chu\u1ed7i gi\u00e1 tr\u1ecb. L\u00fd do ng\u01b0\u1eddi ta x\u00e1c \u0111\u1ecbnh hai ria ngo\u00e0i \u0111\u1ec3 \u0111\u00e1nh d\u1ea5u c\u00e1c \u0111i\u1ec3m n\u1eb1m ngo\u00e0i ria \u0111\u01b0\u1ee3c t\u00ednh l\u00e0 \u0111i\u1ec3m nghi ng\u1edd c\u00f3 d\u1ecb bi\u1ec7t outliers.<\/li><\/ul>\n\n\n\n<p>Bi\u1ec3u di\u1ec5n c\u1ee7a n\u00f3 nh\u01b0 sau:<\/p>\n\n\n\n<ins class=\"adsbygoogle\" style=\"display:block\" data-ad-client=\"ca-pub-5095883280136027\" data-ad-slot=\"7735063137\" data-ad-format=\"auto\" data-full-width-responsive=\"true\"><\/ins>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/github.com\/thangnch\/photos\/blob\/master\/Anh\/z03.png?raw=true\" alt=\"bi\u1ec3u \u0111\u1ed3 h\u1ed9p, m\u00f4 h\u00ecnh d\u1ef1 b\u00e1o\"\/><\/figure>\n\n\n\n<p>Source code th\u1ef1c hi\u1ec7n:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># LOAD D\u1eee LI\u1ec6U\ndf = pd.read_csv(path + '\\\\Economic_S5.csv')\n\n# 1. Ki\u1ec3m tra th\u00f4ng s\u1ed1 th\u1ed1ng k\u00ea c\u1ee7a m\u1ed7i bi\u1ebfn\nprint(\"--------------------------\")\nprint(df&#91;'Inflation'].describe())\nprint(\"--------------------------\")\nprint(df&#91;'Unemployment'].describe())\nprint(\"--------------------------\")\nprint(df&#91;'Lending_Interest_Rate'].describe())\nprint(\"--------------------------\")\nprint(df&#91;'GDP'].describe())\nprint(\"--------------------------\")\nprint(df&#91;'NPL'].describe())\nprint(\"--------------------------\")\n\n# 2. V\u1ebd ph\u00e2n ph\u1ed1i d\u1eef li\u1ec7u d\u1ea1ng box plots\n# T\u1ea1o DF m\u1edbi lo\u1ea1i b\u1ecf Bi\u1ebfn Year v\u00e0 NPL trong DF g\u1ed1c sau \u0111\u00f3 v\u1ebd c\u00e1c bi\u1ec3u \u0111\u1ed3 box v\u1edbi t\u1eebng bi\u1ebfn\ndf_box = df&#91;&#91;'Inflation', 'Lending_Interest_Rate', 'Unemployment', 'GDP']]\n\n# Ch\u1ea1y h\u00e0m boxplot \u0111\u1ec3 v\u1ebd bi\u1ec3u \u0111\u1ed3 Box v\u00e0 l\u1ea5y c\u00e1c gi\u00e1 tr\u1ecb c\u1ee7a box. H\u00e0m n\u00e0y tr\u1ea3 v\u1ec1 2 gi\u00e1 tr\u1ecb ax v\u00e0 bp.\n# \u00dd ngh\u0129a tham s\u1ed1 return type:\n# 1. \u2018axes\u2019 returns the matplotlib axes the boxplot is drawn on\n# 2. \u2018dict\u2019 returns a dictionary whose values are the matplotlib Lines of the boxplot.\n# 3. \u2018both\u2019 returns a namedtuple with the axes and dict.\nax, bp = pd.DataFrame.boxplot(df_box, return_type='both')\n\n# In d\u1eef li\u1ec7u c\u1ee7a box v\u00e0 vi\u1ebft gi\u00e1 tr\u1ecb c\u1ee7a c\u00e1c \u0111i\u1ec3m n\u00e0y v\u00e0o bi\u1ec3u \u0111\u1ed3 box\n# outliner: tr\u1ea3 v\u1ec1 m\u1ea3ng gi\u00e1 tr\u1ecb n\u1eb1m b\u00ean ngo\u00e0i. M\u1ea3ng ch\u01b0a m\u1ed7i gi\u00e1 tr\u1ecb c\u1ee7a chu\u1ed7i outliner\n# boxes: tr\u1ea3 v\u1ec1 m\u1ea3ng g\u1ed3m 5 gi\u00e1 tr\u1ecb c\u1ee7a box s\u1ebd n\u1ed1i th\u00e0nh h\u00ecnh box g\u1ed3m c\u1eadn tr\u00ean c\u1eadn d\u01b0\u1edbi box\n# medians: tr\u1ea3 v\u1ec1 m\u1ea3ng g\u1ed3m 2 gi\u00e1 tr\u1ecb n\u1ed1i 2 \u0111i\u1ec3m n\u1eb1m \u1edf gi\u1eefa \u0111\u01b0\u1eddng line m\u1ea7u xanh l\u00e1 c\u00e2y\n# whiskers: tr\u1ea3 v\u1ec1 2 m\u1ea3ng m\u1ed7i m\u1ea3ng g\u1ed3m 2 gi\u00e1 tr\u1ecb v\u1ebd t\u1eeb c\u1ea1nh box \u0111\u1ebfn ria 2 \u0111\u1ea7u\noutliers = &#91;flier.get_ydata() for flier in bp&#91;\"fliers\"]]\nboxes = &#91;box.get_ydata() for box in bp&#91;\"boxes\"]]\nmedians = &#91;median.get_ydata() for median in bp&#91;\"medians\"]]\nwhiskers = &#91;whiskers.get_ydata() for whiskers in bp&#91;\"whiskers\"]]\nprint(\"outliers:\")\nprint(outliers)\nfor i in range(4):\n    for j in range(len(outliers&#91;i])):\n        ax.text(i+1, outliers&#91;i]&#91;j], \"{:.4f}\".format(outliers&#91;i]&#91;j]))\nprint(\"boxes:\")\nprint(boxes)\npad = 0.2\nfor i in range(4):\n    ax.text(i+1+pad, boxes&#91;i]&#91;1], \"{:.4f}\".format(boxes&#91;i]&#91;1]))\n    ax.text(i+1+pad, boxes&#91;i]&#91;2], \"{:.4f}\".format(boxes&#91;i]&#91;2]))\nprint(\"medians:\")\nprint(medians)\n#print(medians&#91;0]&#91;0], medians&#91;0]&#91;1])\nfor i in range(4):\n    ax.text(i+1, medians&#91;i]&#91;0], \"{:.2f}\".format(medians&#91;i]&#91;0]))\nprint(\"whiskers:\")\nprint(whiskers)\nfor i in range(4): #&#91;0,3]\n    for j in range(2): #&#91;0,1]\n        ax.text(i + 1, whiskers&#91;i*2+j]&#91;1], \"{:.2f}\".format(whiskers&#91;i*2+j]&#91;1]))\n    # ax.text(i + 1, whiskers&#91;i]&#91;1], \"{:.2f}\".format(whiskers&#91;i]&#91;1]))\n\nplt.show()\n<\/code><\/pre>\n\n\n\n<p>K\u1ebft qu\u1ea3 thu \u0111\u01b0\u1ee3c:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/github.com\/thangnch\/photos\/blob\/master\/Anh\/z04.png?raw=true\" alt=\"m\u00f4 h\u00ecnh d\u1ef1 b\u00e1o\"\/><figcaption>m\u00f4 h\u00ecnh d\u1ef1 b\u00e1o<\/figcaption><\/figure>\n\n\n\n<ins class=\"adsbygoogle\" style=\"display:block\" data-ad-client=\"ca-pub-5095883280136027\" data-ad-slot=\"7735063137\" data-ad-format=\"auto\" data-full-width-responsive=\"true\"><\/ins>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script>\n\n\n\n<p><strong><u>K\u1ebft lu\u1eadn:<\/u><\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>C\u00f3 th\u1ec3 s\u1eed d\u1ee5ng bi\u1ec3u \u0111\u1ed3 box n\u00e0y \u0111\u1ec3 ph\u00e2n t\u00edch d\u1eef li\u1ec7u bi\u1ebfn, x\u00e1c \u0111\u1ecbnh c\u00e1c c\u00f3 ch\u1ee9a c\u00e1c \u0111i\u1ec3m d\u1ecb bi\u1ec7t\/ outliers hay kh\u00f4ng<\/li><li>Bi\u1ec3u \u0111\u1ed3 c\u0169ng th\u1ec3 hi\u1ec7n \u0111\u01b0\u1ee3c h\u00ecnh th\u00e1i ph\u00e2n ph\u1ed1i d\u1eef li\u1ec7u.Trong tr\u01b0\u1eddng h\u1ee3p v\u00ed d\u1ee5 tr\u00ean ta th\u1ea5y bi\u1ebfn \u0111\u1ed9c l\u1eadp X \u2013 Inflation v\u00e0 GDP c\u00f3 gi\u00e1 tr\u1ecb d\u1ecb bi\u1ec7t, ngo\u1ea1i tr\u1eeb \u0111i\u1ec3m d\u1ecb bi\u1ec7t th\u00ec bi\u1ebfn GDP c\u0169ng c\u00f3 ph\u00e2n ph\u1ed1i c\u00e2n \u0111\u1ed1i<\/li><\/ul>\n\n\n\n<h5 class=\"wp-block-heading\"><strong><strong>Quantiles<\/strong><\/strong><\/h5>\n\n\n\n<p>Ngo\u00e0i c\u00e1ch v\u1ebd bi\u1ec3u \u0111\u1ed3 Box b\u00ean tr\u00ean, b\u1ea1n c\u0169ng c\u00f3 th\u1ec3 in c\u00e1c gi\u00e1 tr\u1ecb ph\u00e2n ph\u1ed1i t\u1ea1i t\u1eebng qu\u00e3ng d\u1eef li\u1ec7u \u0111\u1ec3 ph\u00e2n t\u00edch:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># In quantiles theo c\u00e1c qu\u00e3ng 1%, 25%, 50%, 75%, 99%\nquantiles = df_box.quantile(&#91;0.01, 0.25, 0.5, 0.75, 0.99])\nprint(quantiles)<\/code><\/pre>\n\n\n\n<p>M\u1eabu k\u1ebft qu\u1ea3 xu\u1ea5t ra t\u1eeb \u0111o\u1ea1n l\u1ec7nh:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" src=\"https:\/\/github.com\/thangnch\/photos\/blob\/master\/Anh\/z05.png?raw=true\" alt=\"quantiles\"\/><\/figure><\/div>\n\n\n\n<h5 class=\"wp-block-heading\"><strong>Histogram<\/strong><\/h5>\n\n\n\n<p>Histogram l\u00e0 m\u1ed9t d\u1ea1ng \u0111\u1ed3 th\u1ecb cho ph\u00e9p b\u1ea1n kh\u00e1m ph\u00e1, hi\u1ec3n th\u1ecb d\u1ea1ng ph\u00e2n ph\u1ed1i t\u1ea7n su\u1ea5t c\u1ee7a m\u1ed9t t\u1eadp d\u1eef li\u1ec7u li\u00ean t\u1ee5c. N\u00f3 cho ph\u00e9p ch\u00fang ta ki\u1ec3m tra d\u1ea1ng ph\u00e2n ph\u1ed1i (ch\u1eb3ng h\u1ea1n, ph\u00e2n ph\u1ed1i chu\u1ea9n), \u0111i\u1ec3m d\u1ecb bi\u1ec7t, \u0111\u1ed9 tr\u00f4i, \u0111\u1ed9 nh\u1ecdn c\u1ee7a t\u1eadp d\u1eef li\u1ec7u. M\u1ed9t \u0111\u1ed3 th\u1ecb d\u1ea1ng histogram c\u1ee7a m\u1ed9t t\u1eadp d\u1eef li\u1ec7u c\u00f3 d\u1ea1ng nh\u01b0 h\u00ecnh sau. Trong \u0111\u00f3 bi\u1ec3u \u0111\u1ed3 h\u00ecnh chu\u00f4ng (Bell curve) th\u1ec3 hi\u1ec7n chu\u1ed7i d\u1eef li\u1ec7u \u0111\u1ea1t \u0111\u01b0\u1ee3c ph\u00e2n ph\u1ed1i chu\u1ea9n:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/github.com\/thangnch\/photos\/blob\/master\/Anh\/z06.png?raw=true\" alt=\"histogram\"\/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>S\u1ed1 Skewness: \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 \u0111o l\u01b0\u1eddng \u0111\u1ed9 l\u1ec7ch c\u1ee7a ph\u00e2n ph\u1ed1i v\u1ec1 1 trong 2 ph\u00eda. Gi\u00e1 tr\u1ecb +: l\u1ec7ch ph\u1ea3i, &#8211; l\u1ec7ch tr\u00e1i. Gi\u00e1 tr\u1ecb skewness c\u00e0ng l\u1edbn th\u00ec \u0111\u1ed9 l\u1ec7ch c\u00e0ng l\u1edbn<\/li><li>S\u1ed1 Kurtorsis: \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 \u0111o l\u01b0\u1eddng \u0111\u1ed9 nh\u1ecdn hay b\u1eb9t c\u1ee7a ph\u00e2n ph\u1ed1i. Ph\u00e2n ph\u1ed1i&nbsp;<strong>chu\u1ea9n<\/strong>&nbsp;c\u00f3 kurtosis 3.0, hay&nbsp;<strong>zero excess kurtosis<\/strong><\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/github.com\/thangnch\/photos\/blob\/master\/Anh\/z07.png?raw=true\" alt=\"kurtosis. m\u00f4 h\u00ecnh d\u1ef1 b\u00e1o\"\/><\/figure>\n\n\n\n<p>M\u1eabu source code:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># 3. V\u1ebd ph\u00e2n ph\u1ed1i d\u1eef li\u1ec7u d\u1ea1ng historical, \n# H\u00e0m c\u1ee7a Python m\u1eb7c \u0111\u1ecbnh chia d\u1eef li\u1ec7u th\u00e0nh 10 bin, \n# mu\u1ed1n thay \u0111\u1ed5i c\u00f3 th\u1ec3 \u0111i\u1ec1u ch\u1ec9nh gi\u00e1 tr\u1ecb bin\ndf_hist = df&#91;&#91;'GDP']]\nhist = df_hist.hist(bins=10) \nplt.show()<\/code><\/pre>\n\n\n\n<p>M\u1eabu k\u1ebft qu\u1ea3 xu\u1ea5t ra t\u1eeb \u0111o\u1ea1n l\u1ec7nh:<\/p>\n\n\n\n<ins class=\"adsbygoogle\" style=\"display:block\" data-ad-client=\"ca-pub-5095883280136027\" data-ad-slot=\"7735063137\" data-ad-format=\"auto\" data-full-width-responsive=\"true\"><\/ins>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" src=\"https:\/\/github.com\/thangnch\/photos\/blob\/master\/Anh\/z08.png?raw=true\" alt=\"histogram\"\/><\/figure><\/div>\n\n\n\n<p><strong><u>K\u1ebft lu\u1eadn:<\/u><\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>M\u1eb7c d\u00f9 t\u00f4i kh\u00f4ng t\u00ecm \u0111\u01b0\u1ee3c y\u00eau c\u1ea7u ph\u1ea3i l\u1ef1a ch\u1ecdn c\u00e1c bi\u1ebfn \u0111\u1ed9c l\u1eadp X c\u00f3 ph\u00e2n ph\u1ed1i chu\u1ea9n \u0111\u1ec3 \u0111\u01b0a v\u00e0o m\u00f4 h\u00ecnh d\u1ef1 b\u00e1o, song tr\u00ean th\u1ef1c t\u1ebf d\u1eef li\u1ec7u th\u01b0\u1eddng c\u00f3 h\u00ecnh d\u1ea1ng ph\u00e2n ph\u1ed1i chu\u1ea9n. V\u00ed d\u1ee5 nh\u01b0 s\u1ed1 l\u01b0\u1ee3ng h\u1ecdc sinh gi\u1ecfi trong l\u1edbp th\u00ec \u00edt, s\u1ed1 l\u01b0\u1ee3ng h\u1ecdc sinh c\u00e1 bi\u1ec7t c\u0169ng \u00edt, c\u00f2n l\u1ea1i l\u00e0 nh\u1eefng h\u1ecdc sinh b\u00ecnh th\u01b0\u1eddng. Do v\u1eady bi\u1ec3u \u0111\u1ed3 n\u00e0y c\u0169ng gi\u00fap ch\u00fang ta nh\u1eadn x\u00e9t b\u1ed9 m\u1eabu d\u1eef li\u1ec7u (sample data) \u0111\u1ec3 x\u00e2y d\u1ef1ng m\u00f4 h\u00ecnh c\u1ee7a ch\u00fang ta c\u00f3 ch\u1ea5t l\u01b0\u1ee3ng t\u1ed1t kh\u00f4ng.<\/li><li>Bi\u1ec3u \u0111\u1ed3 n\u00e0y c\u0169ng c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng \u0111\u1ec3 x\u00e1c \u0111\u1ecbnh c\u00e1c c\u00f3 ch\u1ee9a c\u00e1c \u0111i\u1ec3m d\u1ecb bi\u1ec7t\/ outliers hay kh\u00f4ng<\/li><li>\u0110\u1ed1i v\u1edbi tr\u01b0\u1eddng h\u1ee3p d\u1eef li\u1ec7u \u0111\u1ed9c l\u1eadp X l\u00e0 d\u1eef li\u1ec7u r\u1eddi r\u1ea1c, th\u00ec kh\u00f4ng th\u1ec3 hi\u1ec7n h\u00ecnh d\u1ea1ng l\u00e0 ph\u00e2n ph\u1ed1i chu\u1ea9n.<\/li><\/ul>\n\n\n\n<p>Trong tr\u01b0\u1eddng h\u1ee3p v\u00ed d\u1ee5 tr\u00ean ta th\u1ea5y h\u00ecnh th\u00e1i ph\u00e2n b\u1ed1 d\u1eef li\u1ec7u c\u1ee7a bi\u1ebfn \u0111\u1ed9c l\u1eadp X \u2013 GDP t\u01b0\u01a1ng \u0111\u1ed1i \u0111\u1ed3ng \u0111\u1ec1u v\u00e0 c\u00f3 h\u00ecnh d\u1ea1ng bell curve.<\/p>\n\n\n\n<p><strong>M\u1ed9t s\u1ed1 c\u00e1c k\u1ef9 thu\u1eadt \u0111\u1ec3 ki\u1ec3m tra t\u00ednh t\u01b0\u01a1ng quan<\/strong><\/p>\n\n\n\n<h5 class=\"wp-block-heading\"><strong>Scatter<\/strong><\/h5>\n\n\n\n<p>\u0110\u00e2y l\u00e0 bi\u1ec3u \u0111\u1ed3 ph\u00e2n t\u00e1n d\u1eef li\u1ec7u \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 \u0111\u00e1nh gi\u00e1 m\u1ed1i t\u01b0\u01a1ng quan gi\u1eefa c\u1eb7p bi\u1ebfn. Trong tr\u01b0\u1eddng h\u1ee3p c\u1ee7a b\u00e0i t\u1eadp n\u00e0y ch\u00fang ta s\u1ebd s\u1eed d\u1ee5ng bi\u1ec3u \u0111\u1ed3 scatter \u0111\u1ec3 ph\u00e2n t\u00edch m\u1ed1i t\u01b0\u01a1ng quan gi\u1eefa bi\u1ebfn ph\u1ee5 thu\u1ed9c v\u00e0 bi\u1ebfn \u0111\u1ed9c l\u1eadp xem ch\u00fang c\u00f3 m\u1ed1i quan h\u1ec7 tuy\u1ebfn t\u00ednh hay kh\u00f4ng b\u1edfi m\u1ee5c \u0111\u00edch c\u1ee7a vi\u1ec7c ch\u1ecdn bi\u1ebfn \u0111\u1ec3 x\u00e2y d\u1ef1ng m\u00f4 h\u00ecnh tuy\u1ebfn t\u00ednh. D\u01b0\u1edbi \u0111\u00e2y l\u00e0 h\u00ecnh d\u1ea1ng k\u1ebft qu\u1ea3 c\u1ee7a bi\u1ec3u \u0111\u1ed3 Scatter, trong \u0111\u00f3 n\u1ebfu c\u00e1c \u0111i\u1ec3m d\u1eef li\u1ec7u kh\u00f4ng \u0111i theo m\u1ed9t \u0111\u01b0\u1eddng trend line n\u00e0o th\u00ec c\u00f3 th\u1ec3 th\u1ea5y r\u1eb1ng n\u00f3 kh\u00f4ng c\u00f3 m\u1ed1i quan h\u1ec7, bi\u1ec3u \u0111\u1ed3 c\u0169ng gi\u00fap ta \u0111\u00e1nh gi\u00e1 xem m\u1ed1i quan h\u1ec7 n\u00e0y c\u00f3 m\u1ea1nh hay y\u1ebfu kh\u00f4ng.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/github.com\/thangnch\/photos\/blob\/master\/Anh\/z09.png?raw=true\" alt=\"scatter\"\/><\/figure>\n\n\n\n<p>Gi\u1ea3 s\u1eed v\u1edbi t\u1ec7p d\u1eef li\u1ec7u ta th\u1eed nghi\u1ec7m v\u1ebd scatter gi\u1eefa bi\u1ebfn X = ch\u1ec9 s\u1ed1 GPD h\u00e0ng n\u0103m v\u00e0 bi\u1ebfn Y = t\u1ef7 l\u1ec7 n\u1ee3 x\u1ea5u NPL h\u00e0ng n\u0103m t\u01b0\u01a1ng \u1ee9ng<\/p>\n\n\n\n<p>M\u1eabu source code:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>df_scatter = df&#91;&#91;'GDP','NPL']]\n\nx = df_scatter&#91;'GDP']&#91;:13]\ny = df_scatter&#91;'NPL']&#91;:13]\n\nplt.scatter(x, y)\n\nz = np.polyfit(x, y, 1)\np = np.poly1d(z)\nplt.plot(x, p(x), \"r--\")\n\nplt.show()\n<\/code><\/pre>\n\n\n\n<p>Ch\u1ea1y m\u1eabu k\u1ebft qu\u1ea3 tr\u00ean Python ta c\u00f3 k\u1ebft qu\u1ea3 thu \u0111\u01b0\u1ee3c nh\u01b0 sau:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/github.com\/thangnch\/photos\/blob\/master\/Anh\/z10.png?raw=true\" alt=\"regression, m\u00f4 h\u00ecnh d\u1ef1 b\u00e1o\"\/><\/figure>\n\n\n\n<ins class=\"adsbygoogle\" style=\"display:block\" data-ad-client=\"ca-pub-5095883280136027\" data-ad-slot=\"7735063137\" data-ad-format=\"auto\" data-full-width-responsive=\"true\"><\/ins>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script>\n\n\n\n<p><u>K\u1ebft lu\u1eadn:<\/u><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>C\u00f3 th\u1ec3 s\u1eed d\u1ee5ng bi\u1ec3u \u0111\u1ed3 scatter n\u00e0y \u0111\u1ec3 ph\u00e2n t\u00edch \u201cC\u00f3 m\u1ed1i quan h\u1ec7 tuy\u1ebfn t\u00ednh gi\u1eefa bi\u1ebfn ph\u1ee5 thu\u1ed9c Y v\u1edbi c\u00e1c bi\u1ebfn \u0111\u1ed9c l\u1eadp X hay kh\u00f4ng?\u201d<\/li><li>Bi\u1ec3u \u0111\u1ed3 c\u0169ng th\u1ec3 hi\u1ec7n \u0111\u01b0\u1ee3c m\u1ed1i quan h\u1ec7 l\u00e0 m\u1ea1nh hay y\u1ebfu, m\u1ed1i quan h\u1ec7 c\u00f9ng chi\u1ec1u &#8211; \u0111\u1ed3ng bi\u1ebfn (positive) hay ng\u01b0\u1ee3c chi\u1ec1u &#8211; ngh\u1ecbch bi\u1ebfn (negative). Trong tr\u01b0\u1eddng h\u1ee3p v\u00ed d\u1ee5 tr\u00ean ta th\u1ea5y NPL v\u00e0 GDP c\u00f3 m\u1ed1i quan h\u1ec7 tuy\u1ebfn t\u00ednh ngh\u1ecbch bi\u1ebfn v\u00e0 quan h\u1ec7 m\u1ea1nh.<\/li><\/ul>\n\n\n\n<h5 class=\"wp-block-heading\"><strong><strong>Correlation<\/strong><\/strong><\/h5>\n\n\n\n<p>Ki\u1ec3m \u0111\u1ecbnhm\u1ed1i quan h\u1ec7 gi\u1eefa c\u00e1c bi\u1ebfn l\u00e0 \u201cm\u1ea1nh\u201d hay \u201cy\u1ebfu\u201d. Kh\u00e1c v\u1edbi so s\u00e1nh c\u1eb7p bi\u1ebfn trong Scatter, trong ph\u00e9p th\u1eed n\u00e0y ch\u00fang ta c\u00f3 th\u1ec3 xem x\u00e9t \u0111\u01b0\u1ee3c gi\u1eefa c\u00e1c bi\u1ebfn \u0111\u1ed9c l\u1eadp X c\u00f3 m\u1ed1i quan h\u1ec7 v\u1edbi nhau hay kh\u00f4ng th\u00f4ng qua ph\u00e2n t\u00edch t\u01b0\u01a1ng quan Pearson. Khi s\u1eed d\u1ee5ng Python \u0111\u1ec3 ch\u1ea1y ra k\u1ebft qu\u1ea3 ph\u00e2n t\u00edch t\u01b0\u01a1ng quan Pearson, ng\u01b0\u1eddi ta s\u1ebd c\u0103n c\u1ee9 tr\u00ean h\u1ec7 s\u1ed1 t\u01b0\u01a1ng quan \u201cr\u201d \u0111\u1ec3 \u0111\u00e1nh gi\u00e1 m\u1ed1i quan h\u1ec7 tuy\u1ebfn t\u00ednh c\u1ee7a 2 bi\u1ebfn m\u00e0 kh\u00f4ng ph\u1ee5 thu\u1ed9c v\u00e0o \u0111\u01a1n v\u1ecb \u0111o l\u01b0\u1eddng. \u201cr\u201d \u0111\u01b0\u1ee3c t\u00ednh b\u1eb1ng c\u00f4ng th\u1ee9c:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" src=\"https:\/\/github.com\/thangnch\/photos\/blob\/master\/Anh\/Untitled.png?raw=true\" alt=\"\"\/><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" src=\"https:\/\/github.com\/thangnch\/photos\/blob\/master\/Anh\/z11.png?raw=true\" alt=\"correllation, m\u00f4 h\u00ecnh d\u1ef1 b\u00e1o\"\/><\/figure><\/div>\n\n\n\n<p>D\u1ef1a tr\u00ean h\u00ecnh v\u1ebd ta c\u00f3 th\u1ec3 th\u1ea5y n\u1ebfu h\u1ec7 s\u1ed1 t\u01b0\u01a1ng quan r &gt; 0.5 th\u00ec c\u00f3 ngh\u0129a l\u00e0 c\u1eb7p bi\u1ebfn c\u00f3 m\u1ed1i quan h\u1ec7 v\u1edbi nhau. Tr\u01b0\u1eddng h\u1ee3p c\u1eb7p bi\u1ebfn \u0111\u1ec1u l\u00e0 2 bi\u1ebfn bi\u1ebfn \u0111\u1ed9c l\u1eadp X th\u00ec khi x\u00e2y d\u1ef1ng m\u00f4 h\u00ecnh, n\u1ebfu ta k\u1ebft h\u1ee3p c\u1eb7p bi\u1ebfn n\u00e0y \u0111\u1ec3 \u0111\u00e1nh gi\u00e1 l\u00ean bi\u1ebfn ph\u1ee5 thu\u1ed9c Y n\u00f3 c\u00f3 th\u1ec3 x\u1ea9y ra \u0111a c\u1ed9ng tuy\u1ebfn v\u1edbi m\u00f4 h\u00ecnh h\u1ed3i quy tuy\u1ebfn t\u00ednh, ngh\u0129a l\u00e0 k\u1ebft qu\u1ea3 c\u1ee7a m\u00f4 h\u00ecnh kh\u00f4ng ch\u00ednh x\u00e1c.<\/p>\n\n\n\n<p>M\u1eabu source code m\u00ecnh th\u1ec3 hi\u1ec7n \u0111\u1ee7 c\u00e1c ph\u01b0\u01a1ng th\u1ee9c kh\u00e1c nhau c\u00f3 th\u1ec3 bi\u1ec3u di\u1ec5n m\u1ed1i quan h\u1ec7 trong Python, tuy nhi\u00ean khi ph\u00e2n t\u00edch m\u00ecnh ch\u1ec9 t\u1eadp trung v\u00e0o ph\u00e2n t\u00edch h\u1ec7 s\u1ed1 t\u01b0\u01a1ng quan r theo Pearson:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># 5. Ma tr\u1eadn t\u01b0\u01a1ng quan gi\u1eefa c\u00e1c bi\u1ebfn tr\u00ean 3 method kh\u00e1c nhau\ndf_corr = df&#91;&#91;'Inflation', 'Lending_Interest_Rate', 'Unemployment', 'GDP','NPL']]\nprint(\"-----------K\u1ebft qu\u1ea3 pearson---------------\")\nprint(df_corr.corr(method='pearson', min_periods=1))\nprint(\"-----------K\u1ebft qu\u1ea3 kendall---------------\")\nprint(df_corr.corr(method='kendall'))\nprint(\"------------K\u1ebft qu\u1ea3 spearman--------------\")\nprint(df_corr.corr(method='spearman'))\n<\/code><\/pre>\n\n\n\n<p>Ch\u1ea1y m\u1eabu k\u1ebft qu\u1ea3 tr\u00ean Python ta c\u00f3 k\u1ebft qu\u1ea3 thu \u0111\u01b0\u1ee3c nh\u01b0 sau:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/github.com\/thangnch\/photos\/blob\/master\/Anh\/z12.png?raw=true\" alt=\"\"\/><\/figure>\n\n\n\n<p><u><strong>K\u1ebft lu\u1eadn:<\/strong><\/u><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>C\u00f3 th\u1ec3 s\u1eed d\u1ee5ng h\u00e0m corr n\u00e0y \u0111\u1ec3 ph\u00e2n t\u00edch \u201cC\u00f3 m\u1ed1i quan h\u1ec7 gi\u1eefa c\u00e1c c\u1eb7p bi\u1ebfn hay kh\u00f4ng?\u201d C\u00e1c c\u1eb7p bi\u1ebfn bao g\u1ed3m c\u1ea3 c\u00e1c c\u1eb7p bi\u1ebfn \u0111\u1ed9c l\u1eadp X v\u00e0 gi\u1eefa bi\u1ebfn \u0111\u1ed9c l\u1eadp X v\u00e0 bi\u1ebfn ph\u1ee5 thu\u1ed9c Y.<\/li><li>Bi\u1ec3u \u0111\u1ed3 c\u0169ng th\u1ec3 hi\u1ec7n \u0111\u01b0\u1ee3c m\u1ed1i quan h\u1ec7 l\u00e0 m\u1ea1nh hay y\u1ebfu, m\u1ed1i quan h\u1ec7 c\u00f9ng chi\u1ec1u &#8211; \u0111\u1ed3ng bi\u1ebfn (positive) hay ng\u01b0\u1ee3c chi\u1ec1u &#8211; ngh\u1ecbch bi\u1ebfn (negative) gi\u1ed1ng nh\u01b0 scatter. Trong tr\u01b0\u1eddng h\u1ee3p v\u00ed d\u1ee5 tr\u00ean ta th\u1ea5y bi\u1ebfn ph\u1ee5 Y &#8211; NPL v\u00e0 bi\u1ebfn \u0111\u1ed9c l\u1eadp X &#8211; GDP c\u00f3 m\u1ed1i quan h\u1ec7 tuy\u1ebfn t\u00ednh ngh\u1ecbch bi\u1ebfn v\u00e0 quan h\u1ec7 m\u1ea1nh. Ta c\u0169ng th\u1ea5y c\u1eb7p bi\u1ebfn \u0111\u1ed9c l\u1eadp X (Inflation v\u00e0 Lending Interest Rate) v\u00e0 c\u1eb7p (Unemployment v\u00e0 GDP) c\u0169ng c\u00f3 m\u1ed1i quan h\u1ec7 v\u1edbi nhau (r&gt;|0.5|), x\u00e9t tr\u00ean th\u1ef1c t\u1ebf ta th\u1ea5y t\u1ef7 l\u1ec7 l\u1ea1m ph\u00e1t v\u00e0 l\u00e3i su\u1ea5t cho vay c\u0169ng c\u00f3 m\u1ed1i quan h\u1ec7 thu\u1eadn v\u1edbi nhau, khi l\u1ea1m ph\u00e1t cao th\u00ec l\u00e3i su\u1ea5t vay c\u0169ng t\u0103ng theo, hay khi GDP gi\u1ea3m th\u00ec t\u1ef7 l\u1ec7 th\u1ea5t nghi\u1ec7p c\u0169ng t\u0103ng l\u00ean. \u0110\u1ed1i v\u1edbi tr\u01b0\u1eddng h\u1ee3p n\u00e0y n\u1ebfu l\u1ef1a ch\u1ecdn c\u1eb7p bi\u1ebfn n\u00e0y \u0111\u1ec3 x\u00e2y d\u1ef1ng m\u00f4 h\u00ecnh c\u1ea7n ch\u00fa \u00fd \u0111\u1ebfn s\u1ef1 \u0111a c\u1ed9ng tuy\u1ebfn ngh\u0129a l\u00e0 t\u00e1c \u0111\u1ed9ng c\u1ee7a c\u00e1c X l\u00ean nhau c\u00f3 th\u1ec3 l\u00e0m \u1ea3nh h\u01b0\u1edfng chung \u0111\u1ebfn Y v\u00e0 kh\u00f4ng ph\u1ea3n \u00e1nh trung th\u01b0c t\u00e1c \u0111\u1ed9ng c\u1ee7a X \u0111\u1ebfn Y.<\/li><\/ul>\n\n\n\n<ins class=\"adsbygoogle\" style=\"display:block\" data-ad-client=\"ca-pub-5095883280136027\" data-ad-slot=\"7735063137\" data-ad-format=\"auto\" data-full-width-responsive=\"true\"><\/ins>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script>\n\n\n\n<p>R\u1ed3i, m\u00ecnh \u0111\u00e3 \u0111i \u0111\u01b0\u1ee3c 2 ph\u1ea7n \u0111\u1ea7u c\u1ee7a b\u00e0i x\u00e2y d\u1ef1ng m\u00f4 h\u00ecnh d\u1ef1 b\u00e1o, m\u00ecnh s\u1ebd t\u1ea1m d\u1eebng b\u00e0i n\u00e0y \u1edf \u0111\u00e2y, trong b\u00e0i ti\u1ebfp theo ch\u00fang ta s\u1ebd \u0111i c\u00e1c B\u01b0\u1edbc 3,4,5 c\u1ee7a tri\u1ec3n khai m\u00f4 h\u00ecnh d\u1ef1 b\u00e1o \u0111\u01a1n gi\u1ea3n nh\u00e9.<\/p>\n\n\n\n<p><strong><em>H\u00e3y join c\u00f9ng c\u1ed9ng \u0111\u1ed3ng M\u00ec AI nh\u00e9!<\/em><\/strong><\/p>\n\n\n\n<p>Fanpage:&nbsp;<a rel=\"noreferrer noopener\" href=\"http:\/\/facebook.com\/miaiblog\" target=\"_blank\">http:\/\/facebook.com\/miaiblog<\/a><br>Group trao \u0111\u1ed5i, chia s\u1ebb:&nbsp;<a rel=\"noreferrer noopener\" href=\"https:\/\/www.facebook.com\/groups\/miaigroup\" target=\"_blank\">https:\/\/www.facebook.com\/groups\/miaigroup<\/a><br>Website:&nbsp;<a href=\"https:\/\/miai.vn\/\">https:\/\/miai.vn\/<\/a><br>Youtube:&nbsp;<a rel=\"noreferrer noopener\" href=\"http:\/\/bit.ly\/miaiyoutube\" target=\"_blank\">http:\/\/bit.ly\/miaiyoutube<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ch\u00e0o c\u00e1c member M\u00ec AI, h\u00f4m nay ch\u00fang ta s\u1ebd c\u00f9ng t\u00ecm hi\u1ec3u c\u00e1ch tri\u1ec3n khai m\u00f4 h\u00ecnh d\u1ef1 b\u00e1o \u0111\u01a1n gi\u1ea3n b\u1eb1ng Python. Ch\u00fa \u00fd \u0111\u00e2y ho\u00e0n to\u00e0n l\u00e0 ghi ch\u00e9p trong th\u1ef1c t\u1ebf l\u00e0m vi\u1ec7c n\u00ean n\u1ebfu c\u00f3 g\u00ec sai, c\u00e1c cao th\u1ee7 g\u00f3p \u00fd gi\u00fap \u0111\u1ec3 ho\u00e0n thi\u1ec7n nh\u00e9. Trong b\u00e0i vi\u1ebft [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[285],"tags":[282,283,284,287,351,352,353,354],"class_list":["post-1099","post","type-post","status-publish","format-standard","hentry","category-data-science-data-analysis","tag-da","tag-data-analysis","tag-data-science","tag-ds","tag-du-doan","tag-hoi-quy","tag-phan-tich-du-lieu","tag-tuyen-tinh"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>[DA-DS] Tri\u1ec3n khai m\u00f4 h\u00ecnh d\u1ef1 b\u00e1o \u0111\u01a1n gi\u1ea3n (Ch\u01b0\u01a1ng 1\/2) - M\u00ec AI<\/title>\n<meta name=\"description\" content=\"Ch\u00e0o c\u00e1c member M\u00ec AI, h\u00f4m nay ch\u00fang ta s\u1ebd c\u00f9ng t\u00ecm hi\u1ec3u c\u00e1ch tri\u1ec3n khai m\u00f4 h\u00ecnh d\u1ef1 b\u00e1o \u0111\u01a1n gi\u1ea3n b\u1eb1ng Python. \u0110\u00e2y l\u00e0 ghi ch\u00e9p trong th\u1ef1c t\u1ebf l\u00e0m vi\u1ec7c.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/miai.vn\/?p=1099\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[DA-DS] Tri\u1ec3n khai m\u00f4 h\u00ecnh d\u1ef1 b\u00e1o \u0111\u01a1n gi\u1ea3n (Ch\u01b0\u01a1ng 1\/2) - M\u00ec AI\" \/>\n<meta property=\"og:description\" content=\"Ch\u00e0o c\u00e1c member M\u00ec AI, h\u00f4m nay ch\u00fang ta s\u1ebd c\u00f9ng t\u00ecm hi\u1ec3u c\u00e1ch tri\u1ec3n khai m\u00f4 h\u00ecnh d\u1ef1 b\u00e1o \u0111\u01a1n gi\u1ea3n b\u1eb1ng Python. \u0110\u00e2y l\u00e0 ghi ch\u00e9p trong th\u1ef1c t\u1ebf l\u00e0m vi\u1ec7c.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/miai.vn\/?p=1099\" \/>\n<meta property=\"og:site_name\" content=\"M\u00ec AI\" \/>\n<meta property=\"article:published_time\" content=\"2020-07-27T01:14:49+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/github.com\/thangnch\/photos\/blob\/master\/Anh\/z01.png?raw=true\" \/>\n<meta name=\"author\" content=\"Ch\u1ee7 ti\u1ec7m M\u00ec\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ch\u1ee7 ti\u1ec7m M\u00ec\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"22 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/miai.vn\\\/?p=1099#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/miai.vn\\\/?p=1099\"},\"author\":{\"name\":\"Ch\u1ee7 ti\u1ec7m M\u00ec\",\"@id\":\"https:\\\/\\\/miai.vn\\\/#\\\/schema\\\/person\\\/cc8bc24bb90bd3f596add82f3a59948c\"},\"headline\":\"[DA-DS] Tri\u1ec3n khai m\u00f4 h\u00ecnh d\u1ef1 b\u00e1o \u0111\u01a1n gi\u1ea3n (Ch\u01b0\u01a1ng 1\\\/2)\",\"datePublished\":\"2020-07-27T01:14:49+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/miai.vn\\\/?p=1099\"},\"wordCount\":3760,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/miai.vn\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/miai.vn\\\/?p=1099#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/github.com\\\/thangnch\\\/photos\\\/blob\\\/master\\\/Anh\\\/z01.png?raw=true\",\"keywords\":[\"da\",\"Data Analysis\",\"Data Science\",\"ds\",\"d\u1ef1 \u0111o\u00e1n\",\"h\u1ed3i quy\",\"ph\u1ea7n t\u00edch d\u1eef li\u1ec7u\",\"tuy\u1ebfn t\u00ednh\"],\"articleSection\":[\"Data Science - Data Analysis\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/miai.vn\\\/?p=1099#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/miai.vn\\\/?p=1099\",\"url\":\"https:\\\/\\\/miai.vn\\\/?p=1099\",\"name\":\"[DA-DS] Tri\u1ec3n khai m\u00f4 h\u00ecnh d\u1ef1 b\u00e1o \u0111\u01a1n gi\u1ea3n (Ch\u01b0\u01a1ng 1\\\/2) - M\u00ec AI\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/miai.vn\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/miai.vn\\\/?p=1099#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/miai.vn\\\/?p=1099#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/github.com\\\/thangnch\\\/photos\\\/blob\\\/master\\\/Anh\\\/z01.png?raw=true\",\"datePublished\":\"2020-07-27T01:14:49+00:00\",\"description\":\"Ch\u00e0o c\u00e1c member M\u00ec AI, h\u00f4m nay ch\u00fang ta s\u1ebd c\u00f9ng t\u00ecm hi\u1ec3u c\u00e1ch tri\u1ec3n khai m\u00f4 h\u00ecnh d\u1ef1 b\u00e1o \u0111\u01a1n gi\u1ea3n b\u1eb1ng Python. \u0110\u00e2y l\u00e0 ghi ch\u00e9p trong th\u1ef1c t\u1ebf l\u00e0m vi\u1ec7c.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/miai.vn\\\/?p=1099#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/miai.vn\\\/?p=1099\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/miai.vn\\\/?p=1099#primaryimage\",\"url\":\"https:\\\/\\\/github.com\\\/thangnch\\\/photos\\\/blob\\\/master\\\/Anh\\\/z01.png?raw=true\",\"contentUrl\":\"https:\\\/\\\/github.com\\\/thangnch\\\/photos\\\/blob\\\/master\\\/Anh\\\/z01.png?raw=true\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/miai.vn\\\/?p=1099#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/miai.vn\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[DA-DS] Tri\u1ec3n khai m\u00f4 h\u00ecnh d\u1ef1 b\u00e1o \u0111\u01a1n gi\u1ea3n (Ch\u01b0\u01a1ng 1\\\/2)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/miai.vn\\\/#website\",\"url\":\"https:\\\/\\\/miai.vn\\\/\",\"name\":\"M\u00ec AI\",\"description\":\"H\u1ecdc AI theo c\u00e1ch M\u00ec \u0103n li\u1ec1n!\",\"publisher\":{\"@id\":\"https:\\\/\\\/miai.vn\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/miai.vn\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/miai.vn\\\/#organization\",\"name\":\"M\u00ec AI\",\"url\":\"https:\\\/\\\/miai.vn\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/miai.vn\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/miai.vn\\\/wp-content\\\/uploads\\\/2026\\\/05\\\/cropped-Logo_w_slogan.png\",\"contentUrl\":\"https:\\\/\\\/miai.vn\\\/wp-content\\\/uploads\\\/2026\\\/05\\\/cropped-Logo_w_slogan.png\",\"width\":240,\"height\":193,\"caption\":\"M\u00ec AI\"},\"image\":{\"@id\":\"https:\\\/\\\/miai.vn\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/miai.vn\\\/#\\\/schema\\\/person\\\/cc8bc24bb90bd3f596add82f3a59948c\",\"name\":\"Ch\u1ee7 ti\u1ec7m M\u00ec\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b0b5124b0d2c0a8054d7127d2c236bdc3dc7a50e2d4e8728ab32eee5b122a8d1?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b0b5124b0d2c0a8054d7127d2c236bdc3dc7a50e2d4e8728ab32eee5b122a8d1?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b0b5124b0d2c0a8054d7127d2c236bdc3dc7a50e2d4e8728ab32eee5b122a8d1?s=96&d=mm&r=g\",\"caption\":\"Ch\u1ee7 ti\u1ec7m M\u00ec\"},\"sameAs\":[\"https:\\\/\\\/miai.vn\"],\"url\":\"https:\\\/\\\/miai.vn\\\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[DA-DS] Tri\u1ec3n khai m\u00f4 h\u00ecnh d\u1ef1 b\u00e1o \u0111\u01a1n gi\u1ea3n (Ch\u01b0\u01a1ng 1\/2) - M\u00ec AI","description":"Ch\u00e0o c\u00e1c member M\u00ec AI, h\u00f4m nay ch\u00fang ta s\u1ebd c\u00f9ng t\u00ecm hi\u1ec3u c\u00e1ch tri\u1ec3n khai m\u00f4 h\u00ecnh d\u1ef1 b\u00e1o \u0111\u01a1n gi\u1ea3n b\u1eb1ng Python. \u0110\u00e2y l\u00e0 ghi ch\u00e9p trong th\u1ef1c t\u1ebf l\u00e0m vi\u1ec7c.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/miai.vn\/?p=1099","og_locale":"en_US","og_type":"article","og_title":"[DA-DS] Tri\u1ec3n khai m\u00f4 h\u00ecnh d\u1ef1 b\u00e1o \u0111\u01a1n gi\u1ea3n (Ch\u01b0\u01a1ng 1\/2) - M\u00ec AI","og_description":"Ch\u00e0o c\u00e1c member M\u00ec AI, h\u00f4m nay ch\u00fang ta s\u1ebd c\u00f9ng t\u00ecm hi\u1ec3u c\u00e1ch tri\u1ec3n khai m\u00f4 h\u00ecnh d\u1ef1 b\u00e1o \u0111\u01a1n gi\u1ea3n b\u1eb1ng Python. \u0110\u00e2y l\u00e0 ghi ch\u00e9p trong th\u1ef1c t\u1ebf l\u00e0m vi\u1ec7c.","og_url":"https:\/\/miai.vn\/?p=1099","og_site_name":"M\u00ec AI","article_published_time":"2020-07-27T01:14:49+00:00","og_image":[{"url":"https:\/\/github.com\/thangnch\/photos\/blob\/master\/Anh\/z01.png?raw=true","type":"","width":"","height":""}],"author":"Ch\u1ee7 ti\u1ec7m M\u00ec","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Ch\u1ee7 ti\u1ec7m M\u00ec","Est. reading time":"22 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/miai.vn\/?p=1099#article","isPartOf":{"@id":"https:\/\/miai.vn\/?p=1099"},"author":{"name":"Ch\u1ee7 ti\u1ec7m M\u00ec","@id":"https:\/\/miai.vn\/#\/schema\/person\/cc8bc24bb90bd3f596add82f3a59948c"},"headline":"[DA-DS] Tri\u1ec3n khai m\u00f4 h\u00ecnh d\u1ef1 b\u00e1o \u0111\u01a1n gi\u1ea3n (Ch\u01b0\u01a1ng 1\/2)","datePublished":"2020-07-27T01:14:49+00:00","mainEntityOfPage":{"@id":"https:\/\/miai.vn\/?p=1099"},"wordCount":3760,"commentCount":2,"publisher":{"@id":"https:\/\/miai.vn\/#organization"},"image":{"@id":"https:\/\/miai.vn\/?p=1099#primaryimage"},"thumbnailUrl":"https:\/\/github.com\/thangnch\/photos\/blob\/master\/Anh\/z01.png?raw=true","keywords":["da","Data Analysis","Data Science","ds","d\u1ef1 \u0111o\u00e1n","h\u1ed3i quy","ph\u1ea7n t\u00edch d\u1eef li\u1ec7u","tuy\u1ebfn t\u00ednh"],"articleSection":["Data Science - Data Analysis"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/miai.vn\/?p=1099#respond"]}]},{"@type":"WebPage","@id":"https:\/\/miai.vn\/?p=1099","url":"https:\/\/miai.vn\/?p=1099","name":"[DA-DS] Tri\u1ec3n khai m\u00f4 h\u00ecnh d\u1ef1 b\u00e1o \u0111\u01a1n gi\u1ea3n (Ch\u01b0\u01a1ng 1\/2) - M\u00ec AI","isPartOf":{"@id":"https:\/\/miai.vn\/#website"},"primaryImageOfPage":{"@id":"https:\/\/miai.vn\/?p=1099#primaryimage"},"image":{"@id":"https:\/\/miai.vn\/?p=1099#primaryimage"},"thumbnailUrl":"https:\/\/github.com\/thangnch\/photos\/blob\/master\/Anh\/z01.png?raw=true","datePublished":"2020-07-27T01:14:49+00:00","description":"Ch\u00e0o c\u00e1c member M\u00ec AI, h\u00f4m nay ch\u00fang ta s\u1ebd c\u00f9ng t\u00ecm hi\u1ec3u c\u00e1ch tri\u1ec3n khai m\u00f4 h\u00ecnh d\u1ef1 b\u00e1o \u0111\u01a1n gi\u1ea3n b\u1eb1ng Python. \u0110\u00e2y l\u00e0 ghi ch\u00e9p trong th\u1ef1c t\u1ebf l\u00e0m vi\u1ec7c.","breadcrumb":{"@id":"https:\/\/miai.vn\/?p=1099#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/miai.vn\/?p=1099"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/miai.vn\/?p=1099#primaryimage","url":"https:\/\/github.com\/thangnch\/photos\/blob\/master\/Anh\/z01.png?raw=true","contentUrl":"https:\/\/github.com\/thangnch\/photos\/blob\/master\/Anh\/z01.png?raw=true"},{"@type":"BreadcrumbList","@id":"https:\/\/miai.vn\/?p=1099#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/miai.vn\/"},{"@type":"ListItem","position":2,"name":"[DA-DS] Tri\u1ec3n khai m\u00f4 h\u00ecnh d\u1ef1 b\u00e1o \u0111\u01a1n gi\u1ea3n (Ch\u01b0\u01a1ng 1\/2)"}]},{"@type":"WebSite","@id":"https:\/\/miai.vn\/#website","url":"https:\/\/miai.vn\/","name":"M\u00ec AI","description":"H\u1ecdc AI theo c\u00e1ch M\u00ec \u0103n li\u1ec1n!","publisher":{"@id":"https:\/\/miai.vn\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/miai.vn\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/miai.vn\/#organization","name":"M\u00ec AI","url":"https:\/\/miai.vn\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/miai.vn\/#\/schema\/logo\/image\/","url":"https:\/\/miai.vn\/wp-content\/uploads\/2026\/05\/cropped-Logo_w_slogan.png","contentUrl":"https:\/\/miai.vn\/wp-content\/uploads\/2026\/05\/cropped-Logo_w_slogan.png","width":240,"height":193,"caption":"M\u00ec AI"},"image":{"@id":"https:\/\/miai.vn\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/miai.vn\/#\/schema\/person\/cc8bc24bb90bd3f596add82f3a59948c","name":"Ch\u1ee7 ti\u1ec7m M\u00ec","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/b0b5124b0d2c0a8054d7127d2c236bdc3dc7a50e2d4e8728ab32eee5b122a8d1?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/b0b5124b0d2c0a8054d7127d2c236bdc3dc7a50e2d4e8728ab32eee5b122a8d1?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b0b5124b0d2c0a8054d7127d2c236bdc3dc7a50e2d4e8728ab32eee5b122a8d1?s=96&d=mm&r=g","caption":"Ch\u1ee7 ti\u1ec7m M\u00ec"},"sameAs":["https:\/\/miai.vn"],"url":"https:\/\/miai.vn\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/miai.vn\/index.php?rest_route=\/wp\/v2\/posts\/1099","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/miai.vn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/miai.vn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/miai.vn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/miai.vn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1099"}],"version-history":[{"count":0,"href":"https:\/\/miai.vn\/index.php?rest_route=\/wp\/v2\/posts\/1099\/revisions"}],"wp:attachment":[{"href":"https:\/\/miai.vn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1099"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/miai.vn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1099"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/miai.vn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1099"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}