//  [python]
def _fit_one_class(self, clx, cl):
        """ Train clas number cl with data clx.

        Use trainFromImageAndSeeds() function if you want to use 3D image data
        as an input.

        clx: data, 2d matrix
        cl: label, integer

        label: gmmsame, gaussian_kde, dpgmm, stored
        """

        logger.debug("clx " + str(clx[:10, :]))
        logger.debug("clx type" + str(clx.dtype))
        # name = 'clx' + str(cl) + '.npy'
        # print name
        # np.save(name, clx)
        logger.debug("_fit()")
        if self.modelparams["adaptation"] == "original_data":
            if cl in self.mdl.keys():
                return
        # if True:
        #     return

        logger.debug("training continues")

        if self.modelparams["type"] == "gmmsame":
            if len(clx.shape) == 1:
                logger.warning(
                    "reshaping in train will be removed. Use \
                                \ntrainFromImageAndSeeds() function"
                )

                print("Warning deprecated feature in train() function")
                #  je to jen jednorozměrný vektor, tak je potřeba to
                # převést na 2d matici
                clx = clx.reshape(-1, 1)
            gmmparams = self.modelparams["params"]
            self.mdl[cl] = s.mixture.GMM(**gmmparams)
            self.mdl[cl].fit(clx)

        elif self.modelparams["type"] == "kernel":
            # Not working (probably) in old versions of scikits
            # from sklearn.neighbors.kde import KernelDensity
            from sklearn.neighbors import KernelDensity

            # kernelmodelparams = {'kernel': 'gaussian', 'bandwidth': 0.2}
            kernelmodelparams = self.modelparams["params"]
            self.mdl[cl] = KernelDensity(**kernelmodelparams).fit(clx)
        elif self.modelparams["type"] == "gaussian_kde":
            # print clx
            import scipy.stats

            # from PyQt4.QtCore import pyqtRemoveInputHook
            # pyqtRemoveInputHook()

            # gaussian_kde works only with floating point types
            self.mdl[cl] = scipy.stats.gaussian_kde(clx.astype(np.float))
        elif self.modelparams["type"] == "dpgmm":
            # print 'clx.shape ', clx.shape
            # print 'cl ', cl
            gmmparams = self.modelparams["params"]
            self.mdl[cl] = s.mixture.DPGMM(**gmmparams)
            # todo here is a hack
            # dpgmm z nějakého důvodu nefunguje pro naše data
            # vždy natrénuje jednu složku v blízkosti nuly
            # patrně to bude mít něco společného s parametrem alpha
            # přenásobí-li se to malým číslem, zázračně to chodí
            self.mdl[cl].fit(clx * 0.001)
        elif self.modelparams["type"] == "stored":
            # Classifer is trained before segmentation and stored to pickle
            import pickle

            print("stored")
            logger.warning("deprecated use of stored parameters")

            mdl_file = self.modelparams["params"]["mdl_file"]
            self.mdl = pickle.load(open(mdl_file, "rb"))

        elif type(self.modelparams['type'] == 'custom'):
            self.mdl[cl].fit(clx)
        else:
            raise NameError("Unknown model type")