Jump to: navigation, search
Contrast sensitivity curve and its Weibull fit

This function takes the output of a contrast sensitivity experiment and fits a Weibull curve to it. It is used by rgcFrequencySensitivityContrastScale.

A Weibull (cumulative distribution) function looks somewhat like a sigmoid, or a curvy step-function, between 0 and 1. It has two parameters, k and lambda. Its equation is :

<math> f(k, \lambda, x) = 1 - e^{-(x/ \lambda)^k} </math>

The contrast sensitivity curve will have accuracy 0.5 at 0 contrast, and accuracy 1 at big contrasts. So the function we actually need is :

<math> f/2 + 0.5 = 1 - 0.5e^{-(x/ \lambda)^k} </math>

The fit is found by minimizing the error between the experimental curve and the Weibull function. The error can be computed in L1 or L2 norm. (the frequency sensitivity experiment uses L2 by default.)

Two possible methods can be used to determine the minimum : grid search, in which every possible value in a grid is tried and the best one is retained, or gradient descent, an algorithm in which the path of highest gradient is followed until a minimum is reached.


[edit] Use of the function

 results = rgcFitWeibull(data,part1, datafile, displayPlot)

[edit] Inputs

  • data : first column is contrast values, second column is corresponding pCorrect values (percentage of correct guesses from classification). A first pair of values is added : [0, 0.5].
  • part1 : choses type of minimisation. 1 is grid search, 2 is gradient descent. (default = 1)
  • datafile : file to read the data from (if no other data argument is given).
  • plot : 0 or 1 to display plot.

[edit] Outputs

  • results
    • minIndex2: [1x2] : index (i,j) of minimum for L2 norm
    • minValBrute2: 1x1  : value of L2 error at minimum
    • fittedParameters2: [1x2] : values of k and lambda for L2 minimum
    • err2: [length(kTable)xlength(lambdaTable)] : error table for L2
    • minIndex1: [1x2] : index (i,j) of minimum for L1 norm
    • minValBrute1: 1x1  : value of L1 error at minimum
    • fittedParameters1: [1x2] : values of k and lambda for L1 minimum
    • err1: [length(kTable)xlength(lambdaTable)] : error table for L1

[edit] Remarks

  • Gradient descent does not work well as the surface seems to have a pretty nasty shape. You end up in a 'not so bad zone' but you get then stuck (quote Guillaume). This is a little weird, I would expect the gradient descent to get a completely wrong local minimum, or to get the exact global minimum (quote Estelle).

TODO : use the gradient descent to find an acceptable zone, and then grid search to find the minimum. Though this seems to be working pretty well as it is.

  • Because the function that fits our curve is a scaled and translated Weibull function, there is ambiguity as to what contrast value corresponds to what accuracy threshold. When we say "contrast at 80% accuracy", we mean 80% accuracy on the sensitivity curve, which corresponds to 0.8*2 -1 = 0.6 on a normal Weibull.
  • Because contrasts are between 0 and 1, we should get contrast sensitivities between infinity(perfect) and 1(bad). In practice, we can get values below 1 because the contrast value is taken on the Weibull curve, which can be really bad when the data is really noisy. Usually, this is when the sensitivity would have been very low anyway, so it doesn't really matter.
Personal tools