def train(self, input_train, target_train, copy=True): input_train = format_data(input_train, copy=copy) target_train = format_data(target_train, copy=copy) if target_train.shape[1] != 1: raise ValueError("Target value must be one dimentional array") LazyLearning.train(self, input_train, target_train)
def train(self, input_train, target_train): LazyLearning.train(self, input_train, target_train) if target_train.ndim != 1: raise ValueError("Target value must be in 1 dimention") classes = self.classes = unique(target_train) number_of_classes = classes.size row_comb_matrix = self.row_comb_matrix = zeros( (number_of_classes, input_train.shape[0]) ) class_ratios = self.class_ratios = zeros(number_of_classes) for i, class_name in enumerate(classes): class_val_positions = (target_train == i) row_comb_matrix[i, class_val_positions] = 1 class_ratios[i] = np_sum(class_val_positions)
def train(self, input_train, target_train, copy=True): input_train = format_data(input_train, copy=copy) target_train = format_data(target_train, copy=copy) LazyLearning.train(self, input_train, target_train) if target_train.shape[1] != 1: raise ValueError("Target value must be in 1 dimention") classes = self.classes = unique(target_train) number_of_classes = classes.size row_comb_matrix = self.row_comb_matrix = zeros( (number_of_classes, input_train.shape[0])) class_ratios = self.class_ratios = zeros(number_of_classes) for i, class_name in enumerate(classes): class_val_positions = (target_train == i) row_comb_matrix[i, class_val_positions.ravel()] = 1 class_ratios[i] = np_sum(class_val_positions)
def train(self, input_train, target_train, copy=True): input_train = format_data(input_train, copy=copy) target_train = format_data(target_train, copy=copy) LazyLearning.train(self, input_train, target_train) if target_train.shape[1] != 1: raise ValueError("Target value must be in 1 dimension") classes = self.classes = unique(target_train) number_of_classes = classes.size row_comb_matrix = self.row_comb_matrix = zeros( (number_of_classes, input_train.shape[0]) ) class_ratios = self.class_ratios = zeros(number_of_classes) for i, class_name in enumerate(classes): class_val_positions = (target_train == i) row_comb_matrix[i, class_val_positions.ravel()] = 1 class_ratios[i] = np_sum(class_val_positions)
def train(self, input_train, target_train): if target_train.ndim != 1: raise ValueError("Target value must be in 1 dimention") LazyLearning.train(self, input_train, target_train)