Skip to content

Commit

Permalink
hw update
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewning committed Jan 11, 2025
1 parent 2344c8b commit 049ef83
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion atom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<title>FLOW Lab</title>
<link href="http://flow.byu.edu/atom.xml" rel="self"/>
<link href="http://flow.byu.edu/"/>
<updated>2025-01-09T15:40:54-07:00</updated>
<updated>2025-01-11T15:43:50-07:00</updated>
<id>http://flow.byu.edu</id>
<author>
<name>Andrew Ning</name>
Expand Down
2 changes: 1 addition & 1 deletion feed.xml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.3.4">Jekyll</generator><link href="http://flow.byu.edu/feed.xml" rel="self" type="application/atom+xml" /><link href="http://flow.byu.edu/" rel="alternate" type="text/html" /><updated>2025-01-09T15:40:54-07:00</updated><id>http://flow.byu.edu/feed.xml</id><title type="html">FLOW Lab</title><subtitle>Flight, Optimization, and Wind Laboratory</subtitle><author><name>Andrew Ning</name></author><entry><title type="html">Optimization Book Available</title><link href="http://flow.byu.edu/posts/opt-book" rel="alternate" type="text/html" title="Optimization Book Available" /><published>2021-10-15T00:00:00-06:00</published><updated>2021-10-15T00:00:00-06:00</updated><id>http://flow.byu.edu/posts/opt-book</id><content type="html" xml:base="http://flow.byu.edu/posts/opt-book"><![CDATA[<iframe src="https://www.linkedin.com/embed/feed/update/urn:li:share:6853387400052391936" height="698" width="504" frameborder="0" allowfullscreen="" title="Embedded post"></iframe>]]></content><author><name>Andrew Ning</name></author><summary type="html"><![CDATA[]]></summary></entry><entry><title type="html">BEM Paper</title><link href="http://flow.byu.edu/posts/bem-paper" rel="alternate" type="text/html" title="BEM Paper" /><published>2021-07-30T00:00:00-06:00</published><updated>2021-07-30T00:00:00-06:00</updated><id>http://flow.byu.edu/posts/bem-paper</id><content type="html" xml:base="http://flow.byu.edu/posts/bem-paper"><![CDATA[<iframe src="https://www.linkedin.com/embed/feed/update/urn:li:share:6825450879324434432" height="622" width="504" frameborder="0" allowfullscreen="" title="Embedded post"></iframe>]]></content><author><name>Andrew Ning</name></author><summary type="html"><![CDATA[]]></summary></entry><entry><title type="html">Eduardo Research Update</title><link href="http://flow.byu.edu/posts/eduardo-latest" rel="alternate" type="text/html" title="Eduardo Research Update" /><published>2021-03-01T00:00:00-07:00</published><updated>2021-03-01T00:00:00-07:00</updated><id>http://flow.byu.edu/posts/eduardo-latest</id><content type="html" xml:base="http://flow.byu.edu/posts/eduardo-latest"><![CDATA[<iframe src="https://www.linkedin.com/embed/feed/update/urn:li:ugcPost:6779795433318420480" height="1142" width="504" frameborder="0" allowfullscreen="" title="Embedded post"></iframe>]]></content><author><name>Eduardo Alvarez</name></author><summary type="html"><![CDATA[]]></summary></entry><entry><title type="html">Reformulated VPM</title><link href="http://flow.byu.edu/posts/reformulated-vpm" rel="alternate" type="text/html" title="Reformulated VPM" /><published>2021-02-01T00:00:00-07:00</published><updated>2021-02-01T00:00:00-07:00</updated><id>http://flow.byu.edu/posts/reformulated-vpm</id><content type="html" xml:base="http://flow.byu.edu/posts/reformulated-vpm"><![CDATA[<iframe src="https://www.linkedin.com/embed/feed/update/urn:li:ugcPost:6767685749157588992" height="990" width="504" frameborder="0" allowfullscreen="" title="Embedded post"></iframe>]]></content><author><name>Eduardo Alvarez</name></author><summary type="html"><![CDATA[]]></summary></entry><entry><title type="html">Optimization Book Announcement</title><link href="http://flow.byu.edu/posts/optimization-book" rel="alternate" type="text/html" title="Optimization Book Announcement" /><published>2021-01-20T00:00:00-07:00</published><updated>2021-01-20T00:00:00-07:00</updated><id>http://flow.byu.edu/posts/optimization-book</id><content type="html" xml:base="http://flow.byu.edu/posts/optimization-book"><![CDATA[<iframe src="https://www.linkedin.com/embed/feed/update/urn:li:share:6758135437300154368" height="679" width="504" frameborder="0" allowfullscreen="" title="Embedded post"></iframe>]]></content><author><name>Andrew Ning</name></author><summary type="html"><![CDATA[]]></summary></entry><entry><title type="html">PJ Defense</title><link href="http://flow.byu.edu/posts/pj-defense" rel="alternate" type="text/html" title="PJ Defense" /><published>2020-09-30T00:00:00-06:00</published><updated>2020-09-30T00:00:00-06:00</updated><id>http://flow.byu.edu/posts/pj-defense</id><content type="html" xml:base="http://flow.byu.edu/posts/pj-defense"><![CDATA[<iframe src="https://www.linkedin.com/embed/feed/update/urn:li:share:6714312529692237824" height="641" width="504" frameborder="0" allowfullscreen="" title="Embedded post"></iframe>]]></content><author><name>Andrew Ning</name></author><summary type="html"><![CDATA[]]></summary></entry><entry><title type="html">VPM Paper</title><link href="http://flow.byu.edu/posts/vpm-paper" rel="alternate" type="text/html" title="VPM Paper" /><published>2020-08-30T00:00:00-06:00</published><updated>2020-08-30T00:00:00-06:00</updated><id>http://flow.byu.edu/posts/vpm-paper</id><content type="html" xml:base="http://flow.byu.edu/posts/vpm-paper"><![CDATA[<iframe src="https://www.linkedin.com/embed/feed/update/urn:li:ugcPost:6711406263634419712" height="857" width="504" frameborder="0" allowfullscreen="" title="Embedded post"></iframe>]]></content><author><name>Eduardo Alvarez</name></author><summary type="html"><![CDATA[]]></summary></entry><entry><title type="html">Airborne Wind with Vortex Particle Method</title><link href="http://flow.byu.edu/posts/wind-harvesting" rel="alternate" type="text/html" title="Airborne Wind with Vortex Particle Method" /><published>2020-08-16T00:00:00-06:00</published><updated>2020-08-16T00:00:00-06:00</updated><id>http://flow.byu.edu/posts/wind-harvesting</id><content type="html" xml:base="http://flow.byu.edu/posts/wind-harvesting"><![CDATA[<iframe src="https://www.linkedin.com/embed/feed/update/urn:li:ugcPost:6694076731474739200" height="949" width="504" frameborder="0" allowfullscreen="" title="Embedded post"></iframe>]]></content><author><name>Judd Mehr and Eduardo Alvarez</name></author><summary type="html"><![CDATA[]]></summary></entry><entry><title type="html">Eduardo’s Past Three Years</title><link href="http://flow.byu.edu/posts/eduardo-three-years" rel="alternate" type="text/html" title="Eduardo’s Past Three Years" /><published>2020-08-10T00:00:00-06:00</published><updated>2020-08-10T00:00:00-06:00</updated><id>http://flow.byu.edu/posts/eduardo-three-years</id><content type="html" xml:base="http://flow.byu.edu/posts/eduardo-three-years"><![CDATA[<iframe src="https://www.linkedin.com/embed/feed/update/urn:li:ugcPost:6689985497042944000" height="797" width="504" frameborder="0" allowfullscreen="" title="Embedded post"></iframe>]]></content><author><name>Eduardo Alvarez</name></author><summary type="html"><![CDATA[]]></summary></entry><entry><title type="html">FLOWUnsteady in Google Drive</title><link href="http://flow.byu.edu/posts/google-drive-vpm" rel="alternate" type="text/html" title="FLOWUnsteady in Google Drive" /><published>2020-08-02T00:00:00-06:00</published><updated>2020-08-02T00:00:00-06:00</updated><id>http://flow.byu.edu/posts/google-drive-vpm</id><content type="html" xml:base="http://flow.byu.edu/posts/google-drive-vpm"><![CDATA[<iframe src="https://www.linkedin.com/embed/feed/update/urn:li:share:6689003185174118400" height="1094" width="504" frameborder="0" allowfullscreen="" title="Embedded post"></iframe>]]></content><author><name>Eduardo Alvarez</name></author><summary type="html"><![CDATA[]]></summary></entry></feed>
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.3.4">Jekyll</generator><link href="http://flow.byu.edu/feed.xml" rel="self" type="application/atom+xml" /><link href="http://flow.byu.edu/" rel="alternate" type="text/html" /><updated>2025-01-11T15:43:50-07:00</updated><id>http://flow.byu.edu/feed.xml</id><title type="html">FLOW Lab</title><subtitle>Flight, Optimization, and Wind Laboratory</subtitle><author><name>Andrew Ning</name></author><entry><title type="html">Optimization Book Available</title><link href="http://flow.byu.edu/posts/opt-book" rel="alternate" type="text/html" title="Optimization Book Available" /><published>2021-10-15T00:00:00-06:00</published><updated>2021-10-15T00:00:00-06:00</updated><id>http://flow.byu.edu/posts/opt-book</id><content type="html" xml:base="http://flow.byu.edu/posts/opt-book"><![CDATA[<iframe src="https://www.linkedin.com/embed/feed/update/urn:li:share:6853387400052391936" height="698" width="504" frameborder="0" allowfullscreen="" title="Embedded post"></iframe>]]></content><author><name>Andrew Ning</name></author><summary type="html"><![CDATA[]]></summary></entry><entry><title type="html">BEM Paper</title><link href="http://flow.byu.edu/posts/bem-paper" rel="alternate" type="text/html" title="BEM Paper" /><published>2021-07-30T00:00:00-06:00</published><updated>2021-07-30T00:00:00-06:00</updated><id>http://flow.byu.edu/posts/bem-paper</id><content type="html" xml:base="http://flow.byu.edu/posts/bem-paper"><![CDATA[<iframe src="https://www.linkedin.com/embed/feed/update/urn:li:share:6825450879324434432" height="622" width="504" frameborder="0" allowfullscreen="" title="Embedded post"></iframe>]]></content><author><name>Andrew Ning</name></author><summary type="html"><![CDATA[]]></summary></entry><entry><title type="html">Eduardo Research Update</title><link href="http://flow.byu.edu/posts/eduardo-latest" rel="alternate" type="text/html" title="Eduardo Research Update" /><published>2021-03-01T00:00:00-07:00</published><updated>2021-03-01T00:00:00-07:00</updated><id>http://flow.byu.edu/posts/eduardo-latest</id><content type="html" xml:base="http://flow.byu.edu/posts/eduardo-latest"><![CDATA[<iframe src="https://www.linkedin.com/embed/feed/update/urn:li:ugcPost:6779795433318420480" height="1142" width="504" frameborder="0" allowfullscreen="" title="Embedded post"></iframe>]]></content><author><name>Eduardo Alvarez</name></author><summary type="html"><![CDATA[]]></summary></entry><entry><title type="html">Reformulated VPM</title><link href="http://flow.byu.edu/posts/reformulated-vpm" rel="alternate" type="text/html" title="Reformulated VPM" /><published>2021-02-01T00:00:00-07:00</published><updated>2021-02-01T00:00:00-07:00</updated><id>http://flow.byu.edu/posts/reformulated-vpm</id><content type="html" xml:base="http://flow.byu.edu/posts/reformulated-vpm"><![CDATA[<iframe src="https://www.linkedin.com/embed/feed/update/urn:li:ugcPost:6767685749157588992" height="990" width="504" frameborder="0" allowfullscreen="" title="Embedded post"></iframe>]]></content><author><name>Eduardo Alvarez</name></author><summary type="html"><![CDATA[]]></summary></entry><entry><title type="html">Optimization Book Announcement</title><link href="http://flow.byu.edu/posts/optimization-book" rel="alternate" type="text/html" title="Optimization Book Announcement" /><published>2021-01-20T00:00:00-07:00</published><updated>2021-01-20T00:00:00-07:00</updated><id>http://flow.byu.edu/posts/optimization-book</id><content type="html" xml:base="http://flow.byu.edu/posts/optimization-book"><![CDATA[<iframe src="https://www.linkedin.com/embed/feed/update/urn:li:share:6758135437300154368" height="679" width="504" frameborder="0" allowfullscreen="" title="Embedded post"></iframe>]]></content><author><name>Andrew Ning</name></author><summary type="html"><![CDATA[]]></summary></entry><entry><title type="html">PJ Defense</title><link href="http://flow.byu.edu/posts/pj-defense" rel="alternate" type="text/html" title="PJ Defense" /><published>2020-09-30T00:00:00-06:00</published><updated>2020-09-30T00:00:00-06:00</updated><id>http://flow.byu.edu/posts/pj-defense</id><content type="html" xml:base="http://flow.byu.edu/posts/pj-defense"><![CDATA[<iframe src="https://www.linkedin.com/embed/feed/update/urn:li:share:6714312529692237824" height="641" width="504" frameborder="0" allowfullscreen="" title="Embedded post"></iframe>]]></content><author><name>Andrew Ning</name></author><summary type="html"><![CDATA[]]></summary></entry><entry><title type="html">VPM Paper</title><link href="http://flow.byu.edu/posts/vpm-paper" rel="alternate" type="text/html" title="VPM Paper" /><published>2020-08-30T00:00:00-06:00</published><updated>2020-08-30T00:00:00-06:00</updated><id>http://flow.byu.edu/posts/vpm-paper</id><content type="html" xml:base="http://flow.byu.edu/posts/vpm-paper"><![CDATA[<iframe src="https://www.linkedin.com/embed/feed/update/urn:li:ugcPost:6711406263634419712" height="857" width="504" frameborder="0" allowfullscreen="" title="Embedded post"></iframe>]]></content><author><name>Eduardo Alvarez</name></author><summary type="html"><![CDATA[]]></summary></entry><entry><title type="html">Airborne Wind with Vortex Particle Method</title><link href="http://flow.byu.edu/posts/wind-harvesting" rel="alternate" type="text/html" title="Airborne Wind with Vortex Particle Method" /><published>2020-08-16T00:00:00-06:00</published><updated>2020-08-16T00:00:00-06:00</updated><id>http://flow.byu.edu/posts/wind-harvesting</id><content type="html" xml:base="http://flow.byu.edu/posts/wind-harvesting"><![CDATA[<iframe src="https://www.linkedin.com/embed/feed/update/urn:li:ugcPost:6694076731474739200" height="949" width="504" frameborder="0" allowfullscreen="" title="Embedded post"></iframe>]]></content><author><name>Judd Mehr and Eduardo Alvarez</name></author><summary type="html"><![CDATA[]]></summary></entry><entry><title type="html">Eduardo’s Past Three Years</title><link href="http://flow.byu.edu/posts/eduardo-three-years" rel="alternate" type="text/html" title="Eduardo’s Past Three Years" /><published>2020-08-10T00:00:00-06:00</published><updated>2020-08-10T00:00:00-06:00</updated><id>http://flow.byu.edu/posts/eduardo-three-years</id><content type="html" xml:base="http://flow.byu.edu/posts/eduardo-three-years"><![CDATA[<iframe src="https://www.linkedin.com/embed/feed/update/urn:li:ugcPost:6689985497042944000" height="797" width="504" frameborder="0" allowfullscreen="" title="Embedded post"></iframe>]]></content><author><name>Eduardo Alvarez</name></author><summary type="html"><![CDATA[]]></summary></entry><entry><title type="html">FLOWUnsteady in Google Drive</title><link href="http://flow.byu.edu/posts/google-drive-vpm" rel="alternate" type="text/html" title="FLOWUnsteady in Google Drive" /><published>2020-08-02T00:00:00-06:00</published><updated>2020-08-02T00:00:00-06:00</updated><id>http://flow.byu.edu/posts/google-drive-vpm</id><content type="html" xml:base="http://flow.byu.edu/posts/google-drive-vpm"><![CDATA[<iframe src="https://www.linkedin.com/embed/feed/update/urn:li:share:6689003185174118400" height="1094" width="504" frameborder="0" allowfullscreen="" title="Embedded post"></iframe>]]></content><author><name>Eduardo Alvarez</name></author><summary type="html"><![CDATA[]]></summary></entry></feed>
22 changes: 15 additions & 7 deletions me595r/schedule/hw1/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,27 @@ <h2 id="hw-1-vanilla-nn">HW 1: Vanilla NN</h2>

