Dalam pembelajaran mesin, mengapa superskrip digunakan sebagai pengganti subskrip?

20

Saya mengambil kursus Andrew Ng tentang Pembelajaran Mesin melalui Coursera . Untuk persamaan, superskrip digunakan sebagai pengganti subskrip. Misalnya, dalam persamaan berikut x(i) digunakan sebagai ganti xi :

J(θ0,θ1)=12msaya=1m(hθ(x(saya))-y(saya))2

Rupanya, ini adalah praktik umum. Pertanyaan saya adalah mengapa menggunakan superskrip, bukan subskrip? Superskrip sudah digunakan untuk eksponensial. Memang saya tampaknya dapat membedakan antara superskrip dan kasus penggunaan eksponensial dengan memperhatikan apakah tanda kurung ada atau tidak, tetapi tampaknya masih membingungkan.

entpnerd
sumber
4
Saya menduga itu mungkin karena beberapa orang ilmu komputer tidak berpengalaman dalam notasi matematika standar, dan karena itu membuat notasi mereka sendiri. Aktuaris kadang-kadang juga melakukan hal ini, dan itu membuat frustrasi ketika Anda sampai pada konsep yang lebih rumit.
rocinante
5
Apakah ipengindeksan atas ukuran kumpulan data, atau elemen-elemen vektor x? Jika yang pertama, itu benar-benar standar. Jika yang terakhir, itu sama sekali tidak standar. Dan alasan mengapa superskrip digunakan adalah karena kadang-kadang Anda ingin merujuk ke elemen vektor menggunakan subskrip.
Rex Kerr
4
@rocinante lol tidak, itu karena subskrip sudah diambil untuk vektor pengindeksan.
Neil G
4
@rocinante Itu agak lancang. Bagaimana dengan vektor kontravarian / notasi Einstein ?
Will Vousden
4
@rocinante Saya harus menggemakan yang lain untuk menggarisbawahi bahwa kata-kata Anda tidak beruntung. Kita semua memiliki kecenderungan untuk menganggap apa yang lokal dan akrab sebagai standar.
Nick Cox

Jawaban:

26

Jika menunjukkan vektor x R m maka x i adalah notasi standar untuk koordinat ke- i dari x , yaitu x = ( x 1 , x 2 , , x m ) R m .xxRmxiix

x=(x1,x2,,xm)Rm.

Jika Anda memiliki koleksi vektor seperti itu, bagaimana Anda menunjukkan vektor ke- i ? Anda tidak bisa menulis x i , ini memiliki arti standar lainnya. Jadi terkadang orang menulis x ( i )nixix(i) dan itu adalah saya percaya mengapa Andrew Ng melakukannya.

Yaitu

x(1)=(x1(1),x2(1),,xm(1))Rmx(2)=(x1(2),x2(2),,xm(2))Rmx(n)=(x1(n),x2(n),,xm(n))Rm.
amuba kata Reinstate Monica
sumber
Saya tidak setuju, tetapi sering digunakan, yaitu untuk pengukuran berulang. xij
Cliff AB
1
Ya, tetapi sama dengan x ( i ) j ; apa yang akan setara dengan x ( i ) ? xijxj(i)x(i)
Amoeba berkata Reinstate Monica
1
xi.j=1nxij/m
1
xmn(i) seems the most intuitive way to do so. Therefore the notation stays consistent when moving from vectors to matrices.
josh
2
@JAB Yes, it's to make the notation more explicit ("type hinting" as you say). Of course one can agree to use xi for the i-th vector and xij for the j-th element of the i-th vector. There are various conventions possible, this is just one of them. I am not even saying it is the best one, just explaining the rationale behind it.
amoeba says Reinstate Monica
11

The use of super scripts as you have stated I believe is not very common in machine learning literature. I'd have to review Ng's course notes to confirm, but if he's putting that use there, I would say he would be origin of the proliferation of this notation. This is a possibility. Either way, not to be too unkind, but I don't think many of the online course students are publishing literature on machine learning, so this notation is not very common in the actual literature. After all, these are introductory courses in machine learning, not PhD level courses.

What is very common with super scripts is to denote the iteration of an algorithm using super scripts. For example, you could write an iteration of Newton's method as

θ(t+1)=θ(t)H(θ(t))1θ(t)

where H(θ(t)) is the Hessian and θ(t) is the gradient.

(...yes this is not quite the best way to implement Newton's method due to the inversion of the Hessian matrix...)

Here, θ(t) represents the value of θ in the tth iteration. This is the most common (but certainly not only) use of super scripts that I am aware of.

EDIT: To clarify, in the original question, it appeared to suggest that in the ML notation, x(i) was equivalent to statistic's xi notation. In my answer, I state that this is not truly prevalent in ML literature. This is true. However, as pointed out by @amoeba, there is plenty of superscript notation in ML literature for data, but in these cases x(i) does not typically mean the ith observation of a single vector x.

Cliff AB
sumber
1
The clash with the use of parenthesized/bracketed superscripts for iteration counts (a notation that is in common use across a wide range of areas) is a really important thing to raise.
Glen_b -Reinstate Monica
2
It is also commonly used to indicate the index of the sample in the training set, which is like the iteration but not exactly the same because you usually end up iterating through your training set many times.
Rex Kerr
3
I've also seen iteration counts noted using subscripts (an+1=an+1) as well as in line (a(n+1)=a(n)+1). Which is why, when using some specific notation, I'll usually put something at the start to disambiguate (e.g. saying "in the following series, blah blah blah" and then putting the math). Thus, whatever notation is in use, readers can (hopefully) intuit the meaning for potentially ambiguous cases rather than having to guess based on the conventions they know.
JAB
1
I agree with @JAB. More generally, I don't think it's heinous for people who will be writing and using code to borrow notation from software in mathematical treatments. For example, and contentiously, computing people are way ahead of many mathematical groups in using clean notation such as (x>0), to be evaluated as 1 if true and 0 if false, instead of unnecessary formalisms such as I(x>0); here I am merely following behind Donald Knuth.
Nick Cox
@NickCox I generally only see the I(x>0) form when it comes to probability; otherwise, x>0 is just an inequality constraint. When it comes to mathematical equations, they're either broken up into piecewise representations or they just represent the equation itself as an inequality as doing otherwise would induce ambiguity. (It's similar to how = in math is more subtle than either = or == in most programming languages; it introduces a constraint or definition rather than an actual assignment or equality check.)
JAB
4

Superscripts are already used for exponentiation.

In mathematics superscripts are used left and right depending on the field. The choice is always historical legacy, nothing more. Whoever first got into the field set the convention of using sub- or superscripts.

Two examples. Superscripts are used to denote derivatives: f(x)(n)

In tensor algebra both super and subscripts are used heavily for the same thing like Rii could mean i rows and j columns. It's quite expressive: Tik=RijCjk

Also I remember using scripts before letters (prescripts) in Physics, e.g. jiBkl. I think it was with tensors.

Hence, the choice of superscripts by Ng is purely historical too. There's no real reason to use or not use them, or prefer them to subscripts. Actually, I believe that here ML people are using tensor notation. They definitely are well versed in the subject, e.g. see this paper.

Aksakal
sumber
1
Another example for your point: Einstein notation
Neil G