1
$\begingroup$

I'm using IsolationForest algorithm in order to detect anomalies in my data and to use this model to detect future anomalies in new rows and came across a few questions:

  1. Is the model good for predicting new data or only on data that the algorithm was trained on and why?

  2. If the training set had a feature with 0 variance, and now I receive a row with a different value on that feature, how would the model detect it? (for example, all the training data rows have the same country, US, as a feature and now comes a new row from Japan), To my understanding the tree will not separate on a feature with 0 variance thus the model will not find anomalies on this feature (which seems very odd to me)

  3. If IsolationForest is not good at learning on data that can have 0 variance in some columns, would you recommend another algorithm that will capture such cenarios?

$\endgroup$
0

2 Answers 2

2
$\begingroup$

I can't comment on the IsolationForest algorithm. But regarding your second and third questions, I don't see how any algorithm could possibly learn anything from a feature with zero variance - there is simply no information there for it to work with.

You can set up a manual rule about what an algorithm should do if it encounters 'Japan' or any other country when it has only ever seen 'USA'. Or you can exclude country information entirely, if you can't come up with a manual rule that makes sense.

$\endgroup$
2
$\begingroup$

This is really to broad, please just ask one question per post! But, your problem seems to be features without any variation. How can you expect to learn from data, with statistical methods, without variation? That is simple unreasonable, and have nothing to do with particular algorithms like isolation forrest (which I do not know about.)

The real answer is that, if you want a model that can give useful predictions for levels, like Japan, not seen under training, then you must make a model that makes that possible! Details in Dealing with new Factor Levels in a Regression in R. So, get data about countries, Area, population size, GDP, ... and train with data on different countries.

$\endgroup$

Your Answer

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

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