<p>Download the <a href="https://archive.ics.uci.edu/dataset/9/auto+mpg">Auto MPG</a> dataset, specifically the file <code class="language-plaintext highlighter-rouge">auto-mpg.data</code>. The <code class="language-plaintext highlighter-rouge">auto-mpg.names</code> file describes each of the 9 columns. Our goal will be to use this data to predict an automobile’s mpg as a function of the other parameters (except for “car name”, which we won’t need).</p>

<p>First, some data preparation. Some of the rows have missing values —eliminate those rows from your dataset. Next, randomly separate the data into a training set and a testing set (with an 80/20 train/test split). Finally, normalize the inputs of each column using a standard normal distribution:</p>
<p>First, some data preparation. Some of the rows have missing values —eliminate those rows from your dataset (you can do that beforehand or just in a loop when you read in the file). Next, normalize the inputs of each column using a standard normal distribution:</p>

\[\hat{x_i} = \frac{x_i - \mu_{x_i}}{\sigma_{x_i}}\]

<p>where \(\mu\) and \(\sigma\) are the mean and standard deviation respectively of the column. It is generally desirable for the input data to be zero-centered (especially with zero-centered activation functions) and also helps avoid biasing weights towards a particular sign. It is also usually helpful to normalize so that we don’t bias the influence of some parameters over others just because of their magnitude (i.e., a unit choice). It is often also helpful to normalize the targets (mpg), though if you do, remember to unnormalize them when plotting/printing results to get back the actual mpg values.</p>
<p>where \(\mu\) and \(\sigma\) are the mean and standard deviation respectively of the column.
It is generally desirable for the input data to be zero-centered, and also helps avoid biasing weights towards a particular sign. It is also usually helpful to normalize so that we don’t bias the influence of some parameters over others just because of their magnitude (i.e., a unit choice). It is often also helpful to normalize the targets (mpg), though if you do, remember to unnormalize them when plotting/printing results to get back the actual mpg values.</p>

