Hot answers tagged

11

As a rule of thumb, removing outliers without a good reason to remove outliers rarely does anyone any good. Without a deep and vested understanding of what the possible ranges exist within each feature, then removing outliers becomes tricky. Often times, I see students/new hires plot box-plots or check mean and standard deviation to determine an outlier ...


8

First of all, start with a subset until you know what you are doing. There is no use in waiting for hours for a result that doesn't work, or to run out of memory, or to optimize, just to find out it does not work. Secondly, makes sure your preprocessing is very very well done. Bad preprocessing will hurt your algorithms. From my experience, one-class SVM ...


8

Just an idea - your data is highly seasonal: daily and weekly cycles are quite perceptible. So first of all, try to decompose your variables (gas and electricity consumption, temperature, and solar radiation). Here is a nice tutorial on time series decomposition for R. After obtaining trend and seasonal components, the most interesting part begins. It's ...


8

(I actually wanted to write this as an answer to the Cross Validated question: Difference between Anomaly and Outlier, but the question is protected - I think answering it here should be fine, despite the lower visibility) People occasionally argue that there is no difference between an outlier and an anomaly by citing Charu Aggarwal, author of the Book "...


7

I would take a look at t-digest algorithm. It's been merged into mahout and also a part of some other libraries for big data streaming. You can get more about this algorithm particularly and big data anomaly detection in general in next resources: Practical machine learning anomaly detection book. Webinar: Anomaly Detection When You Don't Know What You Need ...


7

Fundamentally there is no difference. Say you have data and you want to build a model of it. As the name suggests, modeling is about finding a model, that is, a simplified representation of your data. In turn, we can view the model as an underlying process that generated your data in the first place, plus some noise. From that point of view, the data you ...


7

Seaborn uses inter-quartile range to detect the outliers. What you need to do is to reproduce the same function in the column you want to drop the outliers. It's quite easy to do in Pandas. If we assume that your dataframe is called df and the column you want to filter based AVG, then Q1 = df['AVG'].quantile(0.25) Q3 = df['AVG'].quantile(0.75) IQR = Q3 - ...


7

TL;DR Use the two functions from below to get the index of the elbow: elbow_index = find_elbow(data, get_data_radiant(data)) Edit: I put all of the code below into a python package called kneebow. Now, you can simply do it like this: from kneebow.rotor import Rotor rotor = Rotor() rotor.fit_rotate(data) elbow_index = rotor.get_elbow_index() Long Answer ...


6

Both types of networks try to reconstruct the input after feeding it through some kind of compression / decompression mechanism. For outlier detection the reconstruction error between input and output is measured - outliers are expected to have a higher reconstruction error. The main difference seems to be the way how the input is compressed: Plain ...


6

Generally speaking, decision trees are able to handle outliers because their leafs are constructed under metrics which aim to discriminate as much as possible the resulting subsets. Whether you are using Gini Impurity, Information Gain or Variance Reduction to construct your decision tree does not change the outcome : all of these models aim to create as ...


6

Tophat makes some great points. Another thing to consider is that you removed close to 20 percent of your data by removing the "outliers" which leads me to believe that they really aren't outliers, rather, just extreme values. Certainly, there may be an outlier on one dimension that you should look at, but with such a rich data set, an extreme value in one ...


5

One way of thinking of outlier detection is that you're creating a predictive model, then you're checking to see if a point falls within the range of predictions. From an information-theoretic point of view, you can see how much each observation increases the entropy of your model. If you are treating this data as just a collection of numbers, and you don'...


5

You can use BoxPlot for outlier analysis. I would show you how to do that in Python: Consider your data as an array: a = [100, 50, 150, 200, 35, 60 ,50, 20, 500] Now, use seaborn to plot the boxplot: import seaborn as sn sn.boxplot(a) So, you would get a plot which looks somewhat like this: Seems like 500 is the only outlier to me. But, it all depends ...


5

An "outlier" is an observation that is so unexpected that we suspect it wasn't valid -- corrupted by noise or something. But what is unexpected? An observation that is highly improbable? But then how do we know what's probable? Unless you're able or willing to make some assumptions about the distribution that generated these numbers, you can't really ...


5

Outliers: In decision tree learning, you do splits based on a metric that depends on the proportions of the classes on the left and right leaves after the split (for instance, Giny Impurity). If there are few outliers (which should be the case: if not, you cannot use any model), then they will not be relevant to these proportions. For this reason, decision ...


