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

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

src/b/i/biopython-1.63/Tests/test_kNN.py   biopython(Download)
    def test_calculate_probability(self):
        k = 3
        model = kNN.train(xs, ys, k)
        weights = kNN.calculate(model, [6, -173.143442352])
        self.assertAlmostEqual(weights[0], 0.0, places=6)
        self.assertAlmostEqual(weights[1], 3.0, places=6)
        weights = kNN.calculate(model, [309, -271.005880394])
        self.assertAlmostEqual(weights[0], 3.0, places=6)
        self.assertAlmostEqual(weights[1], 0.0, places=6)
        weights = kNN.calculate(model, [117, -267.13999999999999])

src/b/i/biopython-HEAD/Tests/test_kNN.py   biopython(Download)
    def test_calculate_probability(self):
        k = 3
        model = kNN.train(xs, ys, k)
        weights = kNN.calculate(model, [6, -173.143442352])
        self.assertAlmostEqual(weights[0], 0.0, places=6)
        self.assertAlmostEqual(weights[1], 3.0, places=6)
        weights = kNN.calculate(model, [309, -271.005880394])
        self.assertAlmostEqual(weights[0], 3.0, places=6)
        self.assertAlmostEqual(weights[1], 0.0, places=6)
        weights = kNN.calculate(model, [117, -267.13999999999999])