I have X values and corresponding y-labels, until now I used to round my labels <0.5 to 0 and >0.5 to 1. Is it possible to use values between 0 and 1 for "y train"? Using Keras and Tensorflow. Appreciate any suggestions.

Assuming y_train is already in range [0, 1], it should be enough to specify the correct loss function while compiling a model (model.compile).

Loss functions can be found here.

Chose one which is not for categorical variables (since you have a range [0, 1]).

You are talking about 2 different optimization problems and would know best which of the 2 is your case.

In the first case you are trying to divide the data to 2 distinctive categories - classification (using 0,1 labels), and in the second you are trying to estimate the relationship between the input and the output variables - regression (using the [0,1] range).

For the first category you should use binary cross-entropy (keras.losses.binary_crossentropy)

For the second you should use MSE (keras.losses.mean_squared_error).

These are just 2 of the available options, you can read about more options in the following link: How to choose the right loss for fitting a model

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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