You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

3-ipython_notebook.ipynb 13 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  1. {
  2. "cells": [
  3. {
  4. "cell_type": "markdown",
  5. "metadata": {},
  6. "source": [
  7. "# 介绍IPython和Jupyter笔记本"
  8. ]
  9. },
  10. {
  11. "cell_type": "code",
  12. "execution_count": 3,
  13. "metadata": {
  14. "podoc": {
  15. "output_text": "Screenshot of a Jupyter notebook"
  16. }
  17. },
  18. "outputs": [
  19. {
  20. "name": "stdout",
  21. "output_type": "stream",
  22. "text": [
  23. "Hello world!\n"
  24. ]
  25. }
  26. ],
  27. "source": [
  28. "print(\"Hello world!\")"
  29. ]
  30. },
  31. {
  32. "cell_type": "code",
  33. "execution_count": 4,
  34. "metadata": {},
  35. "outputs": [
  36. {
  37. "data": {
  38. "text/plain": [
  39. "4"
  40. ]
  41. },
  42. "execution_count": 4,
  43. "metadata": {},
  44. "output_type": "execute_result"
  45. }
  46. ],
  47. "source": [
  48. "2 + 2"
  49. ]
  50. },
  51. {
  52. "cell_type": "code",
  53. "execution_count": 5,
  54. "metadata": {},
  55. "outputs": [
  56. {
  57. "data": {
  58. "text/plain": [
  59. "12"
  60. ]
  61. },
  62. "execution_count": 5,
  63. "metadata": {},
  64. "output_type": "execute_result"
  65. }
  66. ],
  67. "source": [
  68. "_ * 3"
  69. ]
  70. },
  71. {
  72. "cell_type": "code",
  73. "execution_count": 6,
  74. "metadata": {},
  75. "outputs": [
  76. {
  77. "name": "stdout",
  78. "output_type": "stream",
  79. "text": [
  80. "1-numpy_tutorial_EN.ipynb\texample.png\r\n",
  81. "1-numpy_tutorial.ipynb\t\tmatplotlib_ani.ipynb\r\n",
  82. "2-matplotlib_tutorial_EN.ipynb\tmatplotlib_full.ipynb\r\n",
  83. "2-matplotlib_tutorial.ipynb\trandom-matrix.csv\r\n",
  84. "3-ipython_notebook_EN.ipynb\trandom-matrix.npy\r\n",
  85. "3-ipython_notebook.ipynb\tREADME.md\r\n",
  86. "4-scipy_tutorial_EN.ipynb\tstockholm_td_adj.dat\r\n",
  87. "4-scipy_tutorial.ipynb\t\tutils_git_advanced.ipynb\r\n",
  88. "5-sympy_tutorial_EN.ipynb\tutils_git.ipynb\r\n",
  89. "5-sympy_tutorial.ipynb\t\tutils_shell.ipynb\r\n",
  90. "bokeh_tutorial.ipynb\r\n"
  91. ]
  92. }
  93. ],
  94. "source": [
  95. "!ls"
  96. ]
  97. },
  98. {
  99. "cell_type": "code",
  100. "execution_count": 7,
  101. "metadata": {},
  102. "outputs": [
  103. {
  104. "data": {
  105. "application/json": {
  106. "cell": {
  107. "!": "OSMagics",
  108. "HTML": "Other",
  109. "SVG": "Other",
  110. "bash": "Other",
  111. "capture": "ExecutionMagics",
  112. "debug": "ExecutionMagics",
  113. "file": "Other",
  114. "html": "DisplayMagics",
  115. "javascript": "DisplayMagics",
  116. "js": "DisplayMagics",
  117. "latex": "DisplayMagics",
  118. "markdown": "DisplayMagics",
  119. "perl": "Other",
  120. "prun": "ExecutionMagics",
  121. "pypy": "Other",
  122. "python": "Other",
  123. "python2": "Other",
  124. "python3": "Other",
  125. "ruby": "Other",
  126. "script": "ScriptMagics",
  127. "sh": "Other",
  128. "svg": "DisplayMagics",
  129. "sx": "OSMagics",
  130. "system": "OSMagics",
  131. "time": "ExecutionMagics",
  132. "timeit": "ExecutionMagics",
  133. "writefile": "OSMagics"
  134. },
  135. "line": {
  136. "alias": "OSMagics",
  137. "alias_magic": "BasicMagics",
  138. "autoawait": "AsyncMagics",
  139. "autocall": "AutoMagics",
  140. "automagic": "AutoMagics",
  141. "autosave": "KernelMagics",
  142. "bookmark": "OSMagics",
  143. "cat": "Other",
  144. "cd": "OSMagics",
  145. "clear": "KernelMagics",
  146. "colors": "BasicMagics",
  147. "conda": "PackagingMagics",
  148. "config": "ConfigMagics",
  149. "connect_info": "KernelMagics",
  150. "cp": "Other",
  151. "debug": "ExecutionMagics",
  152. "dhist": "OSMagics",
  153. "dirs": "OSMagics",
  154. "doctest_mode": "BasicMagics",
  155. "ed": "Other",
  156. "edit": "KernelMagics",
  157. "env": "OSMagics",
  158. "gui": "BasicMagics",
  159. "hist": "Other",
  160. "history": "HistoryMagics",
  161. "killbgscripts": "ScriptMagics",
  162. "ldir": "Other",
  163. "less": "KernelMagics",
  164. "lf": "Other",
  165. "lk": "Other",
  166. "ll": "Other",
  167. "load": "CodeMagics",
  168. "load_ext": "ExtensionMagics",
  169. "loadpy": "CodeMagics",
  170. "logoff": "LoggingMagics",
  171. "logon": "LoggingMagics",
  172. "logstart": "LoggingMagics",
  173. "logstate": "LoggingMagics",
  174. "logstop": "LoggingMagics",
  175. "ls": "Other",
  176. "lsmagic": "BasicMagics",
  177. "lx": "Other",
  178. "macro": "ExecutionMagics",
  179. "magic": "BasicMagics",
  180. "man": "KernelMagics",
  181. "matplotlib": "PylabMagics",
  182. "mkdir": "Other",
  183. "more": "KernelMagics",
  184. "mv": "Other",
  185. "notebook": "BasicMagics",
  186. "page": "BasicMagics",
  187. "pastebin": "CodeMagics",
  188. "pdb": "ExecutionMagics",
  189. "pdef": "NamespaceMagics",
  190. "pdoc": "NamespaceMagics",
  191. "pfile": "NamespaceMagics",
  192. "pinfo": "NamespaceMagics",
  193. "pinfo2": "NamespaceMagics",
  194. "pip": "PackagingMagics",
  195. "popd": "OSMagics",
  196. "pprint": "BasicMagics",
  197. "precision": "BasicMagics",
  198. "prun": "ExecutionMagics",
  199. "psearch": "NamespaceMagics",
  200. "psource": "NamespaceMagics",
  201. "pushd": "OSMagics",
  202. "pwd": "OSMagics",
  203. "pycat": "OSMagics",
  204. "pylab": "PylabMagics",
  205. "qtconsole": "KernelMagics",
  206. "quickref": "BasicMagics",
  207. "recall": "HistoryMagics",
  208. "rehashx": "OSMagics",
  209. "reload_ext": "ExtensionMagics",
  210. "rep": "Other",
  211. "rerun": "HistoryMagics",
  212. "reset": "NamespaceMagics",
  213. "reset_selective": "NamespaceMagics",
  214. "rm": "Other",
  215. "rmdir": "Other",
  216. "run": "ExecutionMagics",
  217. "save": "CodeMagics",
  218. "sc": "OSMagics",
  219. "set_env": "OSMagics",
  220. "store": "StoreMagics",
  221. "sx": "OSMagics",
  222. "system": "OSMagics",
  223. "tb": "ExecutionMagics",
  224. "time": "ExecutionMagics",
  225. "timeit": "ExecutionMagics",
  226. "unalias": "OSMagics",
  227. "unload_ext": "ExtensionMagics",
  228. "who": "NamespaceMagics",
  229. "who_ls": "NamespaceMagics",
  230. "whos": "NamespaceMagics",
  231. "xdel": "NamespaceMagics",
  232. "xmode": "BasicMagics"
  233. }
  234. },
  235. "text/plain": [
  236. "Available line magics:\n",
  237. "%alias %alias_magic %autoawait %autocall %automagic %autosave %bookmark %cat %cd %clear %colors %conda %config %connect_info %cp %debug %dhist %dirs %doctest_mode %ed %edit %env %gui %hist %history %killbgscripts %ldir %less %lf %lk %ll %load %load_ext %loadpy %logoff %logon %logstart %logstate %logstop %ls %lsmagic %lx %macro %magic %man %matplotlib %mkdir %more %mv %notebook %page %pastebin %pdb %pdef %pdoc %pfile %pinfo %pinfo2 %pip %popd %pprint %precision %prun %psearch %psource %pushd %pwd %pycat %pylab %qtconsole %quickref %recall %rehashx %reload_ext %rep %rerun %reset %reset_selective %rm %rmdir %run %save %sc %set_env %store %sx %system %tb %time %timeit %unalias %unload_ext %who %who_ls %whos %xdel %xmode\n",
  238. "\n",
  239. "Available cell magics:\n",
  240. "%%! %%HTML %%SVG %%bash %%capture %%debug %%file %%html %%javascript %%js %%latex %%markdown %%perl %%prun %%pypy %%python %%python2 %%python3 %%ruby %%script %%sh %%svg %%sx %%system %%time %%timeit %%writefile\n",
  241. "\n",
  242. "Automagic is ON, % prefix IS NOT needed for line magics."
  243. ]
  244. },
  245. "execution_count": 7,
  246. "metadata": {},
  247. "output_type": "execute_result"
  248. }
  249. ],
  250. "source": [
  251. "%lsmagic"
  252. ]
  253. },
  254. {
  255. "cell_type": "code",
  256. "execution_count": 8,
  257. "metadata": {},
  258. "outputs": [
  259. {
  260. "name": "stdout",
  261. "output_type": "stream",
  262. "text": [
  263. "Writing test.txt\n"
  264. ]
  265. }
  266. ],
  267. "source": [
  268. "%%writefile test.txt\n",
  269. "Hello world!"
  270. ]
  271. },
  272. {
  273. "cell_type": "code",
  274. "execution_count": 9,
  275. "metadata": {},
  276. "outputs": [
  277. {
  278. "name": "stdout",
  279. "output_type": "stream",
  280. "text": [
  281. "Hello world!\n",
  282. "\n"
  283. ]
  284. }
  285. ],
  286. "source": [
  287. "# Let's check what this file contains.\n",
  288. "with open('test.txt', 'r') as f:\n",
  289. " print(f.read())"
  290. ]
  291. },
  292. {
  293. "cell_type": "code",
  294. "execution_count": 10,
  295. "metadata": {
  296. "podoc": {
  297. "output_text": "Screenshot of the pager"
  298. }
  299. },
  300. "outputs": [],
  301. "source": [
  302. "%run?"
  303. ]
  304. },
  305. {
  306. "cell_type": "code",
  307. "execution_count": 11,
  308. "metadata": {},
  309. "outputs": [],
  310. "source": [
  311. "from IPython.display import HTML, SVG, YouTubeVideo"
  312. ]
  313. },
  314. {
  315. "cell_type": "code",
  316. "execution_count": 12,
  317. "metadata": {
  318. "podoc": {
  319. "output_text": "<IPython.core.display.HTML object>"
  320. }
  321. },
  322. "outputs": [
  323. {
  324. "data": {
  325. "text/html": [
  326. "\n",
  327. "<table style=\"border: 2px solid black;\">\n",
  328. "<tr><td>0,0</td><td>0,1</td><td>0,2</td><td>0,3</td><td>0,4</td></tr><tr><td>1,0</td><td>1,1</td><td>1,2</td><td>1,3</td><td>1,4</td></tr><tr><td>2,0</td><td>2,1</td><td>2,2</td><td>2,3</td><td>2,4</td></tr><tr><td>3,0</td><td>3,1</td><td>3,2</td><td>3,3</td><td>3,4</td></tr><tr><td>4,0</td><td>4,1</td><td>4,2</td><td>4,3</td><td>4,4</td></tr>\n",
  329. "</table>\n"
  330. ],
  331. "text/plain": [
  332. "<IPython.core.display.HTML object>"
  333. ]
  334. },
  335. "execution_count": 12,
  336. "metadata": {},
  337. "output_type": "execute_result"
  338. }
  339. ],
  340. "source": [
  341. "HTML('''\n",
  342. "<table style=\"border: 2px solid black;\">\n",
  343. "''' +\n",
  344. " ''.join(['<tr>' +\n",
  345. " ''.join([f'<td>{row},{col}</td>'\n",
  346. " for col in range(5)]) +\n",
  347. " '</tr>' for row in range(5)]) +\n",
  348. " '''\n",
  349. "</table>\n",
  350. "''')"
  351. ]
  352. },
  353. {
  354. "cell_type": "code",
  355. "execution_count": 13,
  356. "metadata": {
  357. "podoc": {
  358. "output_text": "<IPython.core.display.SVG object>"
  359. }
  360. },
  361. "outputs": [
  362. {
  363. "data": {
  364. "image/svg+xml": [
  365. "<svg height=\"80\" width=\"600\"><circle cx=\"300\" cy=\"30\" fill=\"red\" r=\"0.0\" stroke=\"black\" stroke-width=\"2\">\n",
  366. " </circle><circle cx=\"297\" cy=\"30\" fill=\"red\" r=\"3.0\" stroke=\"black\" stroke-width=\"2\">\n",
  367. " </circle><circle cx=\"288\" cy=\"30\" fill=\"red\" r=\"6.0\" stroke=\"black\" stroke-width=\"2\">\n",
  368. " </circle><circle cx=\"273\" cy=\"30\" fill=\"red\" r=\"9.0\" stroke=\"black\" stroke-width=\"2\">\n",
  369. " </circle><circle cx=\"252\" cy=\"30\" fill=\"red\" r=\"12.0\" stroke=\"black\" stroke-width=\"2\">\n",
  370. " </circle><circle cx=\"225\" cy=\"30\" fill=\"red\" r=\"15.0\" stroke=\"black\" stroke-width=\"2\">\n",
  371. " </circle><circle cx=\"192\" cy=\"30\" fill=\"red\" r=\"18.0\" stroke=\"black\" stroke-width=\"2\">\n",
  372. " </circle><circle cx=\"153\" cy=\"30\" fill=\"red\" r=\"21.0\" stroke=\"black\" stroke-width=\"2\">\n",
  373. " </circle><circle cx=\"108\" cy=\"30\" fill=\"red\" r=\"24.0\" stroke=\"black\" stroke-width=\"2\">\n",
  374. " </circle><circle cx=\"57\" cy=\"30\" fill=\"red\" r=\"27.0\" stroke=\"black\" stroke-width=\"2\">\n",
  375. " </circle></svg>"
  376. ],
  377. "text/plain": [
  378. "<IPython.core.display.SVG object>"
  379. ]
  380. },
  381. "execution_count": 13,
  382. "metadata": {},
  383. "output_type": "execute_result"
  384. }
  385. ],
  386. "source": [
  387. "SVG('''<svg width=\"600\" height=\"80\">''' +\n",
  388. " ''.join([f'''<circle\n",
  389. " cx=\"{(30 + 3*i) * (10 - i)}\"\n",
  390. " cy=\"30\"\n",
  391. " r=\"{3. * float(i)}\"\n",
  392. " fill=\"red\"\n",
  393. " stroke-width=\"2\"\n",
  394. " stroke=\"black\">\n",
  395. " </circle>''' for i in range(10)]) +\n",
  396. " '''</svg>''')"
  397. ]
  398. },
  399. {
  400. "cell_type": "code",
  401. "execution_count": null,
  402. "metadata": {
  403. "podoc": {
  404. "output_text": "<IPython.lib.display.YouTubeVideo at 0x7fc0000b64a8>"
  405. }
  406. },
  407. "outputs": [],
  408. "source": [
  409. "YouTubeVideo('VQBZ2MqWBZI')"
  410. ]
  411. },
  412. {
  413. "cell_type": "markdown",
  414. "metadata": {},
  415. "source": [
  416. "```json\n",
  417. "{\n",
  418. " \"cells\": [\n",
  419. " {\n",
  420. " \"cell_type\": \"code\",\n",
  421. " \"execution_count\": 1,\n",
  422. " \"metadata\": {},\n",
  423. " \"outputs\": [\n",
  424. " {\n",
  425. " \"name\": \"stdout\",\n",
  426. " \"output_type\": \"stream\",\n",
  427. " \"text\": [\n",
  428. " \"Hello world!\\n\"\n",
  429. " ]\n",
  430. " }\n",
  431. " ],\n",
  432. " \"source\": [\n",
  433. " \"print(\\\"Hello world!\\\")\"\n",
  434. " ]\n",
  435. " }\n",
  436. " ],\n",
  437. " \"metadata\": {},\n",
  438. " \"nbformat\": 4,\n",
  439. " \"nbformat_minor\": 2\n",
  440. "}\n",
  441. "```"
  442. ]
  443. }
  444. ],
  445. "metadata": {
  446. "kernelspec": {
  447. "display_name": "Python 3",
  448. "language": "python",
  449. "name": "python3"
  450. },
  451. "language_info": {
  452. "codemirror_mode": {
  453. "name": "ipython",
  454. "version": 3
  455. },
  456. "file_extension": ".py",
  457. "mimetype": "text/x-python",
  458. "name": "python",
  459. "nbconvert_exporter": "python",
  460. "pygments_lexer": "ipython3",
  461. "version": "3.6.9"
  462. }
  463. },
  464. "nbformat": 4,
  465. "nbformat_minor": 2
  466. }

机器学习越来越多应用到飞行器、机器人等领域,其目的是利用计算机实现类似人类的智能,从而实现装备的智能化与无人化。本课程旨在引导学生掌握机器学习的基本知识、典型方法与技术,通过具体的应用案例激发学生对该学科的兴趣,鼓励学生能够从人工智能的角度来分析、解决飞行器、机器人所面临的问题和挑战。本课程主要内容包括Python编程基础,机器学习模型,无监督学习、监督学习、深度学习基础知识与实现,并学习如何利用机器学习解决实际问题,从而全面提升自我的《综合能力》。