yannis assael | the blog

  • Home
  • About
  • Categories
    • Android
    • Computing
    • iOS
    • Machine Learning
    • MacOSX
  • GitHub
  • Mobile Apps
  • yannisassael.com


Heaviside Step Function between 0 and 1 in Python (if else mathematical expression)

Written by iassael on 23/02/2015. Posted in computing, machine learning

Dirac_distribution_CDF.svgThe numpy.sign() function returns a result between -1 and 1 which was not useful in my case…

To limit the outcomes in the range of 0 and 1 you could still use the numpy.sign() function and write it as follows:

(0.5 * (np.sign(var) + 1))

Cheers

Tags: function, heavyside, python, sing, step

Trackback from your site.

Leave a comment