Why is "m" the variable for the size of the training set?

Hi, maybe a silly question, but I often find understanding the variables helps me hold the process in my head.

Why is “m” the variable for the size/number of instances in the training set, rather than “n” or “N”? It doesn’t really make sense to me.

Cut to the chase, I don’t think there is any compelling reason for it. The founding fathers in AI started out with certain conventions and some of them might have even been arbitrary. And as each of these conventions seeped into everyday use, we just let it be.

1 Like

Hello @scoofy, this is my guess.

When I learned Matrix in high school, we always said the size of a matrix is m x n, which is m rows and n columns.

In ML, we always represent a tabulated dataset as a matrix, having one row for one data sample, and one column for one feature.

So if there are m rows, there are m samples, and when there are n columns, there are n features.

You can also see m and n being used in wiki to talk about the size of matrix!

Hope this help!



That makes total sense, thank you!

Now is my obvious follow up: Why “J” for the squared error cost function? I assumed it would be “F” for function (or “G” for the next letter), or “C” for cost. Using “J” kind of threw me.

Hey @scoofy, in short, unfortunately, I don’t know.

But out of curiosity, I googled a bit and find there are some discussions about your question (many people care about this).

The most relevant one is relating J to Jacobi who was a German mathematician with some of his work related to optimization which is relevant to loss function, or equivalently cost function.

Many said this should trace back to the old time.

Lastly, I don’t think I have come to a compelling reason yet. It would be great if there was a search engine which can tell us since when J is popularly used as the symbol for cost function =p


Thanks for taking the time, i certainly don’t plan on being this pedantic throughout the course.

It’s fine @scoofy, I am happy to help you learn better :slight_smile:
Let us know when you have a question about the courses, and Cheers!