|
12 | 12 | from AnyQt.QtCore import Qt, QEvent, QRectF, QSize |
13 | 13 |
|
14 | 14 | from Orange.data import Table, Domain |
| 15 | +from Orange.statistics.util import nanmin, nanmax, average, unique |
15 | 16 | from Orange.classification import Model |
16 | 17 | from Orange.classification.naive_bayes import NaiveBayesModel |
17 | 18 | from Orange.classification.logistic_regression import \ |
@@ -868,8 +869,8 @@ def calculate_log_reg_coefficients(self): |
868 | 869 | for i in range(len(self.log_reg_coeffs)): |
869 | 870 | if self.log_reg_coeffs[i].shape[1] == 1: |
870 | 871 | coef = self.log_reg_coeffs[i] |
871 | | - min_t = np.nanmin(self.data.X, axis=0)[i] |
872 | | - max_t = np.nanmax(self.data.X, axis=0)[i] |
| 872 | + min_t = nanmin(self.data.X, axis=0)[i] |
| 873 | + max_t = nanmax(self.data.X, axis=0)[i] |
873 | 874 | self.log_reg_coeffs[i] = np.hstack((coef * min_t, coef * max_t)) |
874 | 875 | self.log_reg_cont_data_extremes.append( |
875 | 876 | [sorted([min_t, max_t], reverse=(c < 0)) for c in coef]) |
@@ -1076,10 +1077,10 @@ def _init_feature_marker_values(self): |
1076 | 1077 | value, feature_val = 0, None |
1077 | 1078 | if len(self.log_reg_coeffs): |
1078 | 1079 | if attr.is_discrete: |
1079 | | - ind, n = np.unique(self.data.X[:, i], return_counts=True) |
| 1080 | + ind, n = unique(self.data.X[:, i], return_counts=True) |
1080 | 1081 | feature_val = np.nan_to_num(ind[np.argmax(n)]) |
1081 | 1082 | else: |
1082 | | - feature_val = np.average(self.data.X[:, i]) |
| 1083 | + feature_val = average(self.data.X[:, i]) |
1083 | 1084 | inst_in_dom = instances and attr in instances.domain |
1084 | 1085 | if inst_in_dom and not np.isnan(instances[0][attr]): |
1085 | 1086 | feature_val = instances[0][attr] |
|
0 commit comments