1
$\begingroup$

I have a standardized dataset which has floats with this (for example, e+01) tail at the end. I know this is a multiplicator to save such a small number without needing to save many zeros between the comma and the first digit...

When feeding my y data to sklearn.train_test_split it will produce numbers without this (for example, e+01), but only in y_test, not in y_train.

x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=0.05, random_state=2)

print(y_test)
y_test: 
[[-0.14451121]
[-0.52454402]
[ 1.7813714 ]]

print(y_train)
trainY:
[[ 1.64936126e+00]
[ 1.56135449e+00]
[-3.67460396e-01]
[-4.59134107e-01]....]

This should be bad for estimating my validation loss in an ANN, or isn't it? How do I prevent this?

$\endgroup$

1 Answer 1

1
$\begingroup$

The situation is just about print formatting and independent from train_test_split method. For example,

x = np.array([1,2,3,100000.0])
print(x)
print(np.array(x[:-1]))

produces the output

[1.e+00 2.e+00 3.e+00 1.e+05]
[1. 2. 3.]

So, if the array you're printing has a large logarithmic interval, python chooses to print the numbers in e+x format. If they're close together, it chooses to print in the usual manner.

$\endgroup$

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