#338 closed defect (duplicate)
multiple robust statistics prevent use
| Reported by: | Paul Price | Owned by: | |
|---|---|---|---|
| Priority: | high | Milestone: | |
| Component: | types | Version: | unspecified |
| Severity: | major | Keywords: | |
| Cc: |
Description
These were found during a walk through of the current CVS version of the code.
Sorry for filing bugs on code that is not officially released, but I'm finding
them and would prefer to note and track them.
- In several cases, "stats" is used where "tmpStats" should be:
if (fabs(binSize) <= FLT_EPSILON) {
if (stats->options & PS_STAT_ROBUST_MEAN) {
stats->robustMean = stats->clippedMean;
}
Should be: stats->robustMean = tmpStats->clippedMean;
(Similarly with following lines; 5 occurences total.)
Also:
Determine minimum and maximum values in the data vector.
if (isnan(stats->min)) {
and
if (isnan(stats->max)) {
should refer to "tmpStats" instead of "stats".
- The result of the minimisation is not checked. In the event that the
minimisation fails, a warning should be generated. This is a better check to
make than the difference from "myMean", since it is the result of the
minimisation that is the robust mean (not "myMean"). Similarly with the
standard deviation.
- The fitting should only be over the range: mode - dL --> mode + dL
but the current implementation attempts to fit the entire histogram. This can
cause the minimisation to fail to converge (and take a long time doing so).
Current:
p_psNormalizeVectorRangeF32(robustHistogramVector, 0.0, 1.0);
for (i=0;i<robustHistogramVector->n;i++) {
myCoords->data[i] = (psPtr *) psVectorAlloc(2, PS_TYPE_F32);
((psVector *) (myCoords->data[i]))->data.F32[0] = (psF32) i;
y->data.F32[i] = robustHistogramVector->data.F32[i];
}
I suggest:
psMinimization *min = psMinimizationAlloc(100, 0.01);
psVector *myParams = psVectorAlloc(2, PS_TYPE_F32);
psArray *myCoords = psArrayAlloc(2 * dL + 1);
psVector *y = psVectorAlloc(2 * dL + 1, PS_TYPE_F32);
p_psNormalizeVectorRangeF32(robustHistogramVector, 0.0, 1.0);
for (i = modeBinNum - dL; i <= modeBinNum + dL; i++) {
int index = i - modeBinNum + dL;
myCoords->data[index] = (psPtr *) psVectorAlloc(2, PS_TYPE_F32);
((psVector *) (myCoords->data[index]))->data.F32[0] =
PS_BIN_MIDPOINT(robustHistogram, i);
y->data.F32[index] = robustHistogramVector->data.F32[i];
}
- The "myParams" vector is freed immediately after the minimisation, but then
later used.
- Operations should only be performed if requested by the user. For example,
if the user wants only the robust median, there is no need to do the
minimization to obtain the robust mean.
Change History (8)
comment:1 by , 21 years ago
| Owner: | changed from to |
|---|
comment:2 by , 21 years ago
comment:3 by , 21 years ago
| Status: | new → assigned |
|---|
comment:4 by , 21 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
psMinimization is no longer required for this function. Therefore I'm closing
this bug. However, the robustStats still do not work properly: there are
problems with the new algorithm.
comment:5 by , 21 years ago
Where are the bugs in the robust statistics being traced?
What are the problems?
comment:6 by , 21 years ago
| Resolution: | fixed |
|---|---|
| Status: | closed → reopened |
comment:7 by , 21 years ago
| Resolution: | → duplicate |
|---|---|
| Status: | reopened → closed |
* This bug has been marked as a duplicate of 366 *

This should be done in the current and April release of the code. However,
currently, the change to the LMM Minimization function prototype breaks the
robust stats code (without a compiler error). This must be corrected.