This is going to be a very beginner's question.

I have a datset of continues features like LoanAmount, LoanDuration(multiclass?), ... ClientIncome, ClientFreeSources, etc. and a binary target whether a contract was sued or not.

I'm not sure how to approach the problem as I'm fairly new to DS. I can reformulate the target into limited number of values like 5, 11, 18, ... which I think would be probably precieved as multiclass by a model or into continues value expressed in DebtAmount after some work at the SQL Server end.

However, the simple flag Sued 1/0 would be prefered option at the begining if possible. I also wonder how to treat high-cardninality categorical features like post code because the number of new dummy variables which seems to me too high.

Thanks for your answers in advance.


I am expecting this question is for a supervised learning problem where you have a mixture of continuous and categorical features as independent features and your dependent or target feature is a binary class feature. If that is so please follow the below advice.

There might be a much better solutions but this worked for me. I had more than 200 features and a categorical feature like pin code.

  • Target Feature as 1/0

    • I am assuming this is a supervised learning problem and the best way to go about will be by starting with a basic logisitic regression model.
    • If you are not impressed by the performance then you can even try some advanced classification algorithms like Naive Bayes, KNN, SVM etc.
  • Categorical Feature

    • You can use pandas one hot encoding for this
      • I kept a threshold, and used one hot encoding only on those unique categories which occurred more than this threshold
      • The ones which were less than the threshold can be dropped, but I used a special value to encode them just in case to not to loose them.
      • You can follow here to know how to perform one-hot encoding

I hope I answered at least to a certain extent. Again, I used this solution for my issue and it worked pretty well and hope it works for you too.


Since you have a binary target, you can use any classification algorithm, for example logistic regression, support vector machine or trees. It is therefore no problem at all if you have a binary target.

As for the problem of having too many categories when using post code, you could omit the last one or two digits, so that one category includes a larger area than just a full digit post code. (That only works if the more digits you add to the post code, the more specific the region gets. IDK whether that works for all post code systems in the world)


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.