IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Opened 21 years ago

Closed 21 years ago

Last modified 20 years ago

#338 closed defect (duplicate)

multiple robust statistics prevent use

Reported by: Paul Price Owned by: gusciora@…
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.


  1. 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".


  1. 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.


  1. 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];

}


  1. The "myParams" vector is freed immediately after the minimisation, but then

later used.


  1. 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 robert.desonia@…, 21 years ago

Owner: changed from robert.desonia@… to gusciora@…

comment:2 by gusciora@…, 21 years ago

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.

comment:3 by gusciora@…, 21 years ago

Status: newassigned

comment:4 by gusciora@…, 21 years ago

Resolution: fixed
Status: assignedclosed

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 Paul Price, 21 years ago

Where are the bugs in the robust statistics being traced?
What are the problems?

comment:6 by Paul Price, 21 years ago

Resolution: fixed
Status: closedreopened

comment:7 by Paul Price, 21 years ago

Resolution: duplicate
Status: reopenedclosed

* This bug has been marked as a duplicate of 366 *

comment:8 by Paul Price, 20 years ago

Code works now.

Note: See TracTickets for help on using tickets.