Did I find the right examples for you? yes no      Crawl my project      Python Jobs

# cogent.maths.fit_function.fit_function

All Samples(8)  |  Call(6)  |  Derive(0)  |  Import(2)

```from numpy.random import rand
from cogent.util.unit_test import TestCase, main
from cogent.maths.fit_function import fit_function

__author__ = "Antonio Gonzalez Pena"
```
```        y_noise = y + rand(len(x))

params = fit_function(x, y_noise, f, 1, 5)

self.assertFloatEqual(params, exp_params , .5)
```
```        y_noise = y + rand(len(y))

params = fit_function(x, y_noise, f, 2, 5)

self.assertFloatEqual(params, exp_params , .5)
```
```        y_noise = y + rand(len(y))

params = fit_function(x, y_noise, f, 2, 5)

self.assertFloatEqual(params, exp_params , .5)
```

```from numpy.random import rand
from cogent.util.unit_test import TestCase, main
from cogent.maths.fit_function import fit_function

__author__ = "Antonio Gonzalez Pena"
```
```        y_noise = y + rand(len(x))

params = fit_function(x, y_noise, f, 1, 5)

self.assertFloatEqual(params, exp_params , .5)
```
```        y_noise = y + rand(len(y))

params = fit_function(x, y_noise, f, 2, 5)

self.assertFloatEqual(params, exp_params , .5)
```
```        y_noise = y + rand(len(y))

params = fit_function(x, y_noise, f, 2, 5)

self.assertFloatEqual(params, exp_params , .5)
```