1
$\begingroup$

I am a beginner and my question relates to feature engineering. My task is to help develop a model which predicts whether a customer request is a fraud case.

A variable in the dataset is the applicant's zip code. Is it ok to create an indicator variable which is 0 if fraud does not happen frequently (e.g. <2% fraud) for this postal code and 1 otherwise? Or is this wrong because I would use the dependent variable (isFraud) to find out in which places fraud happens frequently and falsify the result?

Any help would be greatly appreciated!

$\endgroup$
0
$\begingroup$

You are actually incorporating some kind of prior information into your dataset, which is perfectly OK if you don't include use your test and validation sets while calculating these statistics. Otherwise, you leak information, and your test results become (maybe overly) optimistic. So, you'll calculate these zip code statistics based on your training set, and label your test set accordingly.

$\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.