### Detect Outlier using Boxplot in Java

`import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;`
```public boolean isOutlier(String itemId, String value) {

if (monitoringItem.getProperties().getBoxPlotSize() > 0) {
BoxPlot boxPlot = Statics.boxPlotRepository.findByItemId(itemId);

DescriptiveStatistics descriptiveStatistics = new DescriptiveStatistics();
double dValue = Double.parseDouble(value);

for (ItemBoxPlot bItem : boxPlot.getBoxPlotList()) {
double d = Double.parseDouble(bItem.getValue());

}

double Q1 = descriptiveStatistics.getPercentile(25);
double Q3 = descriptiveStatistics.getPercentile(75);
double IQR = Q3 - Q1;

double highRange = Q3 + 3 * IQR;
double lowRange = Q1 - 3 * IQR;

if (dValue > highRange || dValue < lowRange) {
return true;
}
}

return false;
}```

### Detect Outlier using Boxplot

Order the data from least to greatest then calculate these values:

• Q1 – quartile 1, the median of the lower half of the data set
• Q2 – quartile 2, the median of the entire data set
• Q3 – quartile 3, the median of the upper half of the data set
• IQR – interquartile range, the difference from Q3 to Q1
• Extreme Values – the smallest and largest values in a data set

Outliers

In order to be an outlier, the data value must be:

• larger than Q3 by at least 1.5 (some times 3) times the interquartile range (IQR), or
• smaller than Q1 by at least 1.5 (some times 3) times the IQR.

### Min-Max Normalization Formula

Suppose that the minimum and maximum values for the feature income are \$120,000 and \$98,000, respectively. We would like to map income to the range 0.0,1.0 . By min-max normalization, a value of \$73,600 for income is transformed to:

### Power-Torque Formula

Torque (lb.in) = 63,025 x Power (HP) / Speed (RPM)

Power (HP) = Torque (lb.in) x Speed (RPM) / 63,025

Torque (N.m) = 9.5488 x Power (kW) / Speed (RPM)

Power (kW) = Torque (N.m) x Speed (RPM) / 9.5488