I'm currently involved in a problem where we want to predict some values of a variable X (continuous) based on a bunch of features (like any other regression problem). The key here is that the value of X can be optimum or not optimum, so we want our algorithm to learn to predict X in an optimum way:

For every new example of data, the result of the prediction should be a value of X as optimal as possible.

One value is optimum just if it is lower than a certain threshold (the lower the better) but fulfilling a series of restrictions about its features.

I think that one way of achieve this is filtering and keep only the examples that have an optimum X value and train our algorithm with those examples, but that would reduce the data in a considerably way, maybe disregarding possible useful information.

I would like to ask you or receive some advice about what's the correct approach for this kind of problems.

At the moment I have been thinking another way to solve this keeping all the examples: adding a new binary feature indicating if X is optimum or not, train the model with all the data and in the prediction step use the features of the example to predict but adding them a positive value as the new binary optimum feature, so the model would use all the information in which it has been trained (optimum and not optimum) to predict the example thinking that it is optimum. This is just and idea, nothing checked or even deep thought.

What is your opinion about this? Any suggestions? Thank you!


1 Answer 1


I wouldn't filter out the data. Reason being is that you will make your model biased towards predicting the optimum. Look into the bias-variance trade-off. Hence, I would drop the filtering option.

Your last reasoning however seems good.

However, in the beginning, you mentioned that you are interested in predicting a continuous variable. But you are interested in predicting whether or not you have your optimum right? Which is a categorical variable.

  • 1
    $\begingroup$ No, predicting if the optimum is right or not has no value for me. I'll add a little bit more of explanation. There are two types of examples: good and not good, and I want that my algorithm learn to predict the target (cont.) to have a result that is good, but what I need is the target value, because I'll always suppose that it is a good value. (optimum = good, in this case) $\endgroup$
    – rmoret
    Nov 11, 2021 at 11:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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