3
$\begingroup$

Actually this question is related with this post,but this is about point of 3-dimension

data = ReplacePart[
   Catenate[
    Table[{i, j, Sin[j^2 + i]}, {i, 0, Pi, 0.2}, {j, 0, Pi, 0.2}]], 
   100 -> {1.2, 0.6, 1.5}];
ListPlot3D[data, Mesh -> None, InterpolationOrder -> 2, 
 ColorFunction -> "SouthwestColors"]

Mathematica graphics

I add a singular value in position $100$ manully,but I don't know how to detect it.

$\endgroup$
5
+50
$\begingroup$

In general, detecting anomalies is pretty straightforward assuming you know the distribution of your data.

In this case, I will estimate the distribution for each dimension in your data, then calculate the probabilities retroactively.

Find Distributions

dataPDFs = Table[
  Block[{dist},
    dist = FindDistribution[data[[All,i]], MaxItems->1];
    PDF[dist,#] &/@ data[[All,i]]
  ]
  ,{i,1,3}] 

We have a distribution for each dimension, then plug each value back into the dimensions to find the probability that the value belongs to the distribution.

To visualize what we just did:

Column[ListPlot[#, PlotStyle -> {Red, PointSize -> Large}] & /@ dataPDFs]

Probabilities for each dimension

Outlier is immediately evident.

We can search our results for probabilities less than a given threshold:

Position[dataPDFs, x_ /; x < .01]
(* {{3, 100}} *)

Outlier found in dimension three, position 100

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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