To me it seems to be ill defined. Partially because of absence of knowledge which points are to be considered outliers in the first place.

The problem which I have in mind is "bad market data" detection. For example if a financial data provider is good only most of the time, but about 7-10% of data do not make any sense.

The action space is binary: either take an observation or reject it.

I am not sure about the reward, because the observations would be fed into an algorithm as inputs and the outputs of the algo would be outliers themselves. So the outliers detection should prevent outputs of the algorithm going rouge.

It is necessary to add that if we are talking about the market data (stocks, indices, fx), there's no guarantee that the distributions are stationary and there might be trends and jumps. If a supervised classifier is trainer based on historical data, how and how often should it be adjusted to be able to cope with different modes of the data.

  • $\begingroup$ Reinforcement learning is not a category of problems. It is a solution method for Markov decision processes (MDPs). The question should be "Can outlier detection be formulated as an MDP?". $\endgroup$
    – Hai Nguyen
    Oct 1, 2018 at 8:33
  • $\begingroup$ Thank you for the comments. The description was expanded to address question from @NeilSlater. $\endgroup$ Oct 1, 2018 at 8:39
  • 1
    $\begingroup$ @HaiNguyen: The additional factor that makes something a "RL problem" as opposed to an MDP formulation is the learning/optimisation goal, such as the definition of return, discount factor, whether to use average reward, whether we aim for optimal control or measuring a fixed policy. Otherwise agreed, a large part of the OP's problem would be about formulating their scenario as a MDP (or more likely framing it as one at a higher level due to consequences of choices). However, I don't see a need to re-word that part of the question $\endgroup$ Oct 1, 2018 at 10:12

1 Answer 1


It is quite often possible to frame a problem as a Reinforcement Learning (RL) problem at some level. However, this may turn out to be for no benefit, or a net cost towards solving the problem. Casting parameter or hyperparameter searches as RL can be adding a layer of complexity and reduce efficiency.

One key thing to bear in mind is that any classification or regression that occurs within a RL framework will end up using effectively the same models and approaches that could solve the same problems directly. These models would either appear directly as the function approximators in RL that implement policies or value functions, or they would be an implied part of them. If you have labeled data for classification - even delayed until some time after you collect data, then you are usually going to be better off using supervised learning directly.

For hyperparameter searches (e.g. cutoffs for anomaly detection) then you may not need labelled data, but just need a good way to test the model offline.

The first point at which supervised learning or classic anomaly detection might fail for you is if you never receive any feedback about individual records, only a measure of overall performance. In other words, if you can measure consequences of good performance, but never measure or check correctness.

Your characterisation

about 7-10% of data do not make any sense.

does not appear to fit that. It looks like you could detect this, maybe manually labelling a few thousand records, and train a classifier using supervised learning techniques. That is likely a much better use of your time than trying to restructure the problem at a higher level and trusting a trail-and-error approach to discover the same rules.

Putting that to one side, assuming you do have a problem where

  • data to be classified is arriving as a stream, and needs to be processed online, item by item or in small batches
  • you have reason to think that an accept/reject stage before processing further would be useful
  • you have no way to label training data for accept/reject
  • you have a way to measure performance of the remaining system after the accept/reject phase

then you could use RL to frame the accept/reject phase as an action. There are some challenges there, but essentially you would use RL along with measurement feedback to sample errors or gradients - typically using TD Error or policy gradients. This could wrap almost any model that does classification or anomaly detection etc, provided it could be trained using those gradients.

From comments, if the underlying distributions for accept/reject are non-stationary, this may point you more towards a RL solution. However, that may come with a cost to performance - you will need to balance exploration rate (which will reduce the performance of the model against stationary data) versus speed of learning new distributions. This is a problem for all online learners; the main advantage of a RL approach here is that it will not require generating new labelled data. If you can use a recency-weighted anomaly detection algorithm instead, then you won't need the labeled data either - whether that is better requires testing, personally I'd take a working anomaly detection as the baseline and only use RL if it proved itself better.

The specific items that you turn into states and rewards are not clear to me from the question, and you would need to work on these things carefully. It is possible you will need more than the current data item in order to define state, and that will depend a lot on how the feedback loop works that establishes reward.

  • $\begingroup$ Regarding classification and labelling, there still might be a problem with data which have a trend or which might have non-stationary distribution. RL approach would help to adapt to changes in the underlying data. $\endgroup$ Oct 1, 2018 at 14:51
  • $\begingroup$ @ArtemOboturov: It might, but at the expense of needing to increase exploration, which would impact performance of the system as the agent would need to make more deliberate misclassifications over time in order to test whether distributions had changed. Most RL agents do at least have mechanisms for that - e.g. some form of Upper Confidence Bound - whether it is worth doing depends on the degree of drift you expect, and how happy you would be to allow this routine testing to affect your data stream. $\endgroup$ Oct 1, 2018 at 15:13
  • $\begingroup$ Also, if you find that you can rely on unlabelled anomaly detection, then provided there is always a reasonable distance between acceptable and reject-able data, you can probably just use a simple online version of that - e.g. base the acceptance scores for mean and standard deviation on recency-weighted statistics. $\endgroup$ Oct 1, 2018 at 15:18
  • $\begingroup$ @ArtemOboturov I have added a paragraph about non-stationary problems to the answer. $\endgroup$ Oct 1, 2018 at 15:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .