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

# Bio.LogisticRegression.train

All Samples(10)  |  Call(10)  |  Derive(0)  |  Import(0)

```    def test_calculate_model(self):
model = LogisticRegression.train(xs, ys)
beta = model.beta
self.assertAlmostEqual(beta[0],  8.9830, places=4)
self.assertAlmostEqual(beta[1], -0.0360, places=4)
self.assertAlmostEqual(beta[2],  0.0218, places=4)

def test_classify(self):
model = LogisticRegression.train(xs, ys)
```
```    def test_calculate_probability(self):
model = LogisticRegression.train(xs, ys)
q, p = LogisticRegression.calculate(model, [6, -173.143442352])
self.assertAlmostEqual(p, 0.993242, places=6)
self.assertAlmostEqual(q, 0.006758, places=6)
```
```    def test_model_accuracy(self):
correct = 0
model = LogisticRegression.train(xs, ys)
predictions = [1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0]
for i in range(len(predictions)):
```
```    def test_leave_one_out(self):
correct = 0
predictions = [1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0]
for i in range(len(predictions)):
model = LogisticRegression.train(xs[:i]+xs[i+1:], ys[:i]+ys[i+1:])
```

```    def test_calculate_model(self):
model = LogisticRegression.train(xs, ys)
beta = model.beta
self.assertAlmostEqual(beta[0],  8.9830, places=4)
self.assertAlmostEqual(beta[1], -0.0360, places=4)
self.assertAlmostEqual(beta[2],  0.0218, places=4)

def test_classify(self):
model = LogisticRegression.train(xs, ys)
```
```    def test_calculate_probability(self):
model = LogisticRegression.train(xs, ys)
q, p = LogisticRegression.calculate(model, [6, -173.143442352])
self.assertAlmostEqual(p, 0.993242, places=6)
self.assertAlmostEqual(q, 0.006758, places=6)
```
```    def test_model_accuracy(self):
correct = 0
model = LogisticRegression.train(xs, ys)
predictions = [1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0]
for i in range(len(predictions)):
```
```    def test_leave_one_out(self):
correct = 0
predictions = [1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0]
for i in range(len(predictions)):
model = LogisticRegression.train(xs[:i]+xs[i+1:], ys[:i]+ys[i+1:])
```