{"id":43620,"date":"2021-07-28T11:59:48","date_gmt":"2021-07-28T04:59:48","guid":{"rendered":"http:\/\/httl.com.vn\/wiki\/cach-su-dung-jupyter-notebook\/"},"modified":"2021-07-28T11:59:48","modified_gmt":"2021-07-28T04:59:48","slug":"cach-su-dung-jupyter-notebook","status":"publish","type":"post","link":"https:\/\/httl.com.vn\/wiki\/cach-su-dung-jupyter-notebook\/","title":{"rendered":"C\u00e1ch s\u1eed d\u1ee5ng jupyter notebook"},"content":{"rendered":"<\/p>\n
\u0110\u0103ng nh\u1eadp<\/p>\n
<\/p>\n
M\u1ea0CH \u0110I\u1ec6N
Arduino
M\u00e0n h\u00ecnh LCD<\/p>\n
Jupyter Notebook \u2013 m\u1ed9t \u1ee9ng d\u1ee5ng web tuy\u1ec7t v\u1eddi \u0111\u1ec3 t\u1ea1o v\u00e0 chia s\u1ebb t\u00e0i li\u1ec7u bao g\u1ed3m: live code, m\u00f4 ph\u1ecfng v\u00e0 nhi\u1ec1u h\u01a1n th\u1ebf n\u1eefa. H\u00e3y c\u0169ng t\u00ecm hi\u1ec3u v\u1edbi httl.com.vn\/wiki Vi\u1ec7t Nam nh\u00e9 !<\/em><\/p>\n 1. Gi\u1edbi thi\u1ec7u<\/strong><\/p>\n \u1ede B\u00e0i 2, ch\u00fang ta \u0111\u00e3 bi\u1ebft \u0111\u01b0\u1ee3c c\u00e1ch c\u00e0i \u0111\u1eb7t Anaconda v\u00e0 s\u1eed d\u1ee5ng nhanh Jupyter Notebook. \u1ede b\u00e0i n\u00e0y, ch\u00fang ta s\u1ebd t\u00ecm hi\u1ec3u s\u00e2u h\u01a1n v\u1ec1 Jupyter Notebook v\u00e0 c\u00e1ch s\u1eed d\u1ee5ng n\u00f3; Jupyter Notebook l\u00e0 g\u00ec ? T\u1ea1i sao ch\u00fang ta n\u00ean s\u1eed d\u1ee5ng<\/p>\n Jupyter Notebook l\u00e0 m\u1ed9t \u1ee9ng d\u1ee5ng web m\u00e3 ngu\u1ed3n m\u1edf cho ph\u00e9p b\u1ea1n t\u1ea1o ho\u1eb7c chia s\u1ebb nh\u1eefng v\u0103n b\u1ea3n ch\u1ee9a:<\/p>\n live codem\u00f4 ph\u1ecfngv\u0103n b\u1ea3n di\u1ec5n gi\u1ea3i<\/p>\n Jupyter Notebook l\u00e0 m\u1ed9t c\u00f4ng c\u1ee5 tuy\u1ec7t v\u1eddi \u0111\u1ec3:<\/p>\n H\u1ecdc v\u00e0 th\u1eed nghi\u1ec7m v\u1edbi PythonX\u1eed l\u00fd \/ bi\u1ebfn \u0111\u1ed5i d\u1eef li\u1ec7u (Data processing \/ transformations)M\u00f4 ph\u1ecfng s\u1ed1 h\u1ecdc (v\u1ebd bi\u1ec3u \u0111\u1ed3)Th\u1ed1ng k\u00ea m\u00f4 h\u00ecnhMachine learning<\/p>\n 2. T\u1ed5ng quan v\u1ec1 notebook<\/strong><\/p>\n Kh\u1edfi \u0111\u1ed9ng Jupyter Notebook v\u00e0 t\u1ea1o m\u1edbi m\u1ed9t notebook (N\u1ebfu b\u1ea1n \u0111\u00e3 qu\u00ean h\u00e3y xem l\u1ea1i b\u00e0i 2)<\/p>\n<\/p>\n Notebook khi m\u1edbi \u0111\u01b0\u1ee3c t\u1ea1o c\u00f3 t\u00ean m\u1eb7c \u0111\u1ecbnh l\u00e0 Untitled<\/strong>. B\u1ea1n c\u00f3 th\u1ec3 click v\u00e0o ch\u1eef \u201cUntitled\u201d ph\u00eda tr\u00ean c\u0169ng, b\u00ean ph\u1ea3i logo Jupyter \u0111\u1ec3 t\u1ef1 thay \u0111\u1ed5i t\u00ean theo \u00fd c\u1ee7a b\u1ea1n. V\u00ed d\u1ee5 \u1edf \u0111\u00e2y t\u00f4i \u0111\u1ed5i t\u00ean th\u00e0nh notebook01<\/strong><\/p>\n <\/strong><\/p>\n Chuy\u1ec3n v\u1ec1 Tab qu\u1ea3n l\u00fd file c\u1ee7a Jupyter, b\u1ea1n s\u1ebd th\u1ea5y m\u1ed9t file m\u1edbi c\u00f3 t\u00ean notebook01.ipynb <\/strong>v\u1edbi tr\u1ea1ng th\u00e1i l\u00e0 Running<\/em><\/strong> v\u00ec notebook n\u00e0y \u0111ang \u0111\u01b0\u1ee3c m\u1edf. B\u1ea1n c\u0169ng c\u00f3 th\u1ec3 t\u1eaft m\u1ed9t notebook b\u1eb1ng c\u00e1ch nh\u1ea5n Shutdown<\/strong>.<\/p>\n B\u1ea1n \u0111ang xem: C\u00e1ch s\u1eed d\u1ee5ng jupyter notebook<\/a><\/p>\n<\/p>\n 3. L\u00e0m vi\u1ec7c v\u1edbi notebook<\/strong><\/p>\n M\u1ed9t notebook bao g\u1ed3m nhi\u1ec1u cell (\u00f4). Khi t\u1ea1o m\u1edbi m\u1ed9t notebook, b\u1ea1n lu\u00f4n \u0111\u01b0\u1ee3c t\u1ea1o s\u1eb5n m\u1ed9t cell r\u1ed7ng \u0111\u1ea7u ti\u00ean.<\/p>\n<\/p>\n Cell tr\u00ean c\u00f3 ki\u1ec3u l\u00e0 \u201cCode\u201d, \u0111i\u1ec1u \u0111\u00f3 c\u00f3 ngh\u0129a l\u00e0 b\u1ea1n c\u00f3 th\u1ec3 g\u00f5 code Python v\u00e0 th\u1ef1c thi ngay l\u1eadp t\u1ee9c. \u0110\u1ec3 th\u1ef1c thi code, b\u1ea1n c\u00f3 th\u1ec3 nh\u1ea5n n\u00fat Run cell ho\u1eb7c nh\u1ea5n Ctrl + Enter.<\/p>\n<\/p>\n K\u1ebft qu\u1ea3 ngay l\u1eadp t\u1ee9c \u0111\u01b0\u1ee3c hi\u1ec3n th\u1ecb t\u1ea1i \u00f4 b\u00ean d\u01b0\u1edbi. M\u1ed9t cell r\u1ed7ng s\u1ebd \u0111\u01b0\u1ee3c t\u1ea1o sau khi b\u1ea1n th\u1ef1c thi code. H\u00e3y g\u00f5 ti\u1ebfp m\u1ed9t \u0111o\u1ea1n code Python \u0111\u1ec3 th\u1eed nghi\u1ec7m n\u00e0o:<\/p>\n<\/p>\n B\u1ea1n c\u00f3 th\u1ec3 chuy\u1ec3n lo\u1ea1i cell t\u1eeb Code th\u00e0nh Markdown \u0111\u1ec3 vi\u1ebft nh\u1eefng \u0111o\u1ea1n v\u0103n b\u1ea3n gi\u1ea3i th\u00edch code c\u1ee7a b\u1ea1n ch\u1eb3ng h\u1ea1n. \u0110\u1ec3 chuy\u1ec3n \u0111\u1ed5i b\u1ea1n click v\u00e0o ComboBox Code v\u00e0 ch\u1ecdn Markdown nh\u01b0 h\u00ecnh:<\/p>\n<\/p>\n Sau khi chuy\u1ec3n, h\u00e3y nh\u1eadp ngay m\u1ed9t \u0111o\u1ea1n Markdown \u0111\u1ec3 th\u1eed nghi\u1ec7m n\u00e0o.<\/p>\n *<\/strong>L\u01b0u \u00fd:<\/strong> B\u1ea1n n\u00e0o ch\u01b0a bi\u1ebft Markdown l\u00e0 g\u00ec c\u00f3 th\u1ec3 t\u00ecm hi\u1ec3u th\u00eam t\u1ea1i \u0111\u00e2y<\/p>\n<\/p>\n B\u1ea1n c\u0169ng nh\u1ea5n n\u00fat Run cell ho\u1eb7c nh\u1ea5n Ctrl + Enter \u0111\u1ec3 xem k\u1ebft qu\u1ea3.<\/p>\n Xem th\u00eam: H\u01b0\u1edbng D\u1eabn S\u1eed D\u1ee5ng M\u00e1y \u0110o \u0110\u01b0\u1eddng Huy\u1ebft Onetouch Ultra 2, M\u00e1y \u0110o \u0110\u01b0\u1eddng Huy\u1ebft One Touch Ultra 2<\/a><\/p>\n<\/p>\n \u0110o\u1ea1n Markdown c\u1ee7a b\u1ea1n v\u1eeba \u0111\u01b0\u1ee3c thay th\u1ebf b\u1eb1ng m\u1ed9t \u0111o\u1ea1n v\u0103n b\u1ea3n c\u00f3 \u0111\u1ecbnh d\u1ea1ng tuy\u1ec7t \u0111\u1eb9p ph\u1ea3i kh\u00f4ng n\u00e0o. B\u1ea1n c\u00f3 th\u1ec3 t\u00ecm hi\u1ec3u th\u00eam v\u1ec1 \u0111\u1ecbnh d\u1ea1ng \/ c\u00fa ph\u00e1p c\u1ee7a Markdown t\u1ea1i \u0111\u00e2y<\/p>\n N\u1ebfu b\u1ea1n mu\u1ed1n ch\u1ec9nh s\u1eeda \u0111o\u1ea1n Markdown v\u1eeba ch\u1ea1y th\u00ec ch\u1ec9 vi\u1ec7c click v\u00e0o k\u1ebft qu\u1ea3 v\u1eeba xu\u1ea5t hi\u1ec7n v\u00e0 b\u1ea1n s\u1ebd \u0111\u01b0\u1ee3c chuy\u1ec3n sang ch\u1ebf \u0111\u1ed9 ch\u1ec9nh s\u1eeda.<\/p>\n B\u1ea1n c\u00f3 th\u1ec3 tham kh\u1ea3o b\u1ea3ng c\u00e1c ph\u00edm t\u1eaft \u0111\u1ec3 c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng Jupyter notebook m\u1ed9t c\u00e1ch linh ho\u1ea1t v\u00e0 nhanh h\u01a1n. N\u00f3i n\u00f4m na l\u00e0 kh\u00f4ng c\u1ea7n d\u00f9ng \u0111\u1ebfn chu\u1ed9t \u0111\u1ea5y.<\/p>\n<\/p>\n 4. Checkpoints<\/strong><\/p>\n M\u1ed9t trong nh\u1eefng ch\u1ee9c n\u0103ng c\u1ef1c hay c\u1ee7a Jupyter Notebook l\u00e0 Checkpoints. B\u1eb1ng c\u00e1ch t\u1ea1o c\u00e1c Checkpoints l\u01b0u tr\u1ea1ng th\u00e1i hi\u1ec7n t\u1ea1i c\u1ee7a notebook, Jupyter Notebook cho ph\u00e9p b\u1ea1n c\u00f3 th\u1ec3 quay l\u1ea1i th\u1eddi \u0111i\u1ec3m t\u1ea1o Checkpoints \u0111\u1ec3 ki\u1ec3m tra ho\u1eb7c ho\u00e0n t\u00e1c tr\u01b0\u1edbc \u0111\u00f3.<\/p>\n \u0110\u1ec3 t\u1ea1o Checkpoint, ch\u1ecdn File -> Save<\/em> and Checkpoint<\/em>. N\u1ebfu b\u1ea1n mu\u1ed1n xem l\u1ea1i c\u00e1c Checkpoints tr\u01b0\u1edbc \u0111\u00f3 th\u00ec ch\u1ecdn File -> Revert to Checkpoint<\/em>.<\/p>\n