1
$\begingroup$

I'm having trouble with the machine learning vocabulary, especially with the concept of random variables.

Given a sample $X$ (with features $x_1, x_2, \dots, x_n$) that you train your algorithm on (or predict), what is the random variable? Is it $X$? Or is it any of its feature $x_1, x_2, \dots, x_n$?

Quoting The Deep Learning book (by Ian Goodfellow):

A random variable is a variable that can take on different values randomly. We typically denote the random variable itself with a lowercase letter in plain typeface

Where as in the definition of a Random Variable in the Wikipedia article:

A random variable is a measurable function from a set of possible outcomes to a measurable space E

Then we also have the definition of multivariate random variable

A multivariate random variable is a column vector (or its transpose, which is a row vector) whose components are scalar-valued random variables on the same probability space as each other.

Should a sample be in fact considered as a multivariate random variable?

$\endgroup$
1
  • 1
    $\begingroup$ AFAIK, there is no place in machine learning for applying the concept of a random variable to data, because few ML procedures (if any) are based on probabilistic models of data. (There's certainly scope within an ML framework to use random variables to do things like cross-validate predictions, but that's entirely different.) Arguably, if you are creating or applying procedures in which you model your data with random variables, you're doing statistical analysis :-). $\endgroup$ – whuber Jan 3 '19 at 20:31
2
$\begingroup$

A dataset is a sample of the population. A dataset is not a random variable, which has a precise mathematical definition, i.e. it is a (measurable) function (you can ignore the "measurable" adjective!): you can simply think of a random variable as a map between outcomes of e.g. an experiment and real numbers.

A dataset (or a sample) contains $N$ "realisations" (or "outcomes") of one or more random variables, where $N$ is the size of the dataset. More precisely, each value associated with each feature of the dataset is (usually) or can be associated with one random variable: when you sample from the population (i.e., you get one row of the dataset), each of the random variables is "realized", that is, you obtain one of the concrete outcomes that the associated random variable can take.

A dataset can thus be considered the realization(s) of a random variable, if there is only one feature, or of multiple random variables (or, equivalently, of a multi-dimensional or multi-variate random variable), if there are multiple features.

In your example, if $X=(x_1, x_2, \dots, x_M)$ is one row of your dataset, then $X$ can be associated with the "realization" of $M$ random variables: $x_1, x_2, \dots, x_M$ are the realizations of these $M$ random varables (which we can denote by $X_1, X_2, \dots, X_M)$, that is, they are the outcomes of these random variables. You may have more than one row or, equivalently, maybe $X$ is actually a matrix, where $x_i$ is a column vector of size $N$ (i.e. the size of the dataset) which contains $N$ realizations of the random variable associated with $x_i$ (which can be denoted by $X_i$).

In conclusion, the term "feature" is (usually) equivalent to the term "random variable". A random variable (or feature) can have several realisations (or outcomes).

$\endgroup$
0
$\begingroup$

Considering the available dataset (sample), the features are random variables and the sample includes examples or instances of the problem. Each example or instance takes a value at every random variable (or feature or covariate). All these definitions are equal. The features are indeed random variables because we assume that their possible values are outcomes of a random phenomenon and they follow a specific distribution that we might do not know.

$\endgroup$
1
  • $\begingroup$ The Features can be considered as random variables not the sample. For a particular problem if you have available four features like Height, Weight, Age and Sex, then you can consider them as random variables and you can have an estimation using the sample from the population. $\endgroup$ – Christos Karatsalos Jan 4 '19 at 11:08
0
$\begingroup$

A random variable is a measurable function $\Omega\to X$ where $\Omega$ is the set of possible outcomes and $X$ is a measurable space. Simply put, a random variable gives a value to each outcome where an outcome might be a temperature reading, a win or loss, or the distance a runner can jump.

Example:

Consider a coin toss where the possible outcome is heads or tails. We can make a random variable with these outcomes such that heads $= 1$ and tails $= 0$. Assuming the coin is fair the probability of that $\mathbb{P}(X=1)=\frac{1}{2}$ and $\mathbb{P}(X=0)=\frac{1}{2}$.

Now what if we have something like temperature readings? In this case we can simply map each outcome (the temperature reading) to be that same value. Therefore if the outcome is 76 degrees Fahrenheit the value of the random variable is 76.

In the context of machine learning $X$ can be a random variable where the number of dimensions $k$ equals the number of features. An example of a $k$ dimensional random variable is a $k$ dimensional Gaussian distribution. More concretely when $k=2$ we have a bell "hump" instead of a bell curve, where the height of the hump is the probability of two features having values $(x_1, x_2)$. Relating this back to a real world example $x_1$ might be 76 for temperature and $x_2$ might be $0.8$ for humidity.

By the way if you are learning machine learning for the first time I suggest getting a good undergraduate text on probability to supplement your studies. Most machine learning techniques build on classical probability and statistics. Unfortunately I don't have a favorite. If you have studied measure theory I have some suggestions for more advanced texts.

$\endgroup$
1
  • $\begingroup$ In response to your first comment, I am only discussing the values of a random variable. There is no mapping. Indeed, the measure of these values is a probability. In response to your second, I defined $X$ to be a multivariate Gaussian, hence each feature $(x_1, x_22$, etc) is Gaussian. $\endgroup$ – Chris Jan 4 '19 at 4:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.