Skip to content
Snippets Groups Projects
Commit 337b1039 authored by Tim O'Donnell's avatar Tim O'Donnell
Browse files

More test output

parent 14cf5749
No related branches found
No related tags found
No related merge requests found
...@@ -24,7 +24,7 @@ class PercentRankTransform(object): ...@@ -24,7 +24,7 @@ class PercentRankTransform(object):
self.cdf[0] = 0.0 self.cdf[0] = 0.0
self.cdf[1] = 0.0 self.cdf[1] = 0.0
self.cdf[-1] = 100.0 self.cdf[-1] = 100.0
numpy.cumsum(hist / numpy.sum(hist) * 100.0, out=self.cdf[2:-1]) numpy.cumsum(hist * 100.0 / numpy.sum(hist), out=self.cdf[2:-1])
assert not numpy.isnan(self.cdf).any() assert not numpy.isnan(self.cdf).any()
def transform(self, values): def transform(self, values):
......
from nose.tools import eq_, assert_less from nose.tools import eq_, assert_less
import numpy import numpy
from numpy.testing import assert_almost_equal from numpy.testing import assert_allclose
import pandas import pandas
from mhcflurry import amino_acid from mhcflurry import amino_acid
from mhcflurry.antigen_presentation import ( from mhcflurry.antigen_presentation import (
...@@ -76,9 +76,10 @@ del HITS_DF["hit"] ...@@ -76,9 +76,10 @@ del HITS_DF["hit"]
def test_percent_rank_transform(): def test_percent_rank_transform():
model = percent_rank_transform.PercentRankTransform() model = percent_rank_transform.PercentRankTransform()
model.fit(numpy.arange(1000)) model.fit(numpy.arange(1000))
assert_almost_equal( assert_allclose(
model.transform([-2, 0, 50, 100, 2000]), model.transform([-2, 0, 50, 100, 2000]),
[0.0, 0.0, 5.0, 10.0, 100.0]) [0.0, 0.0, 5.0, 10.0, 100.0],
err_msg=str(model.__dict__))
def test_mhcflurry_trained_on_hits(): def test_mhcflurry_trained_on_hits():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment