@@ -58,7 +58,7 @@ def predict_values(
58
58
x : sparse .csr_matrix ,
59
59
beam_width : int = 10 ,
60
60
) -> np .ndarray :
61
- """Calculates the decision values associated with x.
61
+ """Calculates the probability estimates associated with x.
62
62
63
63
Args:
64
64
x (sparse.csr_matrix): A matrix with dimension number of instances * number of features.
@@ -72,10 +72,10 @@ def predict_values(
72
72
return np .vstack ([self ._beam_search (all_preds [i ], beam_width ) for i in range (all_preds .shape [0 ])])
73
73
74
74
def _beam_search (self , instance_preds : np .ndarray , beam_width : int ) -> np .ndarray :
75
- """Predict with beam search using cached decision values for a single instance.
75
+ """Predict with beam search using cached probability estimates for a single instance.
76
76
77
77
Args:
78
- instance_preds (np.ndarray): A vector of cached decision values of each node, has dimension number of labels + total number of metalabels.
78
+ instance_preds (np.ndarray): A vector of cached probability estimates of each node, has dimension number of labels + total number of metalabels.
79
79
beam_width (int): Number of candidates considered.
80
80
81
81
Returns:
@@ -101,7 +101,7 @@ def _beam_search(self, instance_preds: np.ndarray, beam_width: int) -> np.ndarra
101
101
next_level = []
102
102
103
103
num_labels = len (self .root .label_map )
104
- scores = np .full (num_labels , - np . inf )
104
+ scores = np .full (num_labels , 0 )
105
105
for node , score in cur_level :
106
106
slice = np .s_ [self .weight_map [node .index ] : self .weight_map [node .index + 1 ]]
107
107
pred = instance_preds [slice ]
0 commit comments