1
$\begingroup$

Let's suppose I have a dataset with numerical attributes of different types.

Let's suppose I want to employ a Neural Network for supervised classification with that dataset. For that, I need to extract feature vectors from that data.

Those feature vectors must be suitable for NNs. (should be normalized/standarized vectors...)

As an example, our dataset consist of data from football games.

DATASET:

-------------------------------------------------------------------
| local_elo| vis_elo| local_pts | vis_pts | loc_goals | vis_goals |
-------------------------------------------------------------------
|   2820   |  3250  |     45    |    54   |    13     |     17    |
-------------------------------------------------------------------
|   4230   |  5125  |     87    |    81   |    67     |     65    |
-------------------------------------------------------------------

The feature vectors this two data points:

x_1 = [2820, 3250, 45, 54, 13, 17]
x_2 = [4230, 5125, 87, 81, 67, 65]

but they are not suitable for feed them into a Neural Network.

How could this dataset be preprocessed in order to extract feature vectors suitables for feeding them into a Neural Network?

$\endgroup$
1
$\begingroup$

use function preprocessing.scale from sklearn

from sklearn import preprocessing
import numpy as np
X_train = np.array([[ 1., -1.,  2.],
                    [ 2.,  0.,  0.],
                    [ 0.,  1., -1.]])
X_scaled = preprocessing.scale(X_train)

http://scikit-learn.org/stable/modules/preprocessing.html

$\endgroup$
2
$\begingroup$

we've to use standardization(substitute by z-scores or subtract mean divide by standard deviation) in such cases:

#find mean of each feature    
mean = data.mean(axis = 0)
#subtract mean
data - = mean
#find standard deviation of each feature
std = data.std(axis = 0)
#divide by it
data /= std
$\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.