|
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, mean, 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 \ |
@@ -870,8 +871,8 @@ def calculate_log_reg_coefficients(self): |
870 | 871 | for i in range(len(self.log_reg_coeffs)): |
871 | 872 | if self.log_reg_coeffs[i].shape[1] == 1: |
872 | 873 | coef = self.log_reg_coeffs[i] |
873 | | - min_t = np.nanmin(self.data.X, axis=0)[i] |
874 | | - max_t = np.nanmax(self.data.X, axis=0)[i] |
| 874 | + min_t = nanmin(self.data.X, axis=0)[i] |
| 875 | + max_t = nanmax(self.data.X, axis=0)[i] |
875 | 876 | self.log_reg_coeffs[i] = np.hstack((coef * min_t, coef * max_t)) |
876 | 877 | self.log_reg_cont_data_extremes.append( |
877 | 878 | [sorted([min_t, max_t], reverse=(c < 0)) for c in coef]) |
@@ -1080,10 +1081,10 @@ def _init_feature_marker_values(self): |
1080 | 1081 | value, feature_val = 0, None |
1081 | 1082 | if len(self.log_reg_coeffs): |
1082 | 1083 | if attr.is_discrete: |
1083 | | - ind, n = np.unique(self.data.X[:, i], return_counts=True) |
| 1084 | + ind, n = unique(self.data.X[:, i], return_counts=True) |
1084 | 1085 | feature_val = np.nan_to_num(ind[np.argmax(n)]) |
1085 | 1086 | else: |
1086 | | - feature_val = np.average(self.data.X[:, i]) |
| 1087 | + feature_val = mean(self.data.X[:, i]) |
1087 | 1088 | inst_in_dom = instances and attr in instances.domain |
1088 | 1089 | if inst_in_dom and not np.isnan(instances[0][attr]): |
1089 | 1090 | feature_val = instances[0][attr] |
|
0 commit comments