update
This commit is contained in:
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -28,7 +28,7 @@ display(data_pandas)
|
||||
|
||||
[0;31m---------------------------------------------------------------------------[0m
|
||||
[0;31mAttributeError[0m Traceback (most recent call last)
|
||||
[0;32m/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_12649/1326197715.py[0m in [0;36m?[0;34m()[0m
|
||||
[0;32m/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_15329/1326197715.py[0m in [0;36m?[0;34m()[0m
|
||||
[0;32m----> 6[0;31m new_hobbit = {'First Name': ["Peregrin"],
|
||||
[0m[1;32m 7[0m [0;34m'Last Name'[0m[0;34m:[0m [0;34m[[0m[0;34m"Took"[0m[0;34m][0m[0;34m,[0m[0;34m[0m[0;34m[0m[0m
|
||||
[1;32m 8[0m [0;34m'Place of birth'[0m[0;34m:[0m [0;34m[[0m[0;34m"Shire"[0m[0;34m][0m[0;34m,[0m[0;34m[0m[0;34m[0m[0m
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -518,6 +518,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
<a class="reference internal nav-link" href="#meet-the-pandas">
|
||||
Meet the Pandas
|
||||
</a>
|
||||
</li>
|
||||
<li class="toc-h2 nav-item toc-entry">
|
||||
<a class="reference internal nav-link" href="#pandas-ai">
|
||||
Pandas AI
|
||||
</a>
|
||||
<ul class="nav section-nav flex-column">
|
||||
<li class="toc-h3 nav-item toc-entry">
|
||||
<a class="reference internal nav-link" href="#simple-linear-regression-model-using-scikit-learn">
|
||||
@@ -619,11 +624,6 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Interpretations and optimizing our parameters
|
||||
</a>
|
||||
</li>
|
||||
<li class="toc-h2 nav-item toc-entry">
|
||||
<a class="reference internal nav-link" href="#some-useful-matrix-and-vector-expressions">
|
||||
Some useful matrix and vector expressions
|
||||
</a>
|
||||
</li>
|
||||
<li class="toc-h2 nav-item toc-entry">
|
||||
<a class="reference internal nav-link" href="#id3">
|
||||
Interpretations and optimizing our parameters
|
||||
@@ -927,6 +927,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
<a class="reference internal nav-link" href="#meet-the-pandas">
|
||||
Meet the Pandas
|
||||
</a>
|
||||
</li>
|
||||
<li class="toc-h2 nav-item toc-entry">
|
||||
<a class="reference internal nav-link" href="#pandas-ai">
|
||||
Pandas AI
|
||||
</a>
|
||||
<ul class="nav section-nav flex-column">
|
||||
<li class="toc-h3 nav-item toc-entry">
|
||||
<a class="reference internal nav-link" href="#simple-linear-regression-model-using-scikit-learn">
|
||||
@@ -1028,11 +1033,6 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Interpretations and optimizing our parameters
|
||||
</a>
|
||||
</li>
|
||||
<li class="toc-h2 nav-item toc-entry">
|
||||
<a class="reference internal nav-link" href="#some-useful-matrix-and-vector-expressions">
|
||||
Some useful matrix and vector expressions
|
||||
</a>
|
||||
</li>
|
||||
<li class="toc-h2 nav-item toc-entry">
|
||||
<a class="reference internal nav-link" href="#id3">
|
||||
Interpretations and optimizing our parameters
|
||||
@@ -1195,7 +1195,7 @@ doconce format html week34.do.txt --no_mako -->
|
||||
<h2>Communication channels<a class="headerlink" href="#communication-channels" title="Permalink to this headline">¶</a></h2>
|
||||
<ul class="simple">
|
||||
<li><p>Communications (email and more) via <<a class="reference external" href="http://canvas.uio.no">canvas.uio.no</a>></p></li>
|
||||
<li><p><strong>Discord</strong> channel at <a class="reference external" href="https://discord.gg/hAaBRWFT72">https://discord.gg/hAaBRWFT72</a></p></li>
|
||||
<li><p><strong>Discord</strong> channel at <a class="reference external" href="https://discord.gg/XBKjd4ccGq">https://discord.gg/XBKjd4ccGq</a></p></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="course-format">
|
||||
@@ -1631,8 +1631,8 @@ developed in the 1970s, namely EISPACK and LINPACK. We describe them shortly he
|
||||
</div>
|
||||
</div>
|
||||
<div class="cell_output docutils container">
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[-0.44642273 -0.20366091 -0.49369173 0.65652778 0.49580918 -0.93137583
|
||||
1.23177548 1.6608592 -0.69492254 0.11655508]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[ 0.64018793 0.2356299 0.43392925 -0.96042508 -1.60108393 -1.54514209
|
||||
-0.74631004 1.03310687 -0.59939312 1.96861187]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1857,26 +1857,26 @@ lowercase letters for vectors and uppercase letters for matrices)</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cell_output docutils container">
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[[0.49486583 0.8087144 0.91855299 0.6448861 0.74849204 0.91699467
|
||||
0.94466321 0.75162857 0.32220836 0.25549693]
|
||||
[0.3825029 0.15654521 0.93482217 0.24809277 0.25772788 0.96856697
|
||||
0.64064106 0.47128426 0.66855692 0.51821339]
|
||||
[0.83509815 0.36348681 0.23395094 0.99418976 0.69827131 0.7659922
|
||||
0.81307569 0.20752401 0.99377492 0.89976047]
|
||||
[0.34498001 0.33880129 0.43233857 0.35329636 0.62606121 0.85466682
|
||||
0.76097737 0.84421309 0.08145936 0.64110154]
|
||||
[0.96019951 0.96087803 0.38220141 0.46609435 0.56733919 0.46895658
|
||||
0.22679825 0.96852109 0.00704347 0.63565881]
|
||||
[0.21074205 0.97861433 0.38382691 0.49873827 0.87196574 0.08434487
|
||||
0.3546689 0.11053892 0.02865084 0.87134207]
|
||||
[0.32078531 0.07563916 0.97346886 0.79529368 0.20430356 0.45047066
|
||||
0.83446313 0.17964265 0.37054827 0.95115279]
|
||||
[0.59922967 0.00145601 0.93873645 0.02592329 0.68250601 0.48699577
|
||||
0.50083166 0.20525241 0.03880581 0.34975242]
|
||||
[0.17016741 0.09648484 0.47781605 0.58621153 0.32019835 0.91700604
|
||||
0.93363269 0.83167477 0.34254681 0.08319649]
|
||||
[0.38845241 0.09706624 0.34606431 0.93082209 0.5105983 0.97939372
|
||||
0.8773885 0.12911793 0.54129367 0.58662003]]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[[0.42876571 0.35984424 0.18269964 0.07859555 0.49648665 0.56686787
|
||||
0.2700575 0.54622374 0.90911719 0.15597277]
|
||||
[0.34609499 0.58196606 0.74995126 0.03325534 0.40837262 0.80946326
|
||||
0.77124043 0.43334205 0.28433473 0.47868192]
|
||||
[0.27700271 0.41842164 0.94589469 0.69127233 0.00320591 0.16325134
|
||||
0.79375465 0.38875182 0.82084195 0.88364362]
|
||||
[0.56676694 0.38743286 0.48417033 0.42203045 0.77669775 0.29259268
|
||||
0.15953495 0.49940538 0.1724601 0.09995364]
|
||||
[0.87386332 0.0377625 0.57677544 0.5733843 0.54672588 0.06199837
|
||||
0.82029869 0.35292923 0.91210472 0.40167092]
|
||||
[0.07747943 0.6727393 0.09899913 0.28767964 0.15806326 0.44082882
|
||||
0.28031381 0.20716469 0.15912833 0.64056731]
|
||||
[0.31072238 0.69966724 0.24647622 0.53895778 0.76206763 0.6088727
|
||||
0.57406865 0.54993524 0.34010963 0.01842607]
|
||||
[0.57146034 0.45017176 0.8729107 0.7047854 0.66289131 0.84495995
|
||||
0.34636057 0.62765028 0.27252371 0.08101799]
|
||||
[0.69275323 0.66979282 0.79161356 0.81112337 0.33788596 0.01617829
|
||||
0.02971902 0.19718893 0.55152034 0.89686618]
|
||||
[0.78944094 0.7451077 0.99972468 0.16816701 0.41739393 0.46117193
|
||||
0.81990111 0.72452914 0.56749245 0.53452255]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1931,13 +1931,13 @@ covariance matrix through the <strong>np.linalg.eig()</strong> function.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cell_output docutils container">
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>-0.0963911829588757
|
||||
3.757019617707678
|
||||
0.10552836390308734
|
||||
[[ 1.11105306 3.48263731 4.1473833 ]
|
||||
[ 3.48263731 11.83909743 12.7296587 ]
|
||||
[ 4.1473833 12.7296587 29.56151035]]
|
||||
[36.9908934 0.07119676 5.44957069]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.05915945740690532
|
||||
4.428690538456245
|
||||
0.48096529707360347
|
||||
[[ 1.10641647 3.26697059 3.35823605]
|
||||
[ 3.26697059 10.73492514 10.22297752]
|
||||
[ 3.35823605 10.22297752 16.60792149]]
|
||||
[25.20485165 0.09603196 3.14837948]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2162,7 +2162,7 @@ Name: Aragorn, dtype: object
|
||||
<div class="cell_output docutils container">
|
||||
<div class="output traceback highlight-ipythontb notranslate"><div class="highlight"><pre><span></span><span class="gt">---------------------------------------------------------------------------</span>
|
||||
<span class="ne">AttributeError</span><span class="g g-Whitespace"> </span>Traceback (most recent call last)
|
||||
<span class="nn">/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_12649/1326197715.py</span> in <span class="ni">?</span><span class="nt">()</span>
|
||||
<span class="nn">/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_15329/1326197715.py</span> in <span class="ni">?</span><span class="nt">()</span>
|
||||
<span class="ne">----> </span><span class="mi">6</span> <span class="n">new_hobbit</span> <span class="o">=</span> <span class="p">{</span><span class="s1">'First Name'</span><span class="p">:</span> <span class="p">[</span><span class="s2">"Peregrin"</span><span class="p">],</span>
|
||||
<span class="g g-Whitespace"> </span><span class="mi">7</span> <span class="s1">'Last Name'</span><span class="p">:</span> <span class="p">[</span><span class="s2">"Took"</span><span class="p">],</span>
|
||||
<span class="g g-Whitespace"> </span><span class="mi">8</span> <span class="s1">'Place of birth'</span><span class="p">:</span> <span class="p">[</span><span class="s2">"Shire"</span><span class="p">],</span>
|
||||
@@ -2244,6 +2244,10 @@ we have just a single column of data. It shares many of the same features as <st
|
||||
most operations are vectorized, achieving thereby a high performance when dealing with computations of arrays, in particular labeled arrays.
|
||||
As we will see below it leads also to a very concice code close to the mathematical operations we may be interested in.
|
||||
For multidimensional arrays, we recommend strongly <a class="reference external" href="http://xarray.pydata.org/en/stable/">xarray</a>. <strong>xarray</strong> has much of the same flexibility as <strong>pandas</strong>, but allows for the extension to higher dimensions than two. We will see examples later of the usage of both <strong>pandas</strong> and <strong>xarray</strong>.</p>
|
||||
</div>
|
||||
<div class="section" id="pandas-ai">
|
||||
<h2>Pandas AI<a class="headerlink" href="#pandas-ai" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Try out <a class="reference external" href="https://pandas-ai.com/">Pandas AI</a></p>
|
||||
<div class="section" id="simple-linear-regression-model-using-scikit-learn">
|
||||
<h3>Simple linear regression model using <strong>scikit-learn</strong><a class="headerlink" href="#simple-linear-regression-model-using-scikit-learn" title="Permalink to this headline">¶</a></h3>
|
||||
<p>We start with perhaps our simplest possible example, using <strong>Scikit-Learn</strong> to perform linear regression analysis on a data set produced by us.</p>
|
||||
@@ -3165,11 +3169,6 @@ allow for the usage of direct linear algebra methods such as <strong>LU</strong>
|
||||
<span class="math notranslate nohighlight">\(\boldsymbol{X}^T\boldsymbol{X}\)</span>.</p>
|
||||
<p><strong>Small question</strong>: Do you think the example we have at hand here (the nuclear binding energies) can lead to problems in inverting the matrix <span class="math notranslate nohighlight">\(\boldsymbol{X}^T\boldsymbol{X}\)</span>? What kind of problems can we expect?</p>
|
||||
</div>
|
||||
<div class="section" id="some-useful-matrix-and-vector-expressions">
|
||||
<h2>Some useful matrix and vector expressions<a class="headerlink" href="#some-useful-matrix-and-vector-expressions" title="Permalink to this headline">¶</a></h2>
|
||||
<p>See the handwritten notes at <a class="reference external" href="https://github.com/CompPhysics/MachineLearning/blob/master/doc/HandWrittenNotes/2022/NotesExercise5Week452022.pdf">https://github.com/CompPhysics/MachineLearning/blob/master/doc/HandWrittenNotes/2022/NotesExercise5Week452022.pdf</a></p>
|
||||
<p>These notes will be discussed during one of the lectures.</p>
|
||||
</div>
|
||||
<div class="section" id="id3">
|
||||
<h2>Interpretations and optimizing our parameters<a class="headerlink" href="#id3" title="Permalink to this headline">¶</a></h2>
|
||||
<p>The residuals <span class="math notranslate nohighlight">\(\boldsymbol{\epsilon}\)</span> are in turn given by</p>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -56,7 +56,7 @@
|
||||
#
|
||||
# * Communications (email and more) via <canvas.uio.no>
|
||||
#
|
||||
# * **Discord** channel at <https://discord.gg/hAaBRWFT72>
|
||||
# * **Discord** channel at <https://discord.gg/XBKjd4ccGq>
|
||||
|
||||
# ## Course Format
|
||||
#
|
||||
@@ -898,6 +898,10 @@ print(df1)
|
||||
# As we will see below it leads also to a very concice code close to the mathematical operations we may be interested in.
|
||||
# For multidimensional arrays, we recommend strongly [xarray](http://xarray.pydata.org/en/stable/). **xarray** has much of the same flexibility as **pandas**, but allows for the extension to higher dimensions than two. We will see examples later of the usage of both **pandas** and **xarray**.
|
||||
|
||||
# ## Pandas AI
|
||||
#
|
||||
# Try out [Pandas AI](https://pandas-ai.com/)
|
||||
|
||||
# ### Simple linear regression model using **scikit-learn**
|
||||
#
|
||||
# We start with perhaps our simplest possible example, using **Scikit-Learn** to perform linear regression analysis on a data set produced by us.
|
||||
@@ -1894,12 +1898,6 @@ display(DesignMatrix)
|
||||
#
|
||||
# **Small question**: Do you think the example we have at hand here (the nuclear binding energies) can lead to problems in inverting the matrix $\boldsymbol{X}^T\boldsymbol{X}$? What kind of problems can we expect?
|
||||
|
||||
# ## Some useful matrix and vector expressions
|
||||
#
|
||||
# See the handwritten notes at <https://github.com/CompPhysics/MachineLearning/blob/master/doc/HandWrittenNotes/2022/NotesExercise5Week452022.pdf>
|
||||
#
|
||||
# These notes will be discussed during one of the lectures.
|
||||
|
||||
# ## Interpretations and optimizing our parameters
|
||||
# The residuals $\boldsymbol{\epsilon}$ are in turn given by
|
||||
|
||||
|
||||
+313
-315
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user