1
$\begingroup$

I have a data in the matrix for:

\begin{bmatrix} 1 & 2 & 3 & 9 & 6\\ 8 & 2 & 7 & 4 & 6 \\ 1 & 2 & 8 & 7 & 4 \end{bmatrix}

Each row corresponds to a vector $x_i$. I want to re-scale this data into $[-1,1]$ with zero mean. I am new in this domain.

I am trying to train this data in SVM. I try subtracting each row $x_i$ by its mean, and then divide by its variance

$$x_i=\frac{x_i - \operatorname{mean}(x_i)}{\operatorname{std}(x_i)},$$

but I don't get my aim.

$\endgroup$
1
$\begingroup$

$y_i=\frac{x_i - \operatorname{mean}(x_i)}{\operatorname{std}(x_i)}$ is a sequence with mean $0$ and standard deviation of $1$. If you want all of $y_i$ to be contained in $[-1, 1]$, divide by $\max{|x_i-\operatorname{mean}(x_i)|}$ instead.

$\endgroup$
0
$\begingroup$

You can also use $y_i = \frac{x_i - \text{mean}(x_i)}{\max(x_i) - \min(x_i)}$ to get all $y_i$ in the $[-1,1]$ range with $0$ mean.

$\endgroup$

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.