From c2fafbe4402efd4e908939e71d405e11f2c01cb2 Mon Sep 17 00:00:00 2001 From: Yue Zhao Date: Thu, 18 Jul 2019 10:41:07 +0800 Subject: [PATCH] code optimization --- combo/models/classifier_comb.py | 3 +-- combo/test/test_classifier_comb.py | 2 -- combo/test/test_score_comb.py | 3 --- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/combo/models/classifier_comb.py b/combo/models/classifier_comb.py index c3a2f82..c056db4 100644 --- a/combo/models/classifier_comb.py +++ b/combo/models/classifier_comb.py @@ -328,8 +328,7 @@ def predict(self, X): all_scores = np.zeros([X.shape[0], self.len_classifiers_]) - for i in range(self.len_classifiers_): - clf = self.classifiers[i] + for i, clf in enumerate(self.classifiers): if clf.fitted_ != True and self.pre_fitted == False: ValueError('Classifier should be fitted first!') else: diff --git a/combo/test/test_classifier_comb.py b/combo/test/test_classifier_comb.py index aeb2ae4..4bb6bfb 100644 --- a/combo/test/test_classifier_comb.py +++ b/combo/test/test_classifier_comb.py @@ -1,6 +1,4 @@ # -*- coding: utf-8 -*- -from __future__ import division -from __future__ import print_function import os import sys diff --git a/combo/test/test_score_comb.py b/combo/test/test_score_comb.py index b6e9086..5ff7a2c 100644 --- a/combo/test/test_score_comb.py +++ b/combo/test/test_score_comb.py @@ -1,8 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import division -from __future__ import print_function - import os import sys