'Returns the type with the highest probability for the given document.
If the classifier has been trained on LSA concept vectors
you need to supply LSA.transform(document).'

def classify(self, document, discrete=True):

    if (not self._trained):
        n = (float(len(self.classes)) - 1)
        H1 = list(sorted(self.features))
        H2 = dict(((x, (i / n)) for (i, x) in enumerate(self.classes)))
        H3 = dict((((i / n), x) for (i, x) in enumerate(self.classes)))
        v = [([v.get(f, 0.0) for f in H1], [H2[type]]) for (type, v) in self._vectors]
        self._h = (H1, H2, H3)
        self._weight_initialization(i=len(H1), o=1, hidden=self._layers, a=0.0, b=1.0)
        self._train(v, self._iterations, self._rate, self._momentum)
        self._trained = True
    (H1, H2, H3) = self._h
    v = self._vector(document)[1]
    i = [v.get(f, 0.0) for f in H1]
    o = self._classify(i)[0]
    c = min(H3.keys(), key=(lambda k: abs((k - o))))
    c = H3[c]
    return c
