Recipies

A few code snipplets to load and prepare data, and to run ML algorithms

House Keeping

Python is an object oriented language and, therefore, almost all functions are part of class. This makes it tedious in particular for mathematical expressions. We're going to import those functions from the math package at the beginning of our program.


In [1]:
?pow()

In [ ]:


In [10]:
from numpy import sqrt, fabs, log, log1p, log10

In [16]:
log1p(0.000000001), log(0.000000001)


Out[16]:
(9.9999999949999999e-10, -20.72326583694641)

In [ ]:


In [8]:
from numpy import sqrt

In [9]:
sqrt([32, 15, 9])


Out[9]:
array([ 5.65685425,  3.87298335,  3.        ])

In [ ]: