# [Numpy-discussion] Generating Bell Curves (was: Using normal() )

Hoyt Koepke hoytak@gmail....
Fri Apr 25 18:51:49 CDT 2008

```Another suggestion from machine learning stuff to throw into the mix:

A soft step function that we use often is y = e^(ax) / ( 1 + e^(ax)).
It has the nice property that the result y is always in (0,1).  If you
invert this, you get x = -(1/a)*log(y - 1); this maps (0,1) to the
whole real line, and the a parameter controls how sharp that mapping
is.  Now use that as the input to a Gaussian, and you can get a soft
truncation at (0,1).

Additionally, you can do this twice to have more control over the
shape of the resulting distribution.  I suspect the resulting
kurtosis/skew factors would be calculable.

This has the advantage of giving you a calculable pdf (just normalize
the resulting distribution using the inverse det-of-Jacobian factor)
without too much hassle.  Furthermore, it should be easy to fit the
parameters to data without too much difficulty (though I haven't
tried).

Just a thought, though I've never worked with all this much so I can't
say for sure how well it would work.

--Hoyt

On Fri, Apr 25, 2008 at 4:39 PM, Charles R Harris
<charlesr.harris@gmail.com> wrote:
>
>
>
> On Fri, Apr 25, 2008 at 1:25 PM, Rich Shepard <rshepard@appl-ecosys.com>
> wrote:
> >
> > On Fri, 25 Apr 2008, Charles R Harris wrote:
> >
> > > You can use something like f(x) = (1-x**2)**2 , which has inflection
> > > points and vanishes at +/- 1. Any of the B-splines will also do the
> trick.
> >
> > Chuck,
> >
> >   Thank you. I need to make some time to understand the B-splines to use
> > them appropriately. Unfortunately, my mathematical statistics learning was
> > many years in the past ... but we had moved ahead of writing on clay
> tablets
> > by that time. Not needing to retain that knowledge for many years means it
> > was replaced by more pressing current knowledge. The B-splines do look
> > promising, though.
> >
> >
> >
> >
>
> Here's a B-spline approximation to a Gaussian:
> http://www.doc.ic.ac.uk/~dfg/AndysSplineTutorial/BSplines.html
>
> Chuck
>
>
>
> _______________________________________________
>  Numpy-discussion mailing list
>  Numpy-discussion@scipy.org
>  http://projects.scipy.org/mailman/listinfo/numpy-discussion
>
>

--
+++++++++++++++++++++++++++++++++++
Hoyt Koepke
UBC Department of Computer Science
http://www.cs.ubc.ca/~hoytak/
hoytak@gmail.com
+++++++++++++++++++++++++++++++++++
```