Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

general variable naming #635

Open
radekapreel opened this issue Feb 11, 2024 · 0 comments
Open

general variable naming #635

radekapreel opened this issue Feb 11, 2024 · 0 comments

Comments

@radekapreel
Copy link

radekapreel commented Feb 11, 2024

hey
first of all - thank you very much for this course. I'm slowly going through it and I feel like a student again. Which has both good and bad sides, but it's great ;)
The videos associated with the course are really helpful, I just have some small feedback about the code itself

one thing I noticed throughout all the examples is the lack of good naming practices, which could be very simply alleviated to make the course a lot more readable. My main two concerns are:

  1. redefining the same variable in multiple places
path = something
(...)
# a few sections down
path = something else

sometimes the same variable is reused over examples spanning multiple code blocks, sometimes it's simply overwritten in subsequent blocks. I'm no python specialist, but in any other language I used that would be deemed a bad practice

we could name them "bears_path", or "downloads_path" or whatever else makes sense in a given context

  1. short variable names. for example
trgts  = tensor([1,0,1])
prds   = tensor([0.9, 0.4, 0.2])

instead of

expected_targets  = tensor([1,0,1])
example_predictions   = tensor([0.9, 0.4, 0.2])

it really doesn't hurt to add those few characters more, but it makes it sooooo much easier if we don't have to decipher what the author meant. again - in any production grade project and in any company - short names like those would be considered bad practice. I think it's especially important here, because we're learning something new and we often don't yet have the experience required to decipher those short names correctly or efficiently.

some others are simply confusing without even giving us a fighting chance. example:

dset = list(zip(train_x,train_y))
x,y = dset[0]
x.shape,y

One would assume that x and y is a point on a 2d graph / in a matrix.
Well, no. X is an image, and y is a label. Why not just call it that?

btw. some other examples

  • dls. Whenever I look at it I think "downloads", but "data loaders"
  • fns. This is "functions" more often than not. Here it's "file names"

I don't know if there is anyone checking those issues out, but hopefully this could make this course even better

cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant