Monday, November 27, 2017

Anomaly Detection - 1

On a broad level, anomalies can be classified as point anomalies, contextual anomalies and collective anomalies.

Here's some of techniques that can be used to detect anomalies

1.  Statistical Methods

Flag data points that deviate from common statistical properties of a distribution - mean, mode, median, quantile.

We can use rolling average or moving average to smoothen short term fluctuations. A low pass filter can be used by n-period simple moving average.

2.  Density Based Anomaly Detection

This technique assumes that normal data points will occur around a dense neighborhood and the abnormalities will be far away (based on k-nearest neighbors algorithm or local outlier factor).

3. Clustering (e.g. K-means clustering algorithm)

4. Support Vector Machine - Variants of SVM like One-Class SVM can be used for anomaly detection.



Further Reading: 

1.https://en.wikipedia.org/wiki/Anomaly_detection
2.http://www.nehalemlabs.net/prototype/blog/2013/04/05/an-introduction-to-smoothing-time-series-in-python-part-i-filtering-theory/
3.https://bugra.github.io/work/notes/2014-03-31/outlier-detection-in-time-series-signals-fft-median-filtering/

NLP Basics - 1

Tokenization - Process of segmenting running text into words and sentences.

Normalization - Steps we take to condense terms into lexical units.

Named Entity Extraction - Locate and classify named entities in text into pre-defined categories

Stemming - Reducing inflected words to their root form.

Lemmatization - Grouping together inflected forms of a words so that they can be analyzed as a single item.




API  Links:

1. Watson - https://www.ibm.com/watson/services/natural-language-classifier/
2. Google Cloud Platform - https://cloud.google.com/natural-language/
3. Amazon Lex - https://aws.amazon.com/lex/
4. Facebook Deep Text - https://code.facebook.com/posts/181565595577955/introducing-deeptext-facebook-s-text-understanding-engine/
5. Microsoft Cognitive Services - https://azure.microsoft.com/en-in/services/cognitive-services/directory/lang/



References:

https://www.ibm.com/developerworks/community/blogs/nlp/entry/tokenization?lang=en

Saturday, November 25, 2017

Interpreting ML Models - 1

Data Leakage - When information available in the context of model training is unavailable in deployment setting

Feature Importance Algorithm - Describes magnitude of dependance a model has on a feature

FairML can be used to measure model's dependence on its inputs

1. Seeing Data - glyphs, correlation graphs, 2-d projections, partial dependence plots, residual analysis

2. Related Models - OLS regression : penalized regression, generalized additive models, quantile regression

3. Understanding complex learning models: Surrogate modes, Local Interpretable Model agnostic explanations (LIME) , LOCO, Tree Interpreter.







References & Further Reading:

http://blog.fastforwardlabs.com/2017/03/09/fairml-auditing-black-box-predictive-models.html
https://www.oreilly.com/ideas/ideas-on-interpreting-machine-learning
http://www.nature.com/news/can-we-open-the-black-box-of-ai-1.20731
https://homes.cs.washington.edu/~marcotcr/blog/lime/

Friday, November 24, 2017

AI Environments

Here's some basic terminology related to environments in AI


1. Fully vs Partially Observable Environment / System

An environment is called fully observable if the what the intelligent agent senses is good enough to make an optimal decision.

In partially observable systems, an intelligent agent will generally need some memory to make the best possible action.

2. Deterministic vs Stochastic Environment

If we can uniquely determine outcomes from agent's actions, we are in an deterministic environment. If there is an element of randomness that impacts the outcome, we are in a stochastic environment.

3.  Discrete vs Continous

Discrete: We have finitely many action choices or finitely many things that can be sensed (e.g. Chess)
Continous: Space of possible actions or things we can sense may be infinite

4. Benign vs Adversarial Environments

Benign : Environment might be random/ stochastic but it has no objectives of its own to contradict your own objectives

Adversarial: There is an agent which actively observes you and counteracts what you are trying to achieve