Skip to content

Improve closure by returning more reasonable values #130

@pricebenjamin

Description

@pricebenjamin

From the introduction:

In gplearn, several protected functions are used:

  • division, if the denominator lies between -0.001 and 0.001, returns 1.0.
  • square root returns the square root of the absolute value of the argument.
  • log returns the logarithm of the absolute value of the argument, or for very small values less than 0.001, it returns 0.0.
  • inverse, if the argument lies between -0.001 and 0.001, returns 0.0.

Are these return values widely accepted?

If the denominator lies between -0.001 and 0.001, why should the node return 1.0? Alternatively,

  • Prune the node
  • If -0.001 < denominator < 0, set denominator equal to -0.001, and if 0 < denominator < 0.001, set denominator equal to 0.001
  • Construct a piece-wise function that assumes values of 1/x outside of the interval [-0.001, 0.001] and uses a line segment to join the two pieces (or use a more complicated, but differentiable, solution)

Similar approaches could be used for the logarithm.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions