(self, label_index, basemodel)
return models
Train the models for each class.
Train the models for each class.
Train the models for each class .
def train_models(self, label_index, basemodel):
        """
        Train the models for each class.
        """
        if basemodel is None:
            basemodel = SVC(decision_function_shape='ovr')
        label_index = self._check_multi_label_ind(label_index)
        train_target = label_index.get_matrix_mask((self.n_samples, self.n_classes), sparse=False)
        models =[]
        for j in np.arange(self.n_classes):  
            j_target = train_target[:, j]
            i_samples = np.where(j_target!=0)[0]
            m = copy.deepcopy(basemodel)
            m.fit(self.X[i_samples, :], self.y[i_samples, j])
            models.append(m)   
        return models
def train_models ( self , label_index , basemodel ) : if basemodel is None : basemodel = SVC ( decision_function_shape = 'ovr' ) label_index = self . _check_multi_label_ind ( label_index ) train_target = label_index . get_matrix_mask ( ( self . n_samples , self . n_classes ) , sparse = False ) models = [ ] for j in np . arange ( self . n_classes ) : j_target = train_target [ : , j ] i_samples = np . where ( j_target != 0 ) [ 0 ] m = copy . deepcopy ( basemodel ) m . fit ( self . X [ i_samples , : ] , self . y [ i_samples , j ] ) models . append ( m ) return models