Offset 1, 5 lines modified | Offset 1, 5 lines modified | ||
1 | · | 1 | ·fc7a7773bdef97b5acf129b6d6cd42d7·5813900·doc·optional·python-numpy-doc_2.2.4+ds-1_all.deb |
2 | ·bcf02a7b158e3fd72ac0ca631097dbbe·14380220·debug·optional·python3-numpy-dbgsym_2.2.4+ds-1_arm64.deb | 2 | ·bcf02a7b158e3fd72ac0ca631097dbbe·14380220·debug·optional·python3-numpy-dbgsym_2.2.4+ds-1_arm64.deb |
3 | ·3a5b3ecec4a4b617987f388521dd977f·136096·python·optional·python3-numpy-dev_2.2.4+ds-1_arm64.deb | 3 | ·3a5b3ecec4a4b617987f388521dd977f·136096·python·optional·python3-numpy-dev_2.2.4+ds-1_arm64.deb |
4 | ·c5979eb908a4d2251ef0d8267822664e·3604888·python·optional·python3-numpy_2.2.4+ds-1_arm64.deb | 4 | ·c5979eb908a4d2251ef0d8267822664e·3604888·python·optional·python3-numpy_2.2.4+ds-1_arm64.deb |
Offset 1, 3 lines modified | Offset 1, 3 lines modified | ||
1 | -rw-r--r--···0········0········0········4·2025-04-01·19:45:23.000000·debian-binary | 1 | -rw-r--r--···0········0········0········4·2025-04-01·19:45:23.000000·debian-binary |
2 | -rw-r--r--···0········0········0····6488 | 2 | -rw-r--r--···0········0········0····64884·2025-04-01·19:45:23.000000·control.tar.xz |
3 | -rw-r--r--···0········0········0··5748 | 3 | -rw-r--r--···0········0········0··5748824·2025-04-01·19:45:23.000000·data.tar.xz |
Offset 2755, 15 lines modified | Offset 2755, 15 lines modified | ||
2755 | -rw-r--r--···0·root·········(0)·root·········(0)····31655·2025-04-01·19:45:23.000000·./usr/share/doc/python-numpy/html/release/2.2.1-notes.html | 2755 | -rw-r--r--···0·root·········(0)·root·········(0)····31655·2025-04-01·19:45:23.000000·./usr/share/doc/python-numpy/html/release/2.2.1-notes.html |
2756 | -rw-r--r--···0·root·········(0)·root·········(0)····32348·2025-04-01·19:45:23.000000·./usr/share/doc/python-numpy/html/release/2.2.2-notes.html | 2756 | -rw-r--r--···0·root·········(0)·root·········(0)····32348·2025-04-01·19:45:23.000000·./usr/share/doc/python-numpy/html/release/2.2.2-notes.html |
2757 | -rw-r--r--···0·root·········(0)·root·········(0)····32865·2025-04-01·19:45:23.000000·./usr/share/doc/python-numpy/html/release/2.2.3-notes.html | 2757 | -rw-r--r--···0·root·········(0)·root·········(0)····32865·2025-04-01·19:45:23.000000·./usr/share/doc/python-numpy/html/release/2.2.3-notes.html |
2758 | -rw-r--r--···0·root·········(0)·root·········(0)····32016·2025-04-01·19:45:23.000000·./usr/share/doc/python-numpy/html/release/2.2.4-notes.html | 2758 | -rw-r--r--···0·root·········(0)·root·········(0)····32016·2025-04-01·19:45:23.000000·./usr/share/doc/python-numpy/html/release/2.2.4-notes.html |
2759 | -rw-r--r--···0·root·········(0)·root·········(0)····13407·2025-04-01·19:45:23.000000·./usr/share/doc/python-numpy/html/release/template.html | 2759 | -rw-r--r--···0·root·········(0)·root·········(0)····13407·2025-04-01·19:45:23.000000·./usr/share/doc/python-numpy/html/release/template.html |
2760 | -rw-r--r--···0·root·········(0)·root·········(0)····90990·2025-04-01·19:45:23.000000·./usr/share/doc/python-numpy/html/release.html | 2760 | -rw-r--r--···0·root·········(0)·root·········(0)····90990·2025-04-01·19:45:23.000000·./usr/share/doc/python-numpy/html/release.html |
2761 | -rw-r--r--···0·root·········(0)·root·········(0)····12397·2025-04-01·19:45:23.000000·./usr/share/doc/python-numpy/html/search.html | 2761 | -rw-r--r--···0·root·········(0)·root·········(0)····12397·2025-04-01·19:45:23.000000·./usr/share/doc/python-numpy/html/search.html |
2762 | -rw-r--r--···0·root·········(0)·root·········(0)··268792 | 2762 | -rw-r--r--···0·root·········(0)·root·········(0)··2687926·2025-04-01·19:45:23.000000·./usr/share/doc/python-numpy/html/searchindex.js |
2763 | drwxr-xr-x···0·root·········(0)·root·········(0)········0·2025-04-01·19:45:23.000000·./usr/share/doc/python-numpy/html/user/ | 2763 | drwxr-xr-x···0·root·········(0)·root·········(0)········0·2025-04-01·19:45:23.000000·./usr/share/doc/python-numpy/html/user/ |
2764 | -rw-r--r--···0·root·········(0)·root·········(0)···177614·2025-04-01·19:45:23.000000·./usr/share/doc/python-numpy/html/user/absolute_beginners.html | 2764 | -rw-r--r--···0·root·········(0)·root·········(0)···177614·2025-04-01·19:45:23.000000·./usr/share/doc/python-numpy/html/user/absolute_beginners.html |
2765 | -rw-r--r--···0·root·········(0)·root·········(0)····50529·2025-04-01·19:45:23.000000·./usr/share/doc/python-numpy/html/user/basics.broadcasting.html | 2765 | -rw-r--r--···0·root·········(0)·root·········(0)····50529·2025-04-01·19:45:23.000000·./usr/share/doc/python-numpy/html/user/basics.broadcasting.html |
2766 | -rw-r--r--···0·root·········(0)·root·········(0)····33464·2025-04-01·19:45:23.000000·./usr/share/doc/python-numpy/html/user/basics.copies.html | 2766 | -rw-r--r--···0·root·········(0)·root·········(0)····33464·2025-04-01·19:45:23.000000·./usr/share/doc/python-numpy/html/user/basics.copies.html |
2767 | -rw-r--r--···0·root·········(0)·root·········(0)····64100·2025-04-01·19:45:23.000000·./usr/share/doc/python-numpy/html/user/basics.creation.html | 2767 | -rw-r--r--···0·root·········(0)·root·········(0)····64100·2025-04-01·19:45:23.000000·./usr/share/doc/python-numpy/html/user/basics.creation.html |
2768 | -rw-r--r--···0·root·········(0)·root·········(0)····65763·2025-04-01·19:45:23.000000·./usr/share/doc/python-numpy/html/user/basics.dispatch.html | 2768 | -rw-r--r--···0·root·········(0)·root·········(0)····65763·2025-04-01·19:45:23.000000·./usr/share/doc/python-numpy/html/user/basics.dispatch.html |
2769 | -rw-r--r--···0·root·········(0)·root·········(0)····18746·2025-04-01·19:45:23.000000·./usr/share/doc/python-numpy/html/user/basics.html | 2769 | -rw-r--r--···0·root·········(0)·root·········(0)····18746·2025-04-01·19:45:23.000000·./usr/share/doc/python-numpy/html/user/basics.html |
Offset 536, 30 lines modified | Offset 536, 30 lines modified | ||
536 | <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[1]:·</span><span·class="kn">import</span>·<span·class="nn">numpy.random</span> | 536 | <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[1]:·</span><span·class="kn">import</span>·<span·class="nn">numpy.random</span> |
537 | <span·class="gp">In·[2]:·</span><span·class="n">rng</span>·<span·class="o">=</span>·<span·class="n">np</span><span·class="o">.</span><span·class="n">random</span><span·class="o">.</span><span·class="n">default_rng</span><span·class="p">()</span> | 537 | <span·class="gp">In·[2]:·</span><span·class="n">rng</span>·<span·class="o">=</span>·<span·class="n">np</span><span·class="o">.</span><span·class="n">random</span><span·class="o">.</span><span·class="n">default_rng</span><span·class="p">()</span> |
538 | <span·class="gp">In·[3]:·</span><span·class="o">%</span><span·class="k">timeit</span>·-n·1·rng.standard_normal(100000) | 538 | <span·class="gp">In·[3]:·</span><span·class="o">%</span><span·class="k">timeit</span>·-n·1·rng.standard_normal(100000) |
539 | <span·class="gp">···...:·</span><span·class="o">%</span><span·class="k">timeit</span>·-n·1·numpy.random.standard_normal(100000) | 539 | <span·class="gp">···...:·</span><span·class="o">%</span><span·class="k">timeit</span>·-n·1·numpy.random.standard_normal(100000) |
540 | <span·class="gp">···...:·</span> | 540 | <span·class="gp">···...:·</span> |
541 | <span·class="go">1.02·ms·+-· | 541 | <span·class="go">1.02·ms·+-·38.2·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·1·loop·each)</span> |
542 | <span·class="go">2.5 | 542 | <span·class="go">2.53·ms·+-·20.8·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·1·loop·each)</span> |
543 | </pre></div> | 543 | </pre></div> |
544 | </div> | 544 | </div> |
545 | <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[4]:·</span><span·class="o">%</span><span·class="k">timeit</span>·-n·1·rng.standard_exponential(100000) | 545 | <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[4]:·</span><span·class="o">%</span><span·class="k">timeit</span>·-n·1·rng.standard_exponential(100000) |
546 | <span·class="gp">···...:·</span><span·class="o">%</span><span·class="k">timeit</span>·-n·1·numpy.random.standard_exponential(100000) | 546 | <span·class="gp">···...:·</span><span·class="o">%</span><span·class="k">timeit</span>·-n·1·numpy.random.standard_exponential(100000) |
547 | <span·class="gp">···...:·</span> | 547 | <span·class="gp">···...:·</span> |
548 | <span·class="go">9 | 548 | <span·class="go">919·us·+-·57.7·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·1·loop·each)</span> |
549 | <span·class="go">1. | 549 | <span·class="go">1.88·ms·+-·15.4·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·1·loop·each)</span> |
550 | </pre></div> | 550 | </pre></div> |
551 | </div> | 551 | </div> |
552 | <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[5]:·</span><span·class="o">%</span><span·class="k">timeit</span>·-n·1·rng.standard_gamma(3.0,·100000) | 552 | <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[5]:·</span><span·class="o">%</span><span·class="k">timeit</span>·-n·1·rng.standard_gamma(3.0,·100000) |
553 | <span·class="gp">···...:·</span><span·class="o">%</span><span·class="k">timeit</span>·-n·1·numpy.random.standard_gamma(3.0,·100000) | 553 | <span·class="gp">···...:·</span><span·class="o">%</span><span·class="k">timeit</span>·-n·1·numpy.random.standard_gamma(3.0,·100000) |
554 | <span·class="gp">···...:·</span> | 554 | <span·class="gp">···...:·</span> |
555 | <span·class="go">2.46·ms·+-·1 | 555 | <span·class="go">2.46·ms·+-·17.3·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·1·loop·each)</span> |
556 | <span·class="go">4.47·ms·+-·1 | 556 | <span·class="go">4.47·ms·+-·16.8·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·1·loop·each)</span> |
557 | </pre></div> | 557 | </pre></div> |
558 | </div> | 558 | </div> |
559 | <ul·class="simple"> | 559 | <ul·class="simple"> |
560 | <li><p><a·class="reference·internal"·href="generated/numpy.random.Generator.integers.html#numpy.random.Generator.integers"·title="numpy.random.Generator.integers"><code·class="xref·py·py-obj·docutils·literal·notranslate"><span·class="pre">integers</span></code></a>·is·now·the·canonical·way·to·generate·integer | 560 | <li><p><a·class="reference·internal"·href="generated/numpy.random.Generator.integers.html#numpy.random.Generator.integers"·title="numpy.random.Generator.integers"><code·class="xref·py·py-obj·docutils·literal·notranslate"><span·class="pre">integers</span></code></a>·is·now·the·canonical·way·to·generate·integer |
561 | random·numbers·from·a·discrete·uniform·distribution.·This·replaces·both | 561 | random·numbers·from·a·discrete·uniform·distribution.·This·replaces·both |
562 | <a·class="reference·internal"·href="generated/numpy.random.randint.html#numpy.random.randint"·title="numpy.random.randint"><code·class="xref·py·py-obj·docutils·literal·notranslate"><span·class="pre">randint</span></code></a>·and·the·deprecated·<a·class="reference·internal"·href="generated/numpy.random.random_integers.html#numpy.random.random_integers"·title="numpy.random.random_integers"><code·class="xref·py·py-obj·docutils·literal·notranslate"><span·class="pre">random_integers</span></code></a>.</p></li> | 562 | <a·class="reference·internal"·href="generated/numpy.random.randint.html#numpy.random.randint"·title="numpy.random.randint"><code·class="xref·py·py-obj·docutils·literal·notranslate"><span·class="pre">randint</span></code></a>·and·the·deprecated·<a·class="reference·internal"·href="generated/numpy.random.random_integers.html#numpy.random.random_integers"·title="numpy.random.random_integers"><code·class="xref·py·py-obj·docutils·literal·notranslate"><span·class="pre">random_integers</span></code></a>.</p></li> |
563 | <li><p>The·<a·class="reference·internal"·href="generated/numpy.random.rand.html#numpy.random.rand"·title="numpy.random.rand"><code·class="xref·py·py-obj·docutils·literal·notranslate"><span·class="pre">rand</span></code></a>·and·<a·class="reference·internal"·href="generated/numpy.random.randn.html#numpy.random.randn"·title="numpy.random.randn"><code·class="xref·py·py-obj·docutils·literal·notranslate"><span·class="pre">randn</span></code></a>·methods·are·only·available·through·the·legacy | 563 | <li><p>The·<a·class="reference·internal"·href="generated/numpy.random.rand.html#numpy.random.rand"·title="numpy.random.rand"><code·class="xref·py·py-obj·docutils·literal·notranslate"><span·class="pre">rand</span></code></a>·and·<a·class="reference·internal"·href="generated/numpy.random.randn.html#numpy.random.randn"·title="numpy.random.randn"><code·class="xref·py·py-obj·docutils·literal·notranslate"><span·class="pre">randn</span></code></a>·methods·are·only·available·through·the·legacy |
Offset 586, 21 lines modified | Offset 586, 21 lines modified | ||
586 | <li><p>Standard·Exponentials·(<a·class="reference·internal"·href="generated/numpy.random.Generator.standard_exponential.html#numpy.random.Generator.standard_exponential"·title="numpy.random.Generator.standard_exponential"><code·class="xref·py·py-obj·docutils·literal·notranslate"><span·class="pre">standard_exponential</span></code></a>)</p></li> | 586 | <li><p>Standard·Exponentials·(<a·class="reference·internal"·href="generated/numpy.random.Generator.standard_exponential.html#numpy.random.Generator.standard_exponential"·title="numpy.random.Generator.standard_exponential"><code·class="xref·py·py-obj·docutils·literal·notranslate"><span·class="pre">standard_exponential</span></code></a>)</p></li> |
587 | </ul> | 587 | </ul> |
588 | </li> | 588 | </li> |
589 | </ul> | 589 | </ul> |
590 | <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[6]:·</span><span·class="n">rng</span>·<span·class="o">=</span>·<span·class="n">np</span><span·class="o">.</span><span·class="n">random</span><span·class="o">.</span><span·class="n">default_rng</span><span·class="p">()</span> | 590 | <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[6]:·</span><span·class="n">rng</span>·<span·class="o">=</span>·<span·class="n">np</span><span·class="o">.</span><span·class="n">random</span><span·class="o">.</span><span·class="n">default_rng</span><span·class="p">()</span> |
591 | <span·class="gp">In·[7]:·</span><span·class="n">rng</span><span·class="o">.</span><span·class="n">random</span><span·class="p">(</span><span·class="mi">3</span><span·class="p">,</span>·<span·class="n">dtype</span><span·class="o">=</span><span·class="n">np</span><span·class="o">.</span><span·class="n">float64</span><span·class="p">)</span> | 591 | <span·class="gp">In·[7]:·</span><span·class="n">rng</span><span·class="o">.</span><span·class="n">random</span><span·class="p">(</span><span·class="mi">3</span><span·class="p">,</span>·<span·class="n">dtype</span><span·class="o">=</span><span·class="n">np</span><span·class="o">.</span><span·class="n">float64</span><span·class="p">)</span> |
592 | <span·class="gh">Out[7]:·</span><span·class="go">array([0. | 592 | <span·class="gh">Out[7]:·</span><span·class="go">array([0.85230973,·0.10147825,·0.51944783])</span> |
593 | <span·class="gp">In·[8]:·</span><span·class="n">rng</span><span·class="o">.</span><span·class="n">random</span><span·class="p">(</span><span·class="mi">3</span><span·class="p">,</span>·<span·class="n">dtype</span><span·class="o">=</span><span·class="n">np</span><span·class="o">.</span><span·class="n">float32</span><span·class="p">)</span> | 593 | <span·class="gp">In·[8]:·</span><span·class="n">rng</span><span·class="o">.</span><span·class="n">random</span><span·class="p">(</span><span·class="mi">3</span><span·class="p">,</span>·<span·class="n">dtype</span><span·class="o">=</span><span·class="n">np</span><span·class="o">.</span><span·class="n">float32</span><span·class="p">)</span> |
594 | <span·class="gh">Out[8]:·</span><span·class="go">array([0. | 594 | <span·class="gh">Out[8]:·</span><span·class="go">array([0.18340158,·0.23296154,·0.4132383·],·dtype=float32)</span> |
595 | <span·class="gp">In·[9]:·</span><span·class="n">rng</span><span·class="o">.</span><span·class="n">integers</span><span·class="p">(</span><span·class="mi">0</span><span·class="p">,</span>·<span·class="mi">256</span><span·class="p">,</span>·<span·class="n">size</span><span·class="o">=</span><span·class="mi">3</span><span·class="p">,</span>·<span·class="n">dtype</span><span·class="o">=</span><span·class="n">np</span><span·class="o">.</span><span·class="n">uint8</span><span·class="p">)</span> | 595 | <span·class="gp">In·[9]:·</span><span·class="n">rng</span><span·class="o">.</span><span·class="n">integers</span><span·class="p">(</span><span·class="mi">0</span><span·class="p">,</span>·<span·class="mi">256</span><span·class="p">,</span>·<span·class="n">size</span><span·class="o">=</span><span·class="mi">3</span><span·class="p">,</span>·<span·class="n">dtype</span><span·class="o">=</span><span·class="n">np</span><span·class="o">.</span><span·class="n">uint8</span><span·class="p">)</span> |
596 | <span·class="gh">Out[9]:·</span><span·class="go">array([ | 596 | <span·class="gh">Out[9]:·</span><span·class="go">array([107,··65,·151],·dtype=uint8)</span> |
597 | </pre></div> | 597 | </pre></div> |
598 | </div> | 598 | </div> |
599 | <ul> | 599 | <ul> |
600 | <li><p>Optional·<code·class="docutils·literal·notranslate"><span·class="pre">out</span></code>·argument·that·allows·existing·arrays·to·be·filled·for | 600 | <li><p>Optional·<code·class="docutils·literal·notranslate"><span·class="pre">out</span></code>·argument·that·allows·existing·arrays·to·be·filled·for |
601 | select·distributions</p> | 601 | select·distributions</p> |
602 | <ul·class="simple"> | 602 | <ul·class="simple"> |
603 | <li><p>Uniforms·(<a·class="reference·internal"·href="generated/numpy.random.Generator.random.html#numpy.random.Generator.random"·title="numpy.random.Generator.random"><code·class="xref·py·py-obj·docutils·literal·notranslate"><span·class="pre">random</span></code></a>)</p></li> | 603 | <li><p>Uniforms·(<a·class="reference·internal"·href="generated/numpy.random.Generator.random.html#numpy.random.Generator.random"·title="numpy.random.Generator.random"><code·class="xref·py·py-obj·docutils·literal·notranslate"><span·class="pre">random</span></code></a>)</p></li> |
Offset 613, 18 lines modified | Offset 613, 18 lines modified | ||
613 | </li> | 613 | </li> |
614 | </ul> | 614 | </ul> |
615 | <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[10]:·</span><span·class="n">rng</span>·<span·class="o">=</span>·<span·class="n">np</span><span·class="o">.</span><span·class="n">random</span><span·class="o">.</span><span·class="n">default_rng</span><span·class="p">()</span> | 615 | <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[10]:·</span><span·class="n">rng</span>·<span·class="o">=</span>·<span·class="n">np</span><span·class="o">.</span><span·class="n">random</span><span·class="o">.</span><span·class="n">default_rng</span><span·class="p">()</span> |
616 | <span·class="gp">In·[11]:·</span><span·class="n">existing</span>·<span·class="o">=</span>·<span·class="n">np</span><span·class="o">.</span><span·class="n">zeros</span><span·class="p">(</span><span·class="mi">4</span><span·class="p">)</span> | 616 | <span·class="gp">In·[11]:·</span><span·class="n">existing</span>·<span·class="o">=</span>·<span·class="n">np</span><span·class="o">.</span><span·class="n">zeros</span><span·class="p">(</span><span·class="mi">4</span><span·class="p">)</span> |
617 | <span·class="gp">In·[12]:·</span><span·class="n">rng</span><span·class="o">.</span><span·class="n">random</span><span·class="p">(</span><span·class="n">out</span><span·class="o">=</span><span·class="n">existing</span><span·class="p">[:</span><span·class="mi">2</span><span·class="p">])</span> | 617 | <span·class="gp">In·[12]:·</span><span·class="n">rng</span><span·class="o">.</span><span·class="n">random</span><span·class="p">(</span><span·class="n">out</span><span·class="o">=</span><span·class="n">existing</span><span·class="p">[:</span><span·class="mi">2</span><span·class="p">])</span> |
618 | <span·class="gh">Out[12]:·</span><span·class="go">array([0. | 618 | <span·class="gh">Out[12]:·</span><span·class="go">array([0.52034842,·0.72889079])</span> |
619 | <span·class="gp">In·[13]:·</span><span·class="nb">print</span><span·class="p">(</span><span·class="n">existing</span><span·class="p">)</span> | 619 | <span·class="gp">In·[13]:·</span><span·class="nb">print</span><span·class="p">(</span><span·class="n">existing</span><span·class="p">)</span> |
620 | <span·class="go">[0. | 620 | <span·class="go">[0.52034842·0.72889079·0.·········0.········]</span> |
621 | </pre></div> | 621 | </pre></div> |
622 | </div> | 622 | </div> |
623 | <ul·class="simple"> | 623 | <ul·class="simple"> |
624 | <li><p>Optional·<code·class="docutils·literal·notranslate"><span·class="pre">axis</span></code>·argument·for·methods·like·<a·class="reference·internal"·href="generated/numpy.random.Generator.choice.html#numpy.random.Generator.choice"·title="numpy.random.Generator.choice"><code·class="xref·py·py-obj·docutils·literal·notranslate"><span·class="pre">choice</span></code></a>, | 624 | <li><p>Optional·<code·class="docutils·literal·notranslate"><span·class="pre">axis</span></code>·argument·for·methods·like·<a·class="reference·internal"·href="generated/numpy.random.Generator.choice.html#numpy.random.Generator.choice"·title="numpy.random.Generator.choice"><code·class="xref·py·py-obj·docutils·literal·notranslate"><span·class="pre">choice</span></code></a>, |
625 | <a·class="reference·internal"·href="generated/numpy.random.Generator.permutation.html#numpy.random.Generator.permutation"·title="numpy.random.Generator.permutation"><code·class="xref·py·py-obj·docutils·literal·notranslate"><span·class="pre">permutation</span></code></a>·and·<a·class="reference·internal"·href="generated/numpy.random.Generator.shuffle.html#numpy.random.Generator.shuffle"·title="numpy.random.Generator.shuffle"><code·class="xref·py·py-obj·docutils·literal·notranslate"><span·class="pre">shuffle</span></code></a>·that·controls·which | 625 | <a·class="reference·internal"·href="generated/numpy.random.Generator.permutation.html#numpy.random.Generator.permutation"·title="numpy.random.Generator.permutation"><code·class="xref·py·py-obj·docutils·literal·notranslate"><span·class="pre">permutation</span></code></a>·and·<a·class="reference·internal"·href="generated/numpy.random.Generator.shuffle.html#numpy.random.Generator.shuffle"·title="numpy.random.Generator.shuffle"><code·class="xref·py·py-obj·docutils·literal·notranslate"><span·class="pre">shuffle</span></code></a>·that·controls·which |
626 | axis·an·operation·is·performed·over·for·multi-dimensional·arrays.</p></li> | 626 | axis·an·operation·is·performed·over·for·multi-dimensional·arrays.</p></li> |
627 | </ul> | 627 | </ul> |
Offset 636, 25 lines modified | Offset 636, 25 lines modified | ||
636 | <span·class="gh">Out[16]:·</span> | 636 | <span·class="gh">Out[16]:·</span> |
637 | <span·class="go">array([[·0,··1,··2,··3],</span> | 637 | <span·class="go">array([[·0,··1,··2,··3],</span> |
638 | <span·class="go">·······[·4,··5,··6,··7],</span> | 638 | <span·class="go">·······[·4,··5,··6,··7],</span> |
639 | <span·class="go">·······[·8,··9,·10,·11]])</span> | 639 | <span·class="go">·······[·8,··9,·10,·11]])</span> |
640 | <span·class="gp">In·[17]:·</span><span·class="n">rng</span><span·class="o">.</span><span·class="n">choice</span><span·class="p">(</span><span·class="n">a</span><span·class="p">,</span>·<span·class="n">axis</span><span·class="o">=</span><span·class="mi">1</span><span·class="p">,</span>·<span·class="n">size</span><span·class="o">=</span><span·class="mi">5</span><span·class="p">)</span> | 640 | <span·class="gp">In·[17]:·</span><span·class="n">rng</span><span·class="o">.</span><span·class="n">choice</span><span·class="p">(</span><span·class="n">a</span><span·class="p">,</span>·<span·class="n">axis</span><span·class="o">=</span><span·class="mi">1</span><span·class="p">,</span>·<span·class="n">size</span><span·class="o">=</span><span·class="mi">5</span><span·class="p">)</span> |
641 | <span·class="gh">Out[17]:·</span> | 641 | <span·class="gh">Out[17]:·</span> |
642 | <span·class="go">array([[· | 642 | <span·class="go">array([[·3,··1,··2,··0,··1],</span> |
643 | <span·class="go">·······[· | 643 | <span·class="go">·······[·7,··5,··6,··4,··5],</span> |
644 | <span·class="go">·······[1 | 644 | <span·class="go">·······[11,··9,·10,··8,··9]])</span> |
645 | <span·class="gp">In·[18]:·</span><span·class="n">rng</span><span·class="o">.</span><span·class="n">shuffle</span><span·class="p">(</span><span·class="n">a</span><span·class="p">,</span>·<span·class="n">axis</span><span·class="o">=</span><span·class="mi">1</span><span·class="p">)</span>········<span·class="c1">#·Shuffle·in-place</span> | 645 | <span·class="gp">In·[18]:·</span><span·class="n">rng</span><span·class="o">.</span><span·class="n">shuffle</span><span·class="p">(</span><span·class="n">a</span><span·class="p">,</span>·<span·class="n">axis</span><span·class="o">=</span><span·class="mi">1</span><span·class="p">)</span>········<span·class="c1">#·Shuffle·in-place</span> |
646 | <span·class="gp">In·[19]:·</span><span·class="n">a</span> | 646 | <span·class="gp">In·[19]:·</span><span·class="n">a</span> |
647 | <span·class="gh">Out[19]:·</span> | 647 | <span·class="gh">Out[19]:·</span> |
648 | <span·class="go">array([[· | 648 | <span·class="go">array([[·0,··3,··1,··2],</span> |
649 | <span·class="go">·······[· | 649 | <span·class="go">·······[·4,··7,··5,··6],</span> |
650 | <span·class="go">·······[ | 650 | <span·class="go">·······[·8,·11,··9,·10]])</span> |
651 | </pre></div> | 651 | </pre></div> |
652 | </div> | 652 | </div> |
653 | <ul·class="simple"> | 653 | <ul·class="simple"> |
654 | <li><p>Added·a·method·to·sample·from·the·complex·normal·distribution | 654 | <li><p>Added·a·method·to·sample·from·the·complex·normal·distribution |
655 | (<em·class="xref·py·py-obj">complex_normal</em>)</p></li> | 655 | (<em·class="xref·py·py-obj">complex_normal</em>)</p></li> |
656 | </ul> | 656 | </ul> |
657 | </section> | 657 | </section> |
Offset 102, 26 lines modified | Offset 102, 26 lines modified | ||
102 | In·[1]:·import·numpy.random | 102 | In·[1]:·import·numpy.random |
103 | In·[2]:·rng·=·np.random.default_rng() | 103 | In·[2]:·rng·=·np.random.default_rng() |
104 | In·[3]:·%timeit·-n·1·rng.standard_normal(100000) | 104 | In·[3]:·%timeit·-n·1·rng.standard_normal(100000) |
105 | ···...:·%timeit·-n·1·numpy.random.standard_normal(100000) | 105 | ···...:·%timeit·-n·1·numpy.random.standard_normal(100000) |
106 | ···...: | 106 | ···...: |
107 | 1.02·ms·+-· | 107 | 1.02·ms·+-·38.2·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·1·loop·each) |
108 | 2.5 | 108 | 2.53·ms·+-·20.8·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·1·loop·each) |
109 | In·[4]:·%timeit·-n·1·rng.standard_exponential(100000) | 109 | In·[4]:·%timeit·-n·1·rng.standard_exponential(100000) |
110 | ···...:·%timeit·-n·1·numpy.random.standard_exponential(100000) | 110 | ···...:·%timeit·-n·1·numpy.random.standard_exponential(100000) |
111 | ···...: | 111 | ···...: |
112 | 9 | 112 | 919·us·+-·57.7·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·1·loop·each) |
113 | 1. | 113 | 1.88·ms·+-·15.4·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·1·loop·each) |
114 | In·[5]:·%timeit·-n·1·rng.standard_gamma(3.0,·100000) | 114 | In·[5]:·%timeit·-n·1·rng.standard_gamma(3.0,·100000) |
115 | ···...:·%timeit·-n·1·numpy.random.standard_gamma(3.0,·100000) | 115 | ···...:·%timeit·-n·1·numpy.random.standard_gamma(3.0,·100000) |
116 | ···...: | 116 | ···...: |
117 | 2.46·ms·+-·1 | 117 | 2.46·ms·+-·17.3·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·1·loop·each) |
118 | 4.47·ms·+-·1 | 118 | 4.47·ms·+-·16.8·us·per·loop·(mean·+-·std.·dev.·of·7·runs,·1·loop·each) |
119 | ····*·_\x8i_\x8n_\x8t_\x8e_\x8g_\x8e_\x8r_\x8s·is·now·the·canonical·way·to·generate·integer·random·numbers·from | 119 | ····*·_\x8i_\x8n_\x8t_\x8e_\x8g_\x8e_\x8r_\x8s·is·now·the·canonical·way·to·generate·integer·random·numbers·from |
120 | ······a·discrete·uniform·distribution.·This·replaces·both·_\x8r_\x8a_\x8n_\x8d_\x8i_\x8n_\x8t·and·the | 120 | ······a·discrete·uniform·distribution.·This·replaces·both·_\x8r_\x8a_\x8n_\x8d_\x8i_\x8n_\x8t·and·the |
121 | ······deprecated·_\x8r_\x8a_\x8n_\x8d_\x8o_\x8m_\x8__\x8i_\x8n_\x8t_\x8e_\x8g_\x8e_\x8r_\x8s. | 121 | ······deprecated·_\x8r_\x8a_\x8n_\x8d_\x8o_\x8m_\x8__\x8i_\x8n_\x8t_\x8e_\x8g_\x8e_\x8r_\x8s. |
122 | ····*·The·_\x8r_\x8a_\x8n_\x8d·and·_\x8r_\x8a_\x8n_\x8d_\x8n·methods·are·only·available·through·the·legacy | 122 | ····*·The·_\x8r_\x8a_\x8n_\x8d·and·_\x8r_\x8a_\x8n_\x8d_\x8n·methods·are·only·available·through·the·legacy |
123 | ······_\x8R_\x8a_\x8n_\x8d_\x8o_\x8m_\x8S_\x8t_\x8a_\x8t_\x8e. | 123 | ······_\x8R_\x8a_\x8n_\x8d_\x8o_\x8m_\x8S_\x8t_\x8a_\x8t_\x8e. |
124 | ····*·_\x8G_\x8e_\x8n_\x8e_\x8r_\x8a_\x8t_\x8o_\x8r_\x8._\x8r_\x8a_\x8n_\x8d_\x8o_\x8m·is·now·the·canonical·way·to·generate·floating-point | 124 | ····*·_\x8G_\x8e_\x8n_\x8e_\x8r_\x8a_\x8t_\x8o_\x8r_\x8._\x8r_\x8a_\x8n_\x8d_\x8o_\x8m·is·now·the·canonical·way·to·generate·floating-point |
125 | ······random·numbers,·which·replaces·_\x8R_\x8a_\x8n_\x8d_\x8o_\x8m_\x8S_\x8t_\x8a_\x8t_\x8e_\x8._\x8r_\x8a_\x8n_\x8d_\x8o_\x8m_\x8__\x8s_\x8a_\x8m_\x8p_\x8l_\x8e,·_\x8s_\x8a_\x8m_\x8p_\x8l_\x8e,·and | 125 | ······random·numbers,·which·replaces·_\x8R_\x8a_\x8n_\x8d_\x8o_\x8m_\x8S_\x8t_\x8a_\x8t_\x8e_\x8._\x8r_\x8a_\x8n_\x8d_\x8o_\x8m_\x8__\x8s_\x8a_\x8m_\x8p_\x8l_\x8e,·_\x8s_\x8a_\x8m_\x8p_\x8l_\x8e,·and |
Offset 140, 38 lines modified | Offset 140, 38 lines modified | ||
140 | ··········o·Uniforms·(_\x8r_\x8a_\x8n_\x8d_\x8o_\x8m·and·_\x8i_\x8n_\x8t_\x8e_\x8g_\x8e_\x8r_\x8s) | 140 | ··········o·Uniforms·(_\x8r_\x8a_\x8n_\x8d_\x8o_\x8m·and·_\x8i_\x8n_\x8t_\x8e_\x8g_\x8e_\x8r_\x8s) |
141 | ··········o·Normals·(_\x8s_\x8t_\x8a_\x8n_\x8d_\x8a_\x8r_\x8d_\x8__\x8n_\x8o_\x8r_\x8m_\x8a_\x8l) | 141 | ··········o·Normals·(_\x8s_\x8t_\x8a_\x8n_\x8d_\x8a_\x8r_\x8d_\x8__\x8n_\x8o_\x8r_\x8m_\x8a_\x8l) |
142 | ··········o·Standard·Gammas·(_\x8s_\x8t_\x8a_\x8n_\x8d_\x8a_\x8r_\x8d_\x8__\x8g_\x8a_\x8m_\x8m_\x8a) | 142 | ··········o·Standard·Gammas·(_\x8s_\x8t_\x8a_\x8n_\x8d_\x8a_\x8r_\x8d_\x8__\x8g_\x8a_\x8m_\x8m_\x8a) |
143 | ··········o·Standard·Exponentials·(_\x8s_\x8t_\x8a_\x8n_\x8d_\x8a_\x8r_\x8d_\x8__\x8e_\x8x_\x8p_\x8o_\x8n_\x8e_\x8n_\x8t_\x8i_\x8a_\x8l) | 143 | ··········o·Standard·Exponentials·(_\x8s_\x8t_\x8a_\x8n_\x8d_\x8a_\x8r_\x8d_\x8__\x8e_\x8x_\x8p_\x8o_\x8n_\x8e_\x8n_\x8t_\x8i_\x8a_\x8l) |
144 | In·[6]:·rng·=·np.random.default_rng() | 144 | In·[6]:·rng·=·np.random.default_rng() |
145 | In·[7]:·rng.random(3,·dtype=np.float64) | 145 | In·[7]:·rng.random(3,·dtype=np.float64) |
146 | Out[7]:·array([0. | 146 | Out[7]:·array([0.85230973,·0.10147825,·0.51944783]) |
147 | In·[8]:·rng.random(3,·dtype=np.float32) | 147 | In·[8]:·rng.random(3,·dtype=np.float32) |
148 | Out[8]:·array([0. | 148 | Out[8]:·array([0.18340158,·0.23296154,·0.4132383·],·dtype=float32) |
149 | In·[9]:·rng.integers(0,·256,·size=3,·dtype=np.uint8) | 149 | In·[9]:·rng.integers(0,·256,·size=3,·dtype=np.uint8) |
150 | Out[9]:·array([ | 150 | Out[9]:·array([107,··65,·151],·dtype=uint8) |
151 | ····*·Optional·out·argument·that·allows·existing·arrays·to·be·filled·for·select | 151 | ····*·Optional·out·argument·that·allows·existing·arrays·to·be·filled·for·select |
152 | ······distributions | 152 | ······distributions |
153 | ··········o·Uniforms·(_\x8r_\x8a_\x8n_\x8d_\x8o_\x8m) | 153 | ··········o·Uniforms·(_\x8r_\x8a_\x8n_\x8d_\x8o_\x8m) |
154 | ··········o·Normals·(_\x8s_\x8t_\x8a_\x8n_\x8d_\x8a_\x8r_\x8d_\x8__\x8n_\x8o_\x8r_\x8m_\x8a_\x8l) | 154 | ··········o·Normals·(_\x8s_\x8t_\x8a_\x8n_\x8d_\x8a_\x8r_\x8d_\x8__\x8n_\x8o_\x8r_\x8m_\x8a_\x8l) |
155 | ··········o·Standard·Gammas·(_\x8s_\x8t_\x8a_\x8n_\x8d_\x8a_\x8r_\x8d_\x8__\x8g_\x8a_\x8m_\x8m_\x8a) | 155 | ··········o·Standard·Gammas·(_\x8s_\x8t_\x8a_\x8n_\x8d_\x8a_\x8r_\x8d_\x8__\x8g_\x8a_\x8m_\x8m_\x8a) |
156 | ··········o·Standard·Exponentials·(_\x8s_\x8t_\x8a_\x8n_\x8d_\x8a_\x8r_\x8d_\x8__\x8e_\x8x_\x8p_\x8o_\x8n_\x8e_\x8n_\x8t_\x8i_\x8a_\x8l) | 156 | ··········o·Standard·Exponentials·(_\x8s_\x8t_\x8a_\x8n_\x8d_\x8a_\x8r_\x8d_\x8__\x8e_\x8x_\x8p_\x8o_\x8n_\x8e_\x8n_\x8t_\x8i_\x8a_\x8l) |
157 | ······This·allows·multithreading·to·fill·large·arrays·in·chunks·using·suitable | 157 | ······This·allows·multithreading·to·fill·large·arrays·in·chunks·using·suitable |
158 | ······BitGenerators·in·parallel. | 158 | ······BitGenerators·in·parallel. |
159 | In·[10]:·rng·=·np.random.default_rng() | 159 | In·[10]:·rng·=·np.random.default_rng() |
160 | In·[11]:·existing·=·np.zeros(4) | 160 | In·[11]:·existing·=·np.zeros(4) |
161 | In·[12]:·rng.random(out=existing[:2]) | 161 | In·[12]:·rng.random(out=existing[:2]) |
162 | Out[12]:·array([0. | 162 | Out[12]:·array([0.52034842,·0.72889079]) |
163 | In·[13]:·print(existing) | 163 | In·[13]:·print(existing) |
164 | [0. | 164 | [0.52034842·0.72889079·0.·········0.········] |
165 | ····*·Optional·axis·argument·for·methods·like·_\x8c_\x8h_\x8o_\x8i_\x8c_\x8e,·_\x8p_\x8e_\x8r_\x8m_\x8u_\x8t_\x8a_\x8t_\x8i_\x8o_\x8n·and·_\x8s_\x8h_\x8u_\x8f_\x8f_\x8l_\x8e | 165 | ····*·Optional·axis·argument·for·methods·like·_\x8c_\x8h_\x8o_\x8i_\x8c_\x8e,·_\x8p_\x8e_\x8r_\x8m_\x8u_\x8t_\x8a_\x8t_\x8i_\x8o_\x8n·and·_\x8s_\x8h_\x8u_\x8f_\x8f_\x8l_\x8e |
166 | ······that·controls·which·axis·an·operation·is·performed·over·for·multi- | 166 | ······that·controls·which·axis·an·operation·is·performed·over·for·multi- |
167 | ······dimensional·arrays. | 167 | ······dimensional·arrays. |
168 | In·[14]:·rng·=·np.random.default_rng() | 168 | In·[14]:·rng·=·np.random.default_rng() |
169 | In·[15]:·a·=·np.arange(12).reshape((3,·4)) | 169 | In·[15]:·a·=·np.arange(12).reshape((3,·4)) |
Offset 179, 25 lines modified | Offset 179, 25 lines modified | ||
179 | Out[16]: | 179 | Out[16]: |
180 | array([[·0,··1,··2,··3], | 180 | array([[·0,··1,··2,··3], |
181 | ·······[·4,··5,··6,··7], | 181 | ·······[·4,··5,··6,··7], |
182 | ·······[·8,··9,·10,·11]]) | 182 | ·······[·8,··9,·10,·11]]) |
183 | In·[17]:·rng.choice(a,·axis=1,·size=5) | 183 | In·[17]:·rng.choice(a,·axis=1,·size=5) |
184 | Out[17]: | 184 | Out[17]: |
185 | array([[· | 185 | array([[·3,··1,··2,··0,··1], |
186 | ·······[· | 186 | ·······[·7,··5,··6,··4,··5], |
187 | ·······[1 | 187 | ·······[11,··9,·10,··8,··9]]) |
188 | In·[18]:·rng.shuffle(a,·axis=1)········#·Shuffle·in-place | 188 | In·[18]:·rng.shuffle(a,·axis=1)········#·Shuffle·in-place |
189 | In·[19]:·a | 189 | In·[19]:·a |
190 | Out[19]: | 190 | Out[19]: |
191 | array([[· | 191 | array([[·0,··3,··1,··2], |
192 | ·······[· | 192 | ·······[·4,··7,··5,··6], |
193 | ·······[ | 193 | ·······[·8,·11,··9,·10]]) |
194 | ····*·Added·a·method·to·sample·from·the·complex·normal·distribution | 194 | ····*·Added·a·method·to·sample·from·the·complex·normal·distribution |
195 | ······(c\x8co\x8om\x8mp\x8pl\x8le\x8ex\x8x_\x8_n\x8no\x8or\x8rm\x8ma\x8al\x8l) | 195 | ······(c\x8co\x8om\x8mp\x8pl\x8le\x8ex\x8x_\x8_n\x8no\x8or\x8rm\x8ma\x8al\x8l) |
196 | _\x8p_\x8r_\x8e_\x8v_\x8i_\x8o_\x8u_\x8s | 196 | _\x8p_\x8r_\x8e_\x8v_\x8i_\x8o_\x8u_\x8s |
197 | _\x8M_\x8u_\x8l_\x8t_\x8i_\x8t_\x8h_\x8r_\x8e_\x8a_\x8d_\x8e_\x8d_\x8·_\x8g_\x8e_\x8n_\x8e_\x8r_\x8a_\x8t_\x8i_\x8o_\x8n | 197 | _\x8M_\x8u_\x8l_\x8t_\x8i_\x8t_\x8h_\x8r_\x8e_\x8a_\x8d_\x8e_\x8d_\x8·_\x8g_\x8e_\x8n_\x8e_\x8r_\x8a_\x8t_\x8i_\x8o_\x8n |
198 | _\x8n_\x8e_\x8x_\x8t | 198 | _\x8n_\x8e_\x8x_\x8t |
199 | _\x8P_\x8e_\x8r_\x8f_\x8o_\x8r_\x8m_\x8a_\x8n_\x8c_\x8e | 199 | _\x8P_\x8e_\x8r_\x8f_\x8o_\x8r_\x8m_\x8a_\x8n_\x8c_\x8e |
200 | ©·Copyright·2008-2025,·NumPy·Developers. | 200 | ©·Copyright·2008-2025,·NumPy·Developers. |
Offset 609, 31 lines modified | Offset 609, 31 lines modified | ||
609 | <span·class="gp">In·[3]:·</span><span·class="n">y</span>·<span·class="o">=</span>·<span·class="n">np</span><span·class="o">.</span><span·class="n">arange</span><span·class="p">(</span><span·class="mi">10</span><span·class="p">)</span>·<span·class="o">+</span>·<span·class="n">rng</span><span·class="o">.</span><span·class="n">standard_normal</span><span·class="p">(</span><span·class="mi">10</span><span·class="p">)</span> | 609 | <span·class="gp">In·[3]:·</span><span·class="n">y</span>·<span·class="o">=</span>·<span·class="n">np</span><span·class="o">.</span><span·class="n">arange</span><span·class="p">(</span><span·class="mi">10</span><span·class="p">)</span>·<span·class="o">+</span>·<span·class="n">rng</span><span·class="o">.</span><span·class="n">standard_normal</span><span·class="p">(</span><span·class="mi">10</span><span·class="p">)</span> |
610 | </pre></div> | 610 | </pre></div> |
611 | </div> | 611 | </div> |
612 | <p>With·the·legacy·polynomial·module,·a·linear·fit·(i.e.·polynomial·of·degree·1) | 612 | <p>With·the·legacy·polynomial·module,·a·linear·fit·(i.e.·polynomial·of·degree·1) |
613 | could·be·applied·to·these·data·with·<a·class="reference·internal"·href="generated/numpy.polyfit.html#numpy.polyfit"·title="numpy.polyfit"><code·class="xref·py·py-obj·docutils·literal·notranslate"><span·class="pre">polyfit</span></code></a>:</p> | 613 | could·be·applied·to·these·data·with·<a·class="reference·internal"·href="generated/numpy.polyfit.html#numpy.polyfit"·title="numpy.polyfit"><code·class="xref·py·py-obj·docutils·literal·notranslate"><span·class="pre">polyfit</span></code></a>:</p> |
614 | <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[4]:·</span><span·class="n">np</span><span·class="o">.</span><span·class="n">polyfit</span><span·class="p">(</span><span·class="n">x</span><span·class="p">,</span>·<span·class="n">y</span><span·class="p">,</span>·<span·class="n">deg</span><span·class="o">=</span><span·class="mi">1</span><span·class="p">)</span> | 614 | <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[4]:·</span><span·class="n">np</span><span·class="o">.</span><span·class="n">polyfit</span><span·class="p">(</span><span·class="n">x</span><span·class="p">,</span>·<span·class="n">y</span><span·class="p">,</span>·<span·class="n">deg</span><span·class="o">=</span><span·class="mi">1</span><span·class="p">)</span> |
615 | <span·class="gh">Out[4]:·</span><span·class="go">array([0. | 615 | <span·class="gh">Out[4]:·</span><span·class="go">array([0.91099055,·0.18730772])</span> |
616 | </pre></div> | 616 | </pre></div> |
617 | </div> | 617 | </div> |
618 | <p>With·the·new·polynomial·API,·the·<a·class="reference·internal"·href="generated/numpy.polynomial.polynomial.Polynomial.fit.html#numpy.polynomial.polynomial.Polynomial.fit"·title="numpy.polynomial.polynomial.Polynomial.fit"><code·class="xref·py·py-obj·docutils·literal·notranslate"><span·class="pre">fit</span></code></a> | 618 | <p>With·the·new·polynomial·API,·the·<a·class="reference·internal"·href="generated/numpy.polynomial.polynomial.Polynomial.fit.html#numpy.polynomial.polynomial.Polynomial.fit"·title="numpy.polynomial.polynomial.Polynomial.fit"><code·class="xref·py·py-obj·docutils·literal·notranslate"><span·class="pre">fit</span></code></a> |
619 | class·method·is·preferred:</p> | 619 | class·method·is·preferred:</p> |
620 | <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[5]:·</span><span·class="n">p_fitted</span>·<span·class="o">=</span>·<span·class="n">np</span><span·class="o">.</span><span·class="n">polynomial</span><span·class="o">.</span><span·class="n">Polynomial</span><span·class="o">.</span><span·class="n">fit</span><span·class="p">(</span><span·class="n">x</span><span·class="p">,</span>·<span·class="n">y</span><span·class="p">,</span>·<span·class="n">deg</span><span·class="o">=</span><span·class="mi">1</span><span·class="p">)</span> | 620 | <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[5]:·</span><span·class="n">p_fitted</span>·<span·class="o">=</span>·<span·class="n">np</span><span·class="o">.</span><span·class="n">polynomial</span><span·class="o">.</span><span·class="n">Polynomial</span><span·class="o">.</span><span·class="n">fit</span><span·class="p">(</span><span·class="n">x</span><span·class="p">,</span>·<span·class="n">y</span><span·class="p">,</span>·<span·class="n">deg</span><span·class="o">=</span><span·class="mi">1</span><span·class="p">)</span> |
621 | <span·class="gp">In·[6]:·</span><span·class="n">p_fitted</span> | 621 | <span·class="gp">In·[6]:·</span><span·class="n">p_fitted</span> |
622 | <span·class="gh">Out[6]:·</span><span·class="go">Polynomial([4. | 622 | <span·class="gh">Out[6]:·</span><span·class="go">Polynomial([4.28676522,·4.0994575·],·domain=[0.,·9.],·window=[-1.,··1.],·symbol='x')</span> |
623 | </pre></div> | 623 | </pre></div> |
624 | </div> | 624 | </div> |
625 | <p>Note·that·the·coefficients·are·given·<em>in·the·scaled·domain</em>·defined·by·the | 625 | <p>Note·that·the·coefficients·are·given·<em>in·the·scaled·domain</em>·defined·by·the |
626 | linear·mapping·between·the·<code·class="docutils·literal·notranslate"><span·class="pre">window</span></code>·and·<code·class="docutils·literal·notranslate"><span·class="pre">domain</span></code>. | 626 | linear·mapping·between·the·<code·class="docutils·literal·notranslate"><span·class="pre">window</span></code>·and·<code·class="docutils·literal·notranslate"><span·class="pre">domain</span></code>. |
627 | <a·class="reference·internal"·href="generated/numpy.polynomial.polynomial.Polynomial.convert.html#numpy.polynomial.polynomial.Polynomial.convert"·title="numpy.polynomial.polynomial.Polynomial.convert"><code·class="xref·py·py-obj·docutils·literal·notranslate"><span·class="pre">convert</span></code></a>·can·be·used·to·get·the | 627 | <a·class="reference·internal"·href="generated/numpy.polynomial.polynomial.Polynomial.convert.html#numpy.polynomial.polynomial.Polynomial.convert"·title="numpy.polynomial.polynomial.Polynomial.convert"><code·class="xref·py·py-obj·docutils·literal·notranslate"><span·class="pre">convert</span></code></a>·can·be·used·to·get·the |
628 | coefficients·in·the·unscaled·data·domain.</p> | 628 | coefficients·in·the·unscaled·data·domain.</p> |
629 | <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[7]:·</span><span·class="n">p_fitted</span><span·class="o">.</span><span·class="n">convert</span><span·class="p">()</span> | 629 | <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[7]:·</span><span·class="n">p_fitted</span><span·class="o">.</span><span·class="n">convert</span><span·class="p">()</span> |
630 | <span·class="gh">Out[7]:·</span><span·class="go">Polynomial([0. | 630 | <span·class="gh">Out[7]:·</span><span·class="go">Polynomial([0.18730772,·0.91099055],·domain=[-1.,··1.],·window=[-1.,··1.],·symbol='x')</span> |
631 | </pre></div> | 631 | </pre></div> |
632 | </div> | 632 | </div> |
633 | </section> | 633 | </section> |
634 | </section> | 634 | </section> |
635 | <section·id="documentation-for-the-polynomial-package"> | 635 | <section·id="documentation-for-the-polynomial-package"> |
636 | <h2>Documentation·for·the·<a·class="reference·internal"·href="routines.polynomials-package.html#module-numpy.polynomial"·title="numpy.polynomial"><code·class="xref·py·py-obj·docutils·literal·notranslate"><span·class="pre">polynomial</span></code></a>·package<a·class="headerlink"·href="#documentation-for-the-polynomial-package"·title="Link·to·this·heading">#</a></h2> | 636 | <h2>Documentation·for·the·<a·class="reference·internal"·href="routines.polynomials-package.html#module-numpy.polynomial"·title="numpy.polynomial"><code·class="xref·py·py-obj·docutils·literal·notranslate"><span·class="pre">polynomial</span></code></a>·package<a·class="headerlink"·href="#documentation-for-the-polynomial-package"·title="Link·to·this·heading">#</a></h2> |
637 | <p>In·addition·to·standard·power·series·polynomials,·the·polynomial·package | 637 | <p>In·addition·to·standard·power·series·polynomials,·the·polynomial·package |
Offset 150, 26 lines modified | Offset 150, 26 lines modified | ||
150 | In·[2]:·x·=·np.arange(10) | 150 | In·[2]:·x·=·np.arange(10) |
151 | In·[3]:·y·=·np.arange(10)·+·rng.standard_normal(10) | 151 | In·[3]:·y·=·np.arange(10)·+·rng.standard_normal(10) |
152 | With·the·legacy·polynomial·module,·a·linear·fit·(i.e.·polynomial·of·degree·1) | 152 | With·the·legacy·polynomial·module,·a·linear·fit·(i.e.·polynomial·of·degree·1) |
153 | could·be·applied·to·these·data·with·_\x8p_\x8o_\x8l_\x8y_\x8f_\x8i_\x8t: | 153 | could·be·applied·to·these·data·with·_\x8p_\x8o_\x8l_\x8y_\x8f_\x8i_\x8t: |
154 | In·[4]:·np.polyfit(x,·y,·deg=1) | 154 | In·[4]:·np.polyfit(x,·y,·deg=1) |
155 | Out[4]:·array([0. | 155 | Out[4]:·array([0.91099055,·0.18730772]) |
156 | With·the·new·polynomial·API,·the·_\x8f_\x8i_\x8t·class·method·is·preferred: | 156 | With·the·new·polynomial·API,·the·_\x8f_\x8i_\x8t·class·method·is·preferred: |
157 | In·[5]:·p_fitted·=·np.polynomial.Polynomial.fit(x,·y,·deg=1) | 157 | In·[5]:·p_fitted·=·np.polynomial.Polynomial.fit(x,·y,·deg=1) |
158 | In·[6]:·p_fitted | 158 | In·[6]:·p_fitted |
159 | Out[6]:·Polynomial([4. | 159 | Out[6]:·Polynomial([4.28676522,·4.0994575·],·domain=[0.,·9.],·window=[-1., |
160 | 1.],·symbol='x') | 160 | 1.],·symbol='x') |
161 | Note·that·the·coefficients·are·given·i\x8in\x8n·t\x8th\x8he\x8e·s\x8sc\x8ca\x8al\x8le\x8ed\x8d·d\x8do\x8om\x8ma\x8ai\x8in\x8n·defined·by·the·linear | 161 | Note·that·the·coefficients·are·given·i\x8in\x8n·t\x8th\x8he\x8e·s\x8sc\x8ca\x8al\x8le\x8ed\x8d·d\x8do\x8om\x8ma\x8ai\x8in\x8n·defined·by·the·linear |
162 | mapping·between·the·window·and·domain.·_\x8c_\x8o_\x8n_\x8v_\x8e_\x8r_\x8t·can·be·used·to·get·the | 162 | mapping·between·the·window·and·domain.·_\x8c_\x8o_\x8n_\x8v_\x8e_\x8r_\x8t·can·be·used·to·get·the |
163 | coefficients·in·the·unscaled·data·domain. | 163 | coefficients·in·the·unscaled·data·domain. |
164 | In·[7]:·p_fitted.convert() | 164 | In·[7]:·p_fitted.convert() |
165 | Out[7]:·Polynomial([0. | 165 | Out[7]:·Polynomial([0.18730772,·0.91099055],·domain=[-1.,··1.],·window=[-1., |
166 | 1.],·symbol='x') | 166 | 1.],·symbol='x') |
167 | *\x8**\x8**\x8**\x8**\x8*·D\x8Do\x8oc\x8cu\x8um\x8me\x8en\x8nt\x8ta\x8at\x8ti\x8io\x8on\x8n·f\x8fo\x8or\x8r·t\x8th\x8he\x8e·_\x8p\x8p_\x8o\x8o_\x8l\x8l_\x8y\x8y_\x8n\x8n_\x8o\x8o_\x8m\x8m_\x8i\x8i_\x8a\x8a_\x8l\x8l·p\x8pa\x8ac\x8ck\x8ka\x8ag\x8ge\x8e_\x8#\x8#·*\x8**\x8**\x8**\x8**\x8* | 167 | *\x8**\x8**\x8**\x8**\x8*·D\x8Do\x8oc\x8cu\x8um\x8me\x8en\x8nt\x8ta\x8at\x8ti\x8io\x8on\x8n·f\x8fo\x8or\x8r·t\x8th\x8he\x8e·_\x8p\x8p_\x8o\x8o_\x8l\x8l_\x8y\x8y_\x8n\x8n_\x8o\x8o_\x8m\x8m_\x8i\x8i_\x8a\x8a_\x8l\x8l·p\x8pa\x8ac\x8ck\x8ka\x8ag\x8ge\x8e_\x8#\x8#·*\x8**\x8**\x8**\x8**\x8* |
168 | In·addition·to·standard·power·series·polynomials,·the·polynomial·package | 168 | In·addition·to·standard·power·series·polynomials,·the·polynomial·package |
169 | provides·several·additional·kinds·of·polynomials·including·Chebyshev,·Hermite | 169 | provides·several·additional·kinds·of·polynomials·including·Chebyshev,·Hermite |
170 | (two·subtypes),·Laguerre,·and·Legendre·polynomials.·Each·of·these·has·an | 170 | (two·subtypes),·Laguerre,·and·Legendre·polynomials.·Each·of·these·has·an |
171 | associated·c\x8co\x8on\x8nv\x8ve\x8en\x8ni\x8ie\x8en\x8nc\x8ce\x8e·c\x8cl\x8la\x8as\x8ss\x8s·available·from·the·_\x8n_\x8u_\x8m_\x8p_\x8y_\x8._\x8p_\x8o_\x8l_\x8y_\x8n_\x8o_\x8m_\x8i_\x8a_\x8l·namespace·that | 171 | associated·c\x8co\x8on\x8nv\x8ve\x8en\x8ni\x8ie\x8en\x8nc\x8ce\x8e·c\x8cl\x8la\x8as\x8ss\x8s·available·from·the·_\x8n_\x8u_\x8m_\x8p_\x8y_\x8._\x8p_\x8o_\x8l_\x8y_\x8n_\x8o_\x8m_\x8i_\x8a_\x8l·namespace·that |
172 | provides·a·consistent·interface·for·working·with·polynomials·regardless·of | 172 | provides·a·consistent·interface·for·working·with·polynomials·regardless·of |
Offset 32423, 14 lines modified | Offset 32423, 15 lines modified | ||
32423 | ········"087300000000000003":·[2346,·2392,·2441], | 32423 | ········"087300000000000003":·[2346,·2392,·2441], |
32424 | ········"09":·[55,·2171,·2323,·2367,·2414], | 32424 | ········"09":·[55,·2171,·2323,·2367,·2414], |
32425 | ········"090097550553843":·2642, | 32425 | ········"090097550553843":·2642, |
32426 | ········"09417735":·[349,·2457,·2639], | 32426 | ········"09417735":·[349,·2457,·2639], |
32427 | ········"0943951":·1911, | 32427 | ········"0943951":·1911, |
32428 | ········"09640474436813":·675, | 32428 | ········"09640474436813":·675, |
32429 | ········"09861229":·[657,·2655], | 32429 | ········"09861229":·[657,·2655], |
32430 | ········"0994575":·2488, | ||
32430 | ········"0999755859375":·62, | 32431 | ········"0999755859375":·62, |
32431 | ········"099975586":·62, | 32432 | ········"099975586":·62, |
32432 | ········"0a1":·577, | 32433 | ········"0a1":·577, |
32433 | ········"0a2":·577, | 32434 | ········"0a2":·577, |
32434 | ········"0b00000011":·[1519,·2235], | 32435 | ········"0b00000011":·[1519,·2235], |
32435 | ········"0b1":·[34,·50,·577,·2602], | 32436 | ········"0b1":·[34,·50,·577,·2602], |
32436 | ········"0b2":·577, | 32437 | ········"0b2":·577, |
Offset 32498, 14 lines modified | Offset 32499, 15 lines modified | ||
32498 | ········"1001":·2535, | 32499 | ········"1001":·2535, |
32499 | ········"100_000":·[669,·2588], | 32500 | ········"100_000":·[669,·2588], |
32500 | ········"100j":·1909, | 32501 | ········"100j":·1909, |
32501 | ········"100x5":·652, | 32502 | ········"100x5":·652, |
32502 | ········"101":·[86,·137,·138,·143,·145,·570,·1325,·2077,·2463,·2666], | 32503 | ········"101":·[86,·137,·138,·143,·145,·570,·1325,·2077,·2463,·2666], |
32503 | ········"1010":·[145,·1519,·2077], | 32504 | ········"1010":·[145,·1519,·2077], |
32504 | ········"10100":·[143,·570], | 32505 | ········"10100":·[143,·570], |
32506 | ········"10147825":·2461, | ||
32505 | ········"1015":·2592, | 32507 | ········"1015":·2592, |
32506 | ········"10151":·2560, | 32508 | ········"10151":·2560, |
32507 | ········"102":·[2463,·2637,·2666], | 32509 | ········"102":·[2463,·2637,·2666], |
32508 | ········"1023":·[141,·2583], | 32510 | ········"1023":·[141,·2583], |
32509 | ········"1024":·[66,·72,·2658], | 32511 | ········"1024":·[66,·72,·2658], |
32510 | ········"10240":·977, | 32512 | ········"10240":·977, |
32511 | ········"103":·2463, | 32513 | ········"103":·2463, |
Offset 32555, 14 lines modified | Offset 32557, 15 lines modified | ||
32555 | ········"10622":·2536, | 32557 | ········"10622":·2536, |
32556 | ········"10624":·2536, | 32558 | ········"10624":·2536, |
32557 | ········"10629":·2536, | 32559 | ········"10629":·2536, |
32558 | ········"10630":·2536, | 32560 | ········"10630":·2536, |
32559 | ········"1066":·370, | 32561 | ········"1066":·370, |
32560 | ········"10674":·2537, | 32562 | ········"10674":·2537, |
32561 | ········"1067949133":·[420,·947], | 32563 | ········"1067949133":·[420,·947], |
32564 | ········"107":·2461, | ||
32562 | ········"1071":·2463, | 32565 | ········"1071":·2463, |
32563 | ········"10725":·2537, | 32566 | ········"10725":·2537, |
32564 | ········"10726":·2537, | 32567 | ········"10726":·2537, |
32565 | ········"10727":·2537, | 32568 | ········"10727":·2537, |
32566 | ········"10729":·2537, | 32569 | ········"10729":·2537, |
32567 | ········"1073741821":·[420,·421,·947,·948,·1923], | 32570 | ········"1073741821":·[420,·421,·947,·948,·1923], |
32568 | ········"1078":·2622, | 32571 | ········"1078":·2622, |
Offset 32981, 15 lines modified | Offset 32984, 15 lines modified | ||
32981 | ········"1500000":·2635, | 32984 | ········"1500000":·2635, |
32982 | ········"15006":·2588, | 32985 | ········"15006":·2588, |
32983 | ········"15012":·2560, | 32986 | ········"15012":·2560, |
32984 | ········"15028c96":·2668, | 32987 | ········"15028c96":·2668, |
32985 | ········"15038":·2559, | 32988 | ········"15038":·2559, |
32986 | ········"15067":·2559, | 32989 | ········"15067":·2559, |
32987 | ········"15068":·2560, | 32990 | ········"15068":·2560, |
32988 | ········"151":·[2358,·2405,·2455,·2463], | 32991 | ········"151":·[2358,·2405,·2455,·2461,·2463], |
32989 | ········"15113":·2560, | 32992 | ········"15113":·2560, |
32990 | ········"15118":·2566, | 32993 | ········"15118":·2566, |
32991 | ········"15119":·2566, | 32994 | ········"15119":·2566, |
32992 | ········"15121":·2572, | 32995 | ········"15121":·2572, |
32993 | ········"15158":·2561, | 32996 | ········"15158":·2561, |
32994 | ········"15159":·2561, | 32997 | ········"15159":·2561, |
32995 | ········"15161":·2561, | 32998 | ········"15161":·2561, |
Offset 33273, 14 lines modified | Offset 33276, 15 lines modified | ||
33273 | ········"18326":·2573, | 33276 | ········"18326":·2573, |
33274 | ········"18327":·2573, | 33277 | ········"18327":·2573, |
33275 | ········"18328":·2573, | 33278 | ········"18328":·2573, |
33276 | ········"18335":·2573, | 33279 | ········"18335":·2573, |
33277 | ········"18336":·2573, | 33280 | ········"18336":·2573, |
33278 | ········"18337":·2573, | 33281 | ········"18337":·2573, |
33279 | ········"1834":·2611, | 33282 | ········"1834":·2611, |
33283 | ········"18340158":·2461, | ||
33280 | ········"18345":·2573, | 33284 | ········"18345":·2573, |
33281 | ········"18351":·2573, | 33285 | ········"18351":·2573, |
33282 | ········"18352":·2573, | 33286 | ········"18352":·2573, |
33283 | ········"18353":·2573, | 33287 | ········"18353":·2573, |
33284 | ········"18354":·2573, | 33288 | ········"18354":·2573, |
33285 | ········"18356":·2573, | 33289 | ········"18356":·2573, |
33286 | ········"18357":·2573, | 33290 | ········"18357":·2573, |
Offset 33324, 14 lines modified | Offset 33328, 15 lines modified | ||
33324 | ········"1867":·1643, | 33328 | ········"1867":·1643, |
33325 | ········"18671":·2574, | 33329 | ········"18671":·2574, |
33326 | ········"18695":·2576, | 33330 | ········"18695":·2576, |
33327 | ········"18697":·2576, | 33331 | ········"18697":·2576, |
33328 | ········"187":·[2332,·2376,·2423], | 33332 | ········"187":·[2332,·2376,·2423], |
33329 | ········"1870":·2611, | 33333 | ········"1870":·2611, |
33330 | ········"18718":·2576, | 33334 | ········"18718":·2576, |
33335 | ········"18730772":·2488, | ||
33331 | ········"18737":·2576, | 33336 | ········"18737":·2576, |
33332 | ········"1874":·2611, | 33337 | ········"1874":·2611, |
33333 | ········"1875":·1585, | 33338 | ········"1875":·1585, |
33334 | ········"18763":·2575, | 33339 | ········"18763":·2575, |
33335 | ········"18764":·2575, | 33340 | ········"18764":·2575, |
33336 | ········"18768":·2575, | 33341 | ········"18768":·2575, |
33337 | ········"18769":·2575, | 33342 | ········"18769":·2575, |
Offset 33454, 15 lines modified | Offset 33459, 15 lines modified | ||
33454 | ········"19668":·2578, | 33459 | ········"19668":·2578, |
33455 | ········"19671":·2578, | 33460 | ········"19671":·2578, |
33456 | ········"19676":·2578, | 33461 | ········"19676":·2578, |
33457 | ········"19677":·2578, | 33462 | ········"19677":·2578, |
33458 | ········"19680":·2583, | 33463 | ········"19680":·2583, |
33459 | ········"19687":·2583, | 33464 | ········"19687":·2583, |
33460 | ········"1969":·55, | 33465 | ········"1969":·55, |
33461 | ········"197":· | 33466 | ········"197":·2666, |
33462 | ········"1970":·[55,·62], | 33467 | ········"1970":·[55,·62], |
33463 | ········"1971":·55, | 33468 | ········"1971":·55, |
33464 | ········"1972":·[351,·2105,·2166,·2167,·2316,·2327,·2329,·2356,·2361,·2372,·2373,·2403,·2408,·2419,·2420,·2453], | 33469 | ········"1972":·[351,·2105,·2166,·2167,·2316,·2327,·2329,·2356,·2361,·2372,·2373,·2403,·2408,·2419,·2420,·2453], |
33465 | ········"19745":·2579, | 33470 | ········"19745":·2579, |
33466 | ········"1975":·[136,·523,·524,·566], | 33471 | ········"1975":·[136,·523,·524,·566], |
33467 | ········"19754":·2583, | 33472 | ········"19754":·2583, |
33468 | ········"19775622":·2642, | 33473 | ········"19775622":·2642, |
Offset 33581, 15 lines modified | Offset 33586, 14 lines modified | ||
33581 | ········"20298":·2580, | 33586 | ········"20298":·2580, |
33582 | ········"202x":·2583, | 33587 | ········"202x":·2583, |
33583 | ········"203":·[1654,·2457,·2637], | 33588 | ········"203":·[1654,·2457,·2637], |
33584 | ········"20300":·2580, | 33589 | ········"20300":·2580, |
33585 | ········"20302":·2580, | 33590 | ········"20302":·2580, |
33586 | ········"20314":·2583, | 33591 | ········"20314":·2583, |
33587 | ········"20324493e":·54, | 33592 | ········"20324493e":·54, |
33588 | ········"20327532":·2461, | ||
33589 | ········"2033":·2612, | 33593 | ········"2033":·2612, |
33590 | ········"20357":·2581, | 33594 | ········"20357":·2581, |
33591 | ········"20394":·2588, | 33595 | ········"20394":·2588, |
33592 | ········"20414":·2588, | 33596 | ········"20414":·2588, |
33593 | ········"2045":·2612, | 33597 | ········"2045":·2612, |
33594 | ········"2046":·2612, | 33598 | ········"2046":·2612, |
33595 | ········"20462":·2581, | 33599 | ········"20462":·2581, |
Max diff block lines reached; 23577/27171 bytes (86.77%) of diff not shown. |