From eaecb60962f134a788deb0abaf5ade849b8c4277 Mon Sep 17 00:00:00 2001 From: Pavan Mandava Date: Sun, 17 May 2020 20:45:03 +0200 Subject: [PATCH] Training print added --- classifier/linear_model.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/classifier/linear_model.py b/classifier/linear_model.py index ae3ed22..4275a35 100644 --- a/classifier/linear_model.py +++ b/classifier/linear_model.py @@ -126,9 +126,15 @@ class MultiClassPerceptron: for label in labels: self.perceptron_dict[label] = Perceptron(label, get_sample_weights_with_features(-0.5), -0.5) + next_print = int(self.epochs/10) + # Training Iterations for epoch in range(self.epochs): + if epoch >= next_print: + print('Training Multi-Class Perceptron Classifier..... (', epoch, '/', self.epochs, ')') + next_print = next_print + int(self.epochs/10) + # get a random number within the size of training set rand_num = random.randint(0, train_len-1) # pick a random data instance with the generated random number @@ -169,6 +175,8 @@ class MultiClassPerceptron: if X_test is None or len(X_test) <= 0: raise Exception('Testing Data cannot be empty') + print('Predicting..... ') + y_test = [] labels = list(self.perceptron_dict.keys()) for test_inst in X_test: