'Calls libsvm.svm_train() to create a model.
Vector classes and features are mapped to integers.'

def _train(self):

    M = [v for (type, v) in self._vectors]
    H1 = dict(((w, (i + 1)) for (i, w) in enumerate(self.features)))
    H2 = dict(((w, (i + 1)) for (i, w) in enumerate(self.classes)))
    H3 = dict((((i + 1), w) for (i, w) in enumerate(self.classes)))
    x = map((lambda v: dict(map((lambda k: (H1[k], v[k])), v))), M)
    y = map((lambda v: H2[v[0]]), self._vectors)
    if (self.extension == LIBLINEAR):
        f = self._svm.liblinearutil.train
        o = ('-s    %s    -c    %s    -p    %s    -q' % (self._solver, self._cost, self._epsilon))
    else:
        f = self._svm.libsvmutil.svm_train
        o = ('-s    %s    -t    %s    -d    %s    -g    %s    -r    %s    -c    %s    -p    %s    -n    %s    -m    %s    -h    %s    -b    %s    -q' % (self._type, self._kernel, self._degree, self._gamma, self._coeff0, self._cost, self._epsilon, self._nu, self._cache, int(self._shrinking), int((self._type != DETECTION))))
    self._model = (f(y, x, o), H1, H2, H3)
