# How to detect anomalies based on types?

**URL:** https://discourse.numenta.org/t/how-to-detect-anomalies-based-on-types/3465
**Category:** Applications
**Created:** [February 14, 2018, 1:54pm UTC](https://discourse.numenta.org/t/how-to-detect-anomalies-based-on-types/3465 "2018-02-14T13:54:14Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![KimB](https://avatars.discourse-cdn.com/v4/letter/k/edb3f5/32.png) [@KimB](https://discourse.numenta.org/u/KimB)
#### Post date: [February 14, 2018, 1:54pm UTC](https://discourse.numenta.org/t/how-to-detect-anomalies-based-on-types/3465/1 "2018-02-14T13:54:15Z")

</div>

Hi,  
I’m trying to set up a program that detects anomalies where the input is one datetime field and the other is a type that is represented with string. I have been trying to keep it a string but have yet to figure out how to do that. So right now i have converted it to integer representations. But i get a lot of false positives (anomaly probability \>99%), even on the tests I have synthesized, where there is one event of the same type at the same time every day ( ~1k inputs).  
To do this I have been working from the code for the hotgym example. I have been trying to read up on how to configure the model params by looking at the comments in the model.yaml file, at the quick start guide and in the forum for help.

What I’m trying to ask is:

- How can I cofigure the program to detect anomalies in types?
- Where do I start to configure the model params to try to get fewer false positives?

Thanks!

---

<div class="post-metadata">

### Author: ![rhyolight](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/rhyolight/32/3922_2.png) [@rhyolight](https://discourse.numenta.org/u/rhyolight)
#### Post date: [February 14, 2018, 4:36pm UTC](https://discourse.numenta.org/t/how-to-detect-anomalies-based-on-types/3465/2 "2018-02-14T16:36:34Z")

</div>

> [@KimB](#):
>
> anomaly probability \>99%

The term “anomaly probability” is not one I recognize with NuPIC. Are you talking about “anomaly score” or “anomaly likelihood”?

> [@KimB](#):
>
> How can I cofigure the program to detect anomalies in types?

[Here](https://github.com/numenta/nupic/tree/master/examples/prediction/category_prediction) is an example of encoding categories. Here are the encoder params:

> <https://github.com/numenta/nupic-legacy/blob/master/examples/prediction/category_prediction/webdata.py#L68-L82>

Here is the code dealing with getting encodings from the category encoder:

> <https://github.com/numenta/nupic-legacy/blob/master/examples/prediction/category_prediction/webdata.py#L227-L236>

> [@KimB](#):
>
> Where do I start to configure the model params to try to get fewer false positives?

The false positives may not be identified properly. See my question about anomaly score vs likelihood above.

> [@Clarification on anomaly score and anomalylikelihood](https://discourse.numenta.org/t/clarification-on-anomaly-score-and-anomalylikelihood/2643):
>
> Hi Can someone clarify my doubt on Anomaly Score and Anomaly likelihood ? I got anomaly score =0.1 and anomalylikelihood=0.999 Can I consider this is an anomaly ?
