pytorch / pytorch/tutorials

Feedback about Warm-up: numpy - on the Polynomial (Mis)Fit Example in the Tensors Tutorial

Open
#3,607 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

core
Dominant language
Python
Stars
9.3k
Forks
4.4k
Avg merge
1d 21h
Merged PRs (30d)
4

Description

Hi there,

I was looking at the tutorial on fitting a polynomial with NumPy and PyTorch:
https://docs.pytorch.org/tutorials/beginner/examples_tensor/polynomial_numpy.html

I noticed that the resulting third-degree polynomial is not a very good fit for the sin(x) function it's supposed to approximate:
f(x) = 0.0003655185795843861 + 0.8513230793867113 x + -6.305803723372667e-05 x² + -0.09255975933441395 x³

You can see a graph of both functions here—they look pretty different:
https://www.geogebra.org/calculator/qyykjrjf

My concern is that this might be a confusing example for beginners. It could give them the wrong impression of what a good result looks like when using PyTorch.

Cheers,
Carlos Rogério Camargo

Image

cc @albanD @jbschlosser

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the polynomial NumPy tutorial at docs.pytorch.org/tutorials/beginner/examples_tensor/polynomial_numpy.html and reproduce the reported comparison with sin(x). Check whether the example or its explanation needs correction, and consider the work complete when the tutorial gives beginners an accurate, clearly explained interpretation of the fit.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python, pytorch
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.