genestboost.utils package

genestboost.utils module.

genestboost.utils.d1_central_difference(func, y, h=1e-08)[source]

Approximate the first derivative of func at y.

Uses a first-order central difference with spacing h (error term O(h^2))

Parameters
  • func (callable) – Function that takes y as an argument and returns a value

  • y (np.ndarray) – Locations to calculate the value of func

  • h (float) – Spacing to use in calculating central difference. This value should be greater than zero.

Returns

The approximated values of the first derivative

Return type

np.ndarray

genestboost.utils.d2_central_difference(func, y, h=1e-08)[source]

Approximate the first derivative of func at y.

Uses a first-order central difference with spacing h (error term O(h^2))

Parameters
  • func (callable) – Function that takes y as an argument and returns a value

  • y (np.ndarray) – Locations to calculate the value of func

  • h (float) – Spacing to use in calculating central difference. This value should be greater than zero.

Returns

The approximated values of the first derivative

Return type

np.ndarray