Skip to content

Commit

Permalink
Couple additions to A2
Browse files Browse the repository at this point in the history
  • Loading branch information
yashdave003 committed Mar 19, 2024
1 parent fe3195c commit 3b37f9e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 21 deletions.
16 changes: 9 additions & 7 deletions docs/projA2/projA2.html
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,10 @@ <h2 id="toc-title">Table of contents</h2>
<li><a href="#valueerror-input-x-contains-nan" id="toc-valueerror-input-x-contains-nan" class="nav-link" data-scroll-target="#valueerror-input-x-contains-nan"><code>ValueError: Input X contains NaN</code></a></li>
<li><a href="#valueerror-the-feature-names-should-match-those-that-were-passed-during-fit" id="toc-valueerror-the-feature-names-should-match-those-that-were-passed-during-fit" class="nav-link" data-scroll-target="#valueerror-the-feature-names-should-match-those-that-were-passed-during-fit"><code>ValueError: The feature names should match those that were passed during fit</code></a></li>
<li><a href="#valueerror-operands-could-not-be-broadcast-together-with-shapes-..." id="toc-valueerror-operands-could-not-be-broadcast-together-with-shapes-..." class="nav-link" data-scroll-target="#valueerror-operands-could-not-be-broadcast-together-with-shapes-..."><code>ValueError: operands could not be broadcast together with shapes ...</code></a></li>
<li><a href="#question-6" id="toc-question-6" class="nav-link" data-scroll-target="#question-6">Question 6</a></li>
<li><a href="#im-getting-negative-values-for-the-prop_overest-plot-in-6c" id="toc-im-getting-negative-values-for-the-prop_overest-plot-in-6c" class="nav-link" data-scroll-target="#im-getting-negative-values-for-the-prop_overest-plot-in-6c">I’m getting negative values for the <code>prop_overest</code> plot in <code>6c</code></a></li>
</ul></li>
<li><a href="#question-6" id="toc-question-6" class="nav-link" data-scroll-target="#question-6">Question 6</a>
<ul>
<li><a href="#im-getting-negative-values-for-the-prop_overest-plot" id="toc-im-getting-negative-values-for-the-prop_overest-plot" class="nav-link" data-scroll-target="#im-getting-negative-values-for-the-prop_overest-plot">I’m getting negative values for the <code>prop_overest</code> plot</a></li>
</ul></li>
<li><a href="#gradescope" id="toc-gradescope" class="nav-link" data-scroll-target="#gradescope">Gradescope</a>
<ul>
Expand Down Expand Up @@ -274,7 +276,7 @@ <h3 class="anchored" data-anchor-id="keyerror-sale-pricekeyerror-log-sale-price"
</section>
<section id="value-error-could-not-convert-string-to-float" class="level3">
<h3 class="anchored" data-anchor-id="value-error-could-not-convert-string-to-float"><code>Value Error: could not convert string to float</code></h3>
<p>If you simply run <code>X = data.drop(columns = ["Log Sale Price", "Sale Price"])</code> or something similar, wherein you leave in non-numeric columns of <code>data</code>, you may run into this error. The <code>fit</code> function of a <code>lm.LinearRegression</code> object can take a <code>pandas</code> <code>DataFrame</code> as the <code>X</code> argument, but requires that the <code>DataFrame</code> is only composed of numeric values.</p>
<p>This error occurs if your final design matric contains non-numeric columns. For example, if you simply run <code>X = data.drop(columns = ["Log Sale Price", "Sale Price"])</code>, all the non-numeric columns of <code>data</code> are still included in <code>X</code> and you will see this error message. The <code>fit</code> function of a <code>lm.LinearRegression</code> object can take a <code>pandas</code> <code>DataFrame</code> as the <code>X</code> argument, but requires that the <code>DataFrame</code> is only composed of numeric values.</p>
</section>
<section id="valueerror-input-x-contains-infinity-or-a-value-too-large-for-dtypefloat64" class="level3">
<h3 class="anchored" data-anchor-id="valueerror-input-x-contains-infinity-or-a-value-too-large-for-dtypefloat64"><code>ValueError: Input X contains infinity or a value too large for dtype('float64')</code></h3>
Expand Down Expand Up @@ -321,11 +323,11 @@ <h3 class="anchored" data-anchor-id="valueerror-the-feature-names-should-match-t
<h3 class="anchored" data-anchor-id="valueerror-operands-could-not-be-broadcast-together-with-shapes-..."><code>ValueError: operands could not be broadcast together with shapes ...</code></h3>
<p>This error occurs when you attempt to perform an operation on two NumPy arrays with mismatched dimensions. For example, <code>np.ones(100000) - np.ones(1000000)</code> is not defined since you cannot perform elementwise addition on arrays with different lengths. Use the error traceback to identify which line is erroring, and print out the shape of the arrays on the line before using <code>.shape</code>.</p>
</section>
<section id="question-6" class="level3">
<h3 class="anchored" data-anchor-id="question-6">Question 6</h3>
</section>
<section id="im-getting-negative-values-for-the-prop_overest-plot-in-6c" class="level3">
<h3 class="anchored" data-anchor-id="im-getting-negative-values-for-the-prop_overest-plot-in-6c">I’m getting negative values for the <code>prop_overest</code> plot in <code>6c</code></h3>
<section id="question-6" class="level2">
<h2 class="anchored" data-anchor-id="question-6">Question 6</h2>
<section id="im-getting-negative-values-for-the-prop_overest-plot" class="level3">
<h3 class="anchored" data-anchor-id="im-getting-negative-values-for-the-prop_overest-plot">I’m getting negative values for the <code>prop_overest</code> plot</h3>
<p>Note that in the function body, the skeleton code includes:</p>
<pre><code># DO NOT MODIFY THESE TWO LINES
if subset_df.shape[0] == 0:
Expand Down
23 changes: 12 additions & 11 deletions index.tex
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ \chapter*{About}\label{about}

