Skip to content

Incorrect Cost Function Formula (1/m vs 1/2m) displayed in "Minimize Cost" plot #66

@mmdmirh

Description

@mmdmirh

Describe the Error
Hey team, I was going through the "Cost Function Intuition" lab and noticed that the formula and values displayed on the first interactive plot (Minimize Cost) are misleading. The text on the graph says cost = (1/m)*(1250 + 5000) = 3125.
The issue is that it uses 1/m instead of 1/2m, and the squared errors have already been pre-divided by 2 (displaying 1250 and 5000 instead of the actual squared errors of 2500 and 10000). This hides the squaring operation from the student and contradicts the standard $J(w,b)$ formula taught in the videos.

To Reproduce
Steps to reproduce the behavior:

  1. Go to the 'Cost Function Intuition' lab.
  2. Scroll down to the first interactive plot titled 'Minimize Cost'
  3. .Look at the purple text annotations at the bottom of the left 'Housing Prices' plot.
  4. The text incorrectly displays the multiplier as 1/m and shows pre-divided squared errors.

Expected behavior
The text and annotations should map perfectly to the standard cost function formula taught in the lectures: $J(w,b) = \frac{1}{2m} \sum (f(x) - y)^2$. The "cost for point" values should display the actual squared errors (2500 and 10000), and the final calculation string should explicitly show the correct fraction, like: cost = (1/2m) * (2500 + 10000) = 3125.

Screenshots
Image

Desktop (please complete the following information):
OS: macOS
Browser: Chrome
Version: Version 144.0.7559.133 (Official Build) (arm64)

Smartphone (please complete the following information):

  • N/A

Additional context
I just wanted to flag it because it could be confusing for beginners trying to manually verify the math from the lectures, since the squaring step is practically invisible and the fraction is stated incorrectly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions