Skip to content

Commit

Permalink
Adding in some of answer 3
Browse files Browse the repository at this point in the history
  • Loading branch information
zoeludena committed Nov 21, 2024
1 parent 5720c7b commit 6800911
Show file tree
Hide file tree
Showing 2 changed files with 113 additions and 55 deletions.
123 changes: 79 additions & 44 deletions docs/ss2-24-final/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -361,17 +361,16 @@ <h1 class="title"> </h1>
<p><br></p>
<hr />
<h2 id="problem-2">Problem 2</h2>
<p><strong>[Eligible for midterm redemption]</strong></p>
<p>Consider a dataset of 4 values, <span class="math inline">y_1 &lt;
y_2 &lt; y_3 &lt; y_4</span>, with a mean of 6.<br />
Let <span class="math inline">Y_\text{abs}(h) = \frac{1}{4} \sum_{i =
y_2 &lt; y_3 &lt; y_4</span>, with a mean of 6.</p>
<p>Let <span class="math inline">Y_\text{abs}(h) = \frac{1}{4} \sum_{i =
1}^4 |y_i - h|</span> represent the mean absolute error of a constant
prediction <span class="math inline">h</span> on this dataset of 4
values.</p>
<p>Similarly, consider another dataset of 3 values, <span
class="math inline">x_1 &lt; x_2 &lt; x_3</span>, that also has a mean
of 6.<br />
Let <span class="math inline">X_\text{abs}(h) = \frac{1}{3} \sum_{i =
of 6.</p>
<p>Let <span class="math inline">X_\text{abs}(h) = \frac{1}{3} \sum_{i =
1}^3 |x_i - h|</span> represent the mean absolute error of a constant
prediction <span class="math inline">h</span> on this dataset of 3
values.</p>
Expand Down Expand Up @@ -408,9 +407,14 @@ <h2 class="accordion-header" id="heading2_1">
<header id="title-block-header">
<h1 class="title"> </h1>
</header>
<p>Without an absolute value sign, the empirical risk is minimized when
<span class="math display">h</span> is as small as possible, so <span class="math inline">h^* = -\infty</span>.</p>
<p>TODO</p>
<p><span class="math inline">Z(h) = \frac{1}{7} \sum_{i = 1}^7 (h -
z_i)</span> is minimized when <span class="math inline">h</span> is as
small as possible. If <span class="math inline">h</span> is smaller than
<span class="math inline">z_i</span> then it will make a negative risk!
This means the smaller <span class="math inline">h</span> is the smaller
the difference will be!</p>
<p>When looking at our answers available the smallest risk would be
<span class="math inline">h^* = -\infty</span>.</p>
</div>
</div>
</div>
Expand Down Expand Up @@ -441,19 +445,22 @@ <h2 class="accordion-header" id="heading2_2">
<header id="title-block-header">
<h1 class="title"> </h1>
</header>
<p><span class="math display">y_3</span>, the median of the dataset.</p>
<p>TODO</p>
<p><span class="math inline">y_3</span>, the median of the dataset.</p>
<p>Recall <span class="math inline">h^*</span> for <span class="math inline">T_\text{abs}(h)</span> is the median of the
dataset!</p>
<p>Our dataset is: <span class="math inline">x_1, y_1, y_2, y_3, y_4,
x_2, x_3</span>. Our median is <span class="math inline">y_3</span>,
which means <span class="math inline">h^* = y_3</span>.</p>
</div>
</div>
</div>
</div>
<p><br></p>
<h3 id="problem-2.3">Problem 2.3</h3>
<p>Suppose the slope of <span class="math inline">T_\text{abs}(h)</span>
is <span class="math inline">-\frac{1}{7}</span> at some <span
class="math inline">h_p</span>. <em>Hint: think about what values of
<span class="math inline">h</span> could have this slope.</em></p>
<p><br></p>
<h3 id="problem-2.3">Problem 2.3</h3>
<p>Suppose the dataset is now modified by moving the <span
class="math inline">\{x_i\}</span> such that<br />
<span class="math inline">y_1 &lt; y_2 &lt; y_3 &lt; y_4 &lt; x_1 &lt;
Expand All @@ -474,19 +481,20 @@ <h2 class="accordion-header" id="heading2_3">
<header id="title-block-header">
<h1 class="title"> </h1>
</header>
<p><span class="math display">-\frac{3}{7}</span> Explanation: slope of
<span class="math display">T_{abs}(h)</span> (number of points to the
left of h - number of points to the right of h) / 7. If the slope of
<span class="math display">T_{abs}(h)</span> was originally <span class="math display">-\frac17</span>, there must have been four points
to the right of h and 3 points to the left of h, meaning <span class="math display">y_2&lt;h&lt;y_3</span>. It follows that in the
<p><span class="math display">-\frac{3}{7}</span></p>
<p>Slope of <span class="math inline">T_{abs}(h)</span> is equal to
<span class="math inline">\frac{1}{7} * \text{(number of points to the
left of h - number of points to the right of h)}</span>. If the slope of
<span class="math display">T_{abs}(h)</span> was originally <span class="math display">-\frac{1}{7}</span>, there must have been four
points to the right of h and 3 points to the left of h, meaning <span class="math display">y_2&lt;h&lt;y_3</span>. It follows that in the
modified dataset there are 5 points to the right of h and 2 points to
the left of h, meaning the slope of <span class="math display">T_{abs}(h)</span> must be <span class="math display">-\frac37</span></p>
<p>TODO</p>
the left of h, meaning the slope of <span class="math display">T_{abs}(h)</span> must be <span class="math display">-\frac{3}{7}</span></p>
</div>
</div>
</div>
</div>
<p><br></p>
<h3 id="problem-2.4">Problem 2.4</h3>
<p><em>The following information is repeated from the previous page, for
your convenience.</em></p>
<p>Consider a dataset of 4 values, <span class="math inline">y_1 &lt;
Expand All @@ -512,8 +520,6 @@ <h1 class="title"> </h1>
is <span class="math inline">-\frac{1}{7}</span> at some <span
class="math inline">h_p</span>. <em>Hint: think about what values of
<span class="math inline">h</span> could have this slope.</em></p>
<p><br></p>
<h3 id="problem-2.4">Problem 2.4</h3>
<p>Suppose the dataset is now modified by repeating each value <span
class="math inline">y_i</span> such that it now contains <span
class="math inline">x_1, y_1, y_1, y_2, y_2, y_3, y_3, y_4, y_4</span>,
Expand All @@ -535,6 +541,8 @@ <h2 class="accordion-header" id="heading2_4">
<header id="title-block-header">
<h1 class="title"> </h1>
</header>
<p>There are two answers based on if you believed <span class="math inline">x_3</span> and <span class="math inline">x_4</span>
was still in the dataset.</p>
<p>Correct case 1: assumes that <span class="math display">x_3</span>
and <span class="math display">x_4</span> are still in the dataset and
finds the answer to be <span class="math display">-\frac{1}{11}</span></p>
Expand Down Expand Up @@ -628,9 +636,12 @@ <h2 class="accordion-header" id="heading3_1">
<header id="title-block-header">
<h1 class="title"> </h1>
</header>
<p>Correctly explains that vectors are linearly independent for any
<span class="math display">\alpha \neq 1</span>.</p>
<p>TODO</p>
<p>The vectors are linearly independent for any <span class="math inline">\alpha \neq 1</span>.</p>
<p>To be linearly independent it means there is not a linear combination
between any of the vectors. We can see that if we add <span class="math inline">\vec v_1</span> and <span class="math inline">\vec
v_2</span> it looks almost like <span class="math inline">\vec
v_3</span>, so as long as we can make it so $<span class="math inline">\alpha \neq 1</span> then the vectors will be
independent.</p>
</div>
</div>
</div>
Expand All @@ -654,10 +665,15 @@ <h2 class="accordion-header" id="heading3_2">
<header id="title-block-header">
<h1 class="title"> </h1>
</header>
<p>Correctly notes there are no values of <span class="math display">\alpha</span> for which <span class="math display">\vec{v}_1, \vec{v}_3</span> are orthogonal, as the
first component containing <span class="math display">\alpha</span> is
multiplied by 0.</p>
<p>TODO</p>
<p>We know for <span class="math inline">\vec v_1</span> and <span class="math inline">\vec v_3</span> to be orthogonal their dot product
should equal zero.</p>
<p><span class="math display">\vec v_1 \cdot \vec v_3 = (0)(\alpha) +
(1)(1) + (1)(2) = 0</span></p>
<p>There are no values of <span class="math inline">\alpha</span> for
which <span class="math inline">\vec{v}_1, \vec{v}_3</span> are
orthogonal. We can see <span class="math inline">(0)(\alpha) = 0</span>,
which means that we cannot manipulate <span class="math inline">\alpha</span> in any way to make the vectors
orthogonal.</p>
</div>
</div>
</div>
Expand All @@ -681,9 +697,21 @@ <h2 class="accordion-header" id="heading3_3">
<header id="title-block-header">
<h1 class="title"> </h1>
</header>
<p>Correctly notes <span class="math display">\alpha = -2</span> for
this question, as this makes the dot product of <span class="math display">\vec{v_1} \cdot \vec{v_3} = 0</span>.</p>
<p>TODO</p>
<p><span class="math inline">\alpha = -2</span></p>
<p>We know for <span class="math inline">\vec v_2</span> and <span class="math inline">\vec v_3</span> to be orthogonal their dot product
should equal zero.</p>
<p>The dot product is:</p>
<p><span class="math display">
\vec v_2 \cdot \vec v_3 = (1)(\alpha) + (0)(1) + (1)(2)
</span></p>
<p>So we can do:</p>
<p><span class="math display">\begin{align*}
0 &amp;= (1)(\alpha) + (0)(1) + (1)(2)\\
0 &amp;=\alpha + 0 + 2\\
-2 &amp;= \alpha
\end{align*}</span></p>
<p>We can clearly see when <span class="math inline">\alpha = -2</span>
then the dot product will equal zero.</p>
</div>
</div>
</div>
Expand Down Expand Up @@ -716,9 +744,10 @@ <h2 class="accordion-header" id="heading3_4">
<header id="title-block-header">
<h1 class="title"> </h1>
</header>
<p>Correct: answered yes because any vector in <span class="math display">\mathbb{R}^3</span> is in the span of 3 linearly
independent vectors in <span class="math display">\mathbb{R}^3</span>.</p>
<p>TODO</p>
<p>Yes</p>
<p>If <span class="math inline">\alpha = 3</span> and all three vectors
are independent from one another then any vector in <span class="math inline">\mathbb{R}^3</span> is in the span of 3 linearly
independent vectors in <span class="math inline">\mathbb{R}^3</span>.</p>
</div>
</div>
</div>
Expand All @@ -742,7 +771,7 @@ <h3 id="problem-3.5">Problem 3.5</h3>
8
\end{bmatrix}</span> onto <span class="math inline">\vec{v}_1</span>?
Provide your answer in the form of a vector. Show your work, and put
your answer in a .</p>
your answer in a box.</p>
<div id="accordionExample" class="accordion">
<div class="accordion-item">
<h2 class="accordion-header" id="heading3_5">
Expand All @@ -756,15 +785,20 @@ <h2 class="accordion-header" id="heading3_5">
<header id="title-block-header">
<h1 class="title"> </h1>
</header>
<p>Correctly projects <span class="math inline">\begin{bmatrix}3 \\ 5 \\
8\end{bmatrix}</span> onto <span class="math display">\vec{v_1}</span>:
<span class="math display">\frac{\begin{bmatrix}3 \\ 5 \\ 8\end{bmatrix}
\cdot \begin{bmatrix}0 \\ 1 \\ 1 \end{bmatrix}}{\begin{bmatrix}0 \\ 1 \\
1 \end{bmatrix}\cdot \begin{bmatrix}0 \\ 1 \\ 1 \end{bmatrix}}
\begin{bmatrix}0 \\ 1 \\ 1 \end{bmatrix} =
\frac{13}{2} \begin{bmatrix}0 \\ 1 \\ 1 \end{bmatrix} =
\begin{bmatrix}0 \\ 6.5 \\ 6.5 \end{bmatrix}</span></p>
<p>TODO</p>
<p><span class="math inline">\begin{bmatrix}0 \\ 6.5 \\ 6.5
\end{bmatrix}</span></p>
<p>We follow the equation <span class="math inline">\frac{\begin{bmatrix}3 \\ 5 \\ 8\end{bmatrix} \cdot
\vec v_1}{\vec v_1 \cdot \vec v_1} \vec v_1</span> to find the
projection of <span class="math inline">\begin{bmatrix}3 \\ 5 \\
8\end{bmatrix}</span> onto <span class="math inline">\vec{v_1}</span>:</p>
<p><span class="math display">\begin{align*}
\frac{\begin{bmatrix}3 \\ 5 \\ 8\end{bmatrix} \cdot \begin{bmatrix}0 \\
1 \\ 1 \end{bmatrix}}{\begin{bmatrix}0 \\ 1 \\ 1 \end{bmatrix}\cdot
\begin{bmatrix}0 \\ 1 \\ 1 \end{bmatrix}} \begin{bmatrix}0 \\ 1 \\ 1
\end{bmatrix} &amp;= \frac{13}{2} \begin{bmatrix}0 \\ 1 \\ 1
\end{bmatrix}\\
&amp;= \begin{bmatrix}0 \\ 6.5 \\ 6.5 \end{bmatrix}
\end{align*}</span></p>
</div>
</div>
</div>
Expand Down Expand Up @@ -1931,6 +1965,7 @@ <h1 class="title"> </h1>
<p>And predicts Mature</p>
<p>If a student does not receive this rubric item, they should only
receive <strong>one</strong> of the other rubric items.</p>
<p>$P() = </p>
<p>TODO</p>
</div>
</div>
Expand Down
45 changes: 34 additions & 11 deletions problems/ss2-24-final/ss2-24-final-q03.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ a box.

# BEGIN SOLUTION

Correctly explains that vectors are linearly independent for any $$\alpha \neq 1$$.
The vectors are linearly independent for any $\alpha \neq 1$.

TODO
To be linearly independent it means there is not a linear combination between any of the vectors. We can see that if we add $\vec v_1$ and $\vec v_2$ it looks almost like $\vec v_3$, so as long as we can make it so $$\alpha \neq 1$ then the vectors will be independent.

# END SOLUTION

Expand All @@ -32,9 +32,11 @@ orthogonal? Show your work, and put your answer in a box.

# BEGIN SOLUTION

Correctly notes there are no values of $$\alpha$$ for which $$\vec{v}_1, \vec{v}_3$$ are orthogonal, as the first component containing $$\alpha$$ is multiplied by 0.
We know for $\vec v_1$ and $\vec v_3$ to be orthogonal their dot product should equal zero.

TODO
$$\vec v_1 \cdot \vec v_3 = (0)(\alpha) + (1)(1) + (1)(2) = 0$$

There are no values of $\alpha$ for which $\vec{v}_1, \vec{v}_3$ are orthogonal. We can see $(0)(\alpha) = 0$, which means that we cannot manipulate $\alpha$ in any way to make the vectors orthogonal.

# END SOLUTION

Expand All @@ -47,9 +49,25 @@ orthogonal? Show your work, and put your answer in a box.

# BEGIN SOLUTION

Correctly notes $$\alpha = -2$$ for this question, as this makes the dot product of $$\vec{v_1} \cdot \vec{v_3} = 0$$.
$\alpha = -2$

TODO
We know for $\vec v_2$ and $\vec v_3$ to be orthogonal their dot product should equal zero.

The dot product is:

$$
\vec v_2 \cdot \vec v_3 = (1)(\alpha) + (0)(1) + (1)(2)
$$

So we can do:

\begin{align*}
0 &= (1)(\alpha) + (0)(1) + (1)(2)\\
0 &=\alpha + 0 + 2\\
-2 &= \alpha
\end{align*}

We can clearly see when $\alpha = -2$ then the dot product will equal zero.

# END SOLUTION

Expand All @@ -69,9 +87,9 @@ Is the vector $\begin{bmatrix}

# BEGIN SOLUTION

Correct: answered yes because any vector in $$\mathbb{R}^3$$ is in the span of 3 linearly independent vectors in $$\mathbb{R}^3$$.
Yes

TODO
If $\alpha = 3$ and all three vectors are independent from one another then any vector in $\mathbb{R}^3$ is in the span of 3 linearly independent vectors in $\mathbb{R}^3$.

# END SOLUTION

Expand All @@ -94,13 +112,18 @@ What is the projection of the vector $\begin{bmatrix}
5 \\
8
\end{bmatrix}$ onto $\vec{v}_1$? Provide your answer in the form of a
vector. Show your work, and put your answer in a .
vector. Show your work, and put your answer in a box.

# BEGIN SOLUTION

Correctly projects $\begin{bmatrix}3 \\ 5 \\ 8\end{bmatrix}$ onto $$\vec{v_1}$$: $$\frac{\begin{bmatrix}3 \\ 5 \\ 8\end{bmatrix} \cdot \begin{bmatrix}0 \\ 1 \\ 1 \end{bmatrix}}{\begin{bmatrix}0 \\ 1 \\ 1 \end{bmatrix}\cdot \begin{bmatrix}0 \\ 1 \\ 1 \end{bmatrix}} \begin{bmatrix}0 \\ 1 \\ 1 \end{bmatrix} = \frac{13}{2} \begin{bmatrix}0 \\ 1 \\ 1 \end{bmatrix} = \begin{bmatrix}0 \\ 6.5 \\ 6.5 \end{bmatrix}$$
$\begin{bmatrix}0 \\ 6.5 \\ 6.5 \end{bmatrix}$

TODO
We follow the equation $\frac{\begin{bmatrix}3 \\ 5 \\ 8\end{bmatrix} \cdot \vec v_1}{\vec v_1 \cdot \vec v_1} \vec v_1$ to find the projection of $\begin{bmatrix}3 \\ 5 \\ 8\end{bmatrix}$ onto $\vec{v_1}$:

\begin{align*}
\frac{\begin{bmatrix}3 \\ 5 \\ 8\end{bmatrix} \cdot \begin{bmatrix}0 \\ 1 \\ 1 \end{bmatrix}}{\begin{bmatrix}0 \\ 1 \\ 1 \end{bmatrix}\cdot \begin{bmatrix}0 \\ 1 \\ 1 \end{bmatrix}} \begin{bmatrix}0 \\ 1 \\ 1 \end{bmatrix} &= \frac{13}{2} \begin{bmatrix}0 \\ 1 \\ 1 \end{bmatrix}\\
&= \begin{bmatrix}0 \\ 6.5 \\ 6.5 \end{bmatrix}
\end{align*}

# END SOLUTION

Expand Down

0 comments on commit 6800911

Please sign in to comment.