4

you need to distinguish between these cases: Data Imbalance Data Imbalance + Very few number of samples (minority class) Severe Data Imbalance + Very few number of samples (minority class) 20:60 vs. 10:20 vs. 100:1000 vs. 10:100 and these cases: similarities between different classes. wide variations within the same class. You need to understand ...


4

One idea would be to plot the daily average power consumption in a bar plot: For a finer visualization of day-hour peaks, you can try to plot it in a matrix format:


4

This question is quite broad. I'll try to set you on the right path, more so than providing a truly complete answer. Theoretical background As others have mentioned, the task you're trying to do is usually known as anomaly detection, also known as novelty detection. There's many possible ways to approach this kind of task, depending on the assumptions you ...


4

You could use this approach here: #------------------------------------------------------------------------------ # accept a dataframe, remove outliers, return cleaned data in a new dataframe # see http://www.itl.nist.gov/div898/handbook/prc/section1/prc16.htm #------------------------------------------------------------------------------ def remove_outlier(...


4

There are different flavors of Naive Bayes, so the answer depends a bit on the use case. One potential issue with outliers is that unseen observations can lead to 0 probabilities. For example, Bernoulli Naive Bayes applied to word features will always produce 0 probabilities when it encounters a word that wasn't seen in the training data. Outliers in this ...


4

I recently had a similar problem (removing abnormal peaks from a time series). That's what I suggest you: Get the smoothed trend. There are several techniques you can employ, such as various forms of exponential smoothing. Find the difference between actual trend observations and smoothed ones. Normalize this distribution of distances (using Z-score, i.e. ...


3

I would add to Dan Levin's answer that when you want to justify a method, the "scientific/engineering way" is to first produce a bibliographical study, where you basically prove that your approach covers an important part of what is commonly known as state-of-the-art methods. I would resume this as follow: Look for commonly used methods that are known to be ...


3

You can justify your choices by using data. Treat the anomaly detection like a supervised learning problem where the concept is being anomaly. Then you'll be able to present - for each method - its confusion matrix. Not only it will be a good justification, it will enable to understand the expected results. Many times, we have models and we wonder which ...


3

I suggest , go for Anomaly detection: Anomaly Detection is done assuming our data has a probability distribution(gaussian). We can plot data to see if thats the case, if not we can make it gaussian using log transforms. Gaussian distribution specifies the regions and probabilities of our data lying in those regions. For example : replace original feature x ...


3

If you need SQL code that runs various outlier detection methods against any arbitrary table, check out my series of articles and code samples geared towards SQL Server. I provide some preliminary code for Grubb's Tests, Z-Scores and Modified Z-Scores, Interquartile Range, Dixon's Q-Test, GESD, the Tietjen-Moore Test, Pierce's Criterion, Chauvenet's ...


3

If you want to approach this from a SQL perspective, then broadly I would identify any classification variables that cause different behaviour. Then perform something like the following on a number of analysis variables. SELECT ClassificationVar1, ClassificationVar2, MIN(AnalysisVar1) as Min_AnalysisVar1, MAX(AnalysisVar1) as Max_AnalysisVar1,...


3

A simple approach would be using the same thing as box plots does: away than 1.5 (median-q1) or 1.5 (q3-median) = outlier. I find it useful in lots of cases even it not perfect and maybe too simple. It has the advantage to not suppose normality.


3

In your training notebook you present results for training with 20 epochs. Have you tried varying that parameter, to see if it affects your performance? This is an important parameter for back-propagation. For estimating your model parameters, as user tomaskazemekas pointed out, plotting Learning Curves is a very good approach. In addition to that, you ...


3

You may view your data as a time series where an ordinary measurement produce a value very close to the previous value and a re-calibration produce a value with a large difference to the predecessor. Here are simulated sample data based on normal distribution with three different means similar to your example. By calculating the difference to the previous ...


3

I guess you need anomaly detection algorithm. It is like fraud detection for finding abnormal behaviors. In data mining, anomaly detection (also outlier detection) is the identification of items, events or observations which do not conform to an expected pattern or other items in a dataset. Typically the anomalous items will translate to some kind of ...


Only top voted, non community-wiki answers of a minimum length are eligible