# Why to exclude features used for label generation during modeling?

I have a dataset like below without labels

But with the help of experts opinion, we generate labels based on the below 3 rules (all 3 rules has to be met to label it as 1)

So now the dataset looks like below

As you can see that my final dataset has the labels.

Now I can run a ML model for classification. Am I right?

But I read that during model building process, features that were used to create the labels will have to be excluded because they might result in perfect separation of classes and model might fail. what does it mean by fail? Aren't we aiming for separation of classes through classification algorithms?

May I know why do we have to exclude these features (Ex: RG, FG and BP features which were used to derive labels)?

It's basically my model will be built on below dataset. But aren't we losing the predictive power? why do we have to build a model by excluding those features (that were used to derive labels)?

## 3 Answers

You created the labels using the data. If you are able to label them with the data, then why do you need a machine learning model? It simply becomes a rule based classifier. What you would like to do, is to find a function that fits your data points.

For example, if you run a decision tree classifier, then it's going to find perfect splits based on your labelling rules. Hence, you're feeding the model a bit about the labelling technique. This is called data leakage. The model sees something really obvious and will have accuracy of 1 usually.

• Thanks for the response. Upvoted – The Great Mar 11 at 13:03

What you are doing is right. You can build a ML model using this. In your case your input and output are correlated. Consider the salary of an employee wrt his experience. These both are related and sometimes used to derive salary based on experience.

What you might have read is if one feature is used to derive other feature and dont use both features, as both will yield same results. You can point to that writing for further clarification.

Additionally, what is the significance of variables T1,T2 and T3? If these are nowhere correlated to the output label then actually you would have to eliminate them.

• Thanks for the response. Upvoted. but what do you mean by "You can build a ML model using this". what does this denote here?. The question isn't about using one feature to derive another feature. It's about using feature to derive the labels – The Great Mar 11 at 7:52

But I read that during model building process, features that were used to create the labels will have to be excluded because they might result in perfect separation of classes and model might fail?

No, just because an expert used them does not mean that that feature only hast to be helpfull or not. If that was the truth than you could write a couple of if queries to classify. Leave all of it, rely on expert labeling, but let the whole dataset tell you otherwise.

• Thanks for the response. Upvoted. Sorry my english skills isn't that good. May I kindly check with you once again. My question isn't on expert labeling. Yes, as you said I can write queries to classify them. But why is that during model building process, they exclude the features that were used for label generation and find predictions only based on remaining features? – The Great Mar 11 at 9:49
• To see it the remaining features are discriminative enough (if not more) than the ones human can analyse and make predictions (i.e. create labels) – Noah Weber Mar 11 at 9:56
• What will happen if I retain them in the dataset as is (without excluding) along with other features and train the model? – The Great Mar 11 at 9:58
• Model will most likely only focus on the features that you used to create the labels. Let the data tell you. Try it with and without these features and check the performance on CV. Thats the best indicator. – Noah Weber Mar 11 at 10:05