[云炬python3玩转机器学习笔记] 3-2 Jupter Notebook魔法命令
生活随笔
收集整理的這篇文章主要介紹了
[云炬python3玩转机器学习笔记] 3-2 Jupter Notebook魔法命令
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
?
xxxxxxxxxx### %run %run? In [1]:%run myscript/hello.py hello Machine Learning ! . . .In [2]:xxxxxxxxxxhello("天劍云炬網絡科技有限公司") hello 天劍云炬網絡科技有限公司 ! . . .In [3]:xxxxxxxxxximport mymodule.FirstML . . .In [4]:xxxxxxxxxxmymodule.FirstML.predict(1) ? . . .In [5]:xxxxxxxxxxfrom mymodule import FirstML ? FirstML.predict(2) ? . . .xxxxxxxxxx### %timeit %timeit? In [6]:x %timeit L=[i**2 for i in range(1000)] 492 μs ± 62 μs per loop (mean ± std. dev. of 7 runs, 1000 loops each) . . .In [7]:x %timeit L=[i**2 for i in range(1000000)] 561 ms ± 87.9 ms per loop (mean ± std. dev. of 7 runs, 1 loop each) . . .In [8]:xxxxxxxxxx%timeit L=[i**2 for i in range(10)] 4.89 μs ± 711 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each) . . .In [9]:x %%timeit L = [] for n in range(1000):L.append(n ** 2) 532 μs ± 53.6 μs per loop (mean ± std. dev. of 7 runs, 1000 loops each) . . .xxxxxxxxxx### %time %time? In [10]:%time L=[i**2 for i in range(1000)] Wall time: 1 ms . . .In [11]:%%time L = [] for n in range(1000):L.append(n ** 2) Wall time: 1 ms . . .In [12]:ximport random L= [random.random() for i in range(100000)] %timeit L.sort() 1.05 ms ± 141 μs per loop (mean ± std. dev. of 7 runs, 1000 loops each) . . .In [13]:x import random L= [random.random() for i in range(100000)] %time L.sort() Wall time: 26 ms . . .In [14]:%time L.sort() Wall time: 3 ms . . .xxxxxxxxxx### 其他魔法命令 其他魔法命令? In [15]:%lsmagic Out[15]:Available line magics: %alias %alias_magic %autoawait %autocall %automagic %autosave %bookmark %cd %clear %cls %colors %conda %config %connect_info %copy %ddir %debug %dhist %dirs %doctest_mode %echo %ed %edit %env %gui %hist %history %killbgscripts %ldir %less %load %load_ext %loadpy %logoff %logon %logstart %logstate %logstop %ls %lsmagic %macro %magic %matplotlib %mkdir %more %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 %ren %rep %rerun %reset %reset_selective %rmdir %run %save %sc %set_env %store %sx %system %tb %time %timeit %unalias %unload_ext %who %who_ls %whos %xdel %xmodeAvailable cell magics: %%! %%HTML %%SVG %%bash %%capture %%cmd %%debug %%file %%html %%javascript %%js %%latex %%markdown %%perl %%prun %%pypy %%python %%python2 %%python3 %%ruby %%script %%sh %%svg %%sx %%system %%time %%timeit %%writefileAutomagic is ON, % prefix IS NOT needed for line magics. . . .In [16]:xxxxxxxxxx%run? . . .In [ ]:? . . .?
總結
以上是生活随笔為你收集整理的[云炬python3玩转机器学习笔记] 3-2 Jupter Notebook魔法命令的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 经典面试题(19):以下代码将输出的结果
- 下一篇: web前端 如何入门人工智能算法