\chapter{Jupyter 101}\label{jupyter-101}

\begin{tcolorbox}[enhanced jigsaw, colbacktitle=quarto-callout-note-color!10!white, colback=white, rightrule=.15mm, coltitle=black, bottomrule=.15mm, colframe=quarto-callout-note-color-frame, opacitybacktitle=0.6, title=\textcolor{quarto-callout-note-color}{\faInfo}\hspace{0.5em}{Note}, opacityback=0, left=2mm, toprule=.15mm, arc=.35mm, titlerule=0mm, breakable, toptitle=1mm, bottomtitle=1mm, leftrule=.75mm]
\begin{tcolorbox}[enhanced jigsaw, colback=white, left=2mm, bottomrule=.15mm, toptitle=1mm, opacitybacktitle=0.6, bottomtitle=1mm, breakable, arc=.35mm, toprule=.15mm, opacityback=0, coltitle=black, title=\textcolor{quarto-callout-note-color}{\faInfo}\hspace{0.5em}{Note}, colframe=quarto-callout-note-color-frame, titlerule=0mm, rightrule=.15mm, colbacktitle=quarto-callout-note-color!10!white, leftrule=.75mm]

If you're using a MacBook, replace \texttt{ctrl} with \texttt{cmd}.

Expand Down Expand Up @@ -1417,13 +1417,14 @@ \subsection{\texorpdfstring{\texttt{KeyError:\ \textquotesingle{}Sale\ Price\tex
\subsection{\texorpdfstring{\texttt{Value\ Error:\ could\ not\ convert\ string\ to\ float}}{Value Error: could not convert string to float}}\label{value-error-could-not-convert-string-to-float}
If you simply run
\texttt{X\ =\ data.drop(columns\ =\ {[}"Log\ Sale\ Price",\ "Sale\ Price"{]})}
or something similar, wherein you leave in non-numeric columns of
\texttt{data}, you may run into this error. The \texttt{fit} function of
a \texttt{lm.LinearRegression} object can take a \texttt{pandas}
\texttt{DataFrame} as the \texttt{X} argument, but requires that the
\texttt{DataFrame} is only composed of numeric values.
This error occurs if your final design matric contains non-numeric
columns. For example, if you simply run
\texttt{X\ =\ data.drop(columns\ =\ {[}"Log\ Sale\ Price",\ "Sale\ Price"{]})},
all the non-numeric columns of \texttt{data} are still included in
\texttt{X} and you will see this error message. The \texttt{fit}
function of a \texttt{lm.LinearRegression} object can take a
\texttt{pandas} \texttt{DataFrame} as the \texttt{X} argument, but
requires that the \texttt{DataFrame} is only composed of numeric values.
\subsection{\texorpdfstring{\texttt{ValueError:\ Input\ X\ contains\ infinity\ or\ a\ value\ too\ large\ for\ dtype(\textquotesingle{}float64\textquotesingle{})}}{ValueError: Input X contains infinity or a value too large for dtype(\textquotesingle float64\textquotesingle)}}\label{valueerror-input-x-contains-infinity-or-a-value-too-large-for-dtypefloat64}
Expand Down Expand Up @@ -1526,11 +1527,11 @@ \subsection{\texorpdfstring{\texttt{ValueError:\ operands\ could\ not\ be\ broad
Use the error traceback to identify which line is erroring, and print
out the shape of the arrays on the line before using \texttt{.shape}.
\subsection{Question 6}\label{question-6-1}
\section{Question 6}\label{question-6-1}
\subsection{\texorpdfstring{I'm getting negative values for the
\texttt{prop\_overest} plot in
\texttt{6c}}{I'm getting negative values for the prop\_overest plot in 6c}}\label{im-getting-negative-values-for-the-prop_overest-plot-in-6c}
\texttt{prop\_overest}
plot}{I'm getting negative values for the prop\_overest plot}}\label{im-getting-negative-values-for-the-prop_overest-plot}
Note that in the function body, the skeleton code includes:
Expand Down
6 changes: 3 additions & 3 deletions projA2/projA2.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ If you're passing the tests for question 5d but getting this error in question 5

### `Value Error: could not convert string to float`

If you simply run `X = data.drop(columns = ["Log Sale Price", "Sale Price"])` or something similar, wherein you leave in non-numeric columns of `data`, you may run into this error. The `fit` function of a `lm.LinearRegression` object can take a `pandas` `DataFrame` as the `X` argument, but requires that the `DataFrame` is only composed of numeric values.
This error occurs if your final design matric contains non-numeric columns. For example, if you simply run `X = data.drop(columns = ["Log Sale Price", "Sale Price"])`, all the non-numeric columns of `data` are still included in `X` and you will see this error message. The `fit` function of a `lm.LinearRegression` object can take a `pandas` `DataFrame` as the `X` argument, but requires that the `DataFrame` is only composed of numeric values.

### `ValueError: Input X contains infinity or a value too large for dtype('float64')`
The reason why your `X` data contains infinity is likely because you are taking the logarithm of 0 somewhere in your code. To prevent this, try:
Expand Down Expand Up @@ -93,9 +93,9 @@ Potential causes for this error:

This error occurs when you attempt to perform an operation on two NumPy arrays with mismatched dimensions. For example, `np.ones(100000) - np.ones(1000000)` is not defined since you cannot perform elementwise addition on arrays with different lengths. Use the error traceback to identify which line is erroring, and print out the shape of the arrays on the line before using `.shape`.

### Question 6
## Question 6

### I'm getting negative values for the `prop_overest` plot in `6c`
### I'm getting negative values for the `prop_overest` plot

Note that in the function body, the skeleton code includes:
```
Expand Down

0 comments on commit 3b37f9e

Please sign in to comment.