<p>Setup a neural net with two hidden layers. You’ll need to experiment some with different layer widths, activation functions, batch sizes, learning rates, and number of epochs. You should be able to get down to an average absolute error of about 2 mpg on the <em>test set</em>. You’ll see some scatter in the results for sure, but that’s still pretty decent predictive capability given how little data we have (and no physics).</p>
<p>Finally, randomly separate the data into a training set and a testing set (with an 80/20 train/test split).</p>

<p>Plot the following:</p>
<p>Setup a neural net with two layers (just one hidden layer). You’ll need to experiment some with different layer widths, activation functions, batch sizes, learning rates, and number of epochs. You should be able to an average absolute error of under 2 mpg on the <em>test set</em>. You’ll see some scatter in the results for sure, but that’s still pretty decent predictive capability given how little data we have (and no physics).</p>

<p>To turn in:</p>
<ul>
<li>Plot the objective (mean squared error) across each iteration for both the training and testing set on the same plot.</li>
<li>Once training is complete, report your average absolute error of the test set in mpg (again you should be able to get under 2, we’ll say under 2.25 to give some buffer).</li>
</ul>

<p>Not required stuff:</p>
<ul>
<li>The objective (mean squared error) across each iteration for both the training and testing set on the same plot.</li>
<li>The average absolute error of the test set across each iteration.</li>
<li>Plot the actual mpg and the model predictions, for the test set, against each other. Plot also a straight diagonal line for reference (the line of perfect predictions).</li>
<li>Note that while MSE is a reasonable objective, it is not always the most intuitive to interpret so it can be helpful to plot other quantities (like in this case mean absolute error).</li>
<li>One way to look at predictive capabilities is to plot the actual mpg and the predictions, both from test set, against each other. Plot also a straight diagonal line for reference (the line of perfect predictions).</li>
</ul>


Expand Down

0 comments on commit 049ef83

Please sign in to comment.