(self, X)
return y
Prediction with compiled code, but in Python; for demo only
Prediction with compiled code, but in Python; for demo only
Prediction with compiled code but in Python ; for demo only
def get_values_in_python(self, X):
        """Prediction with compiled code, but in Python; for demo only"""
        n = len(X)
        y = self._prepare_predictions(n)
        for i in range(n):
            x = X[i]
            node_ptr = 0
            while self._code[node_ptr]:
                val = x[self._code[node_ptr + 2]]
                if np.isnan(val):
                    break
                child_ptrs = self._code[node_ptr + 3:]
                if self._code[node_ptr] == 3:
                    node_idx = self._code[node_ptr + 1]
                    next_node_ptr = child_ptrs[int(val > self._thresholds[node_idx])]
                else:
                    next_node_ptr = child_ptrs[int(val)]
                if next_node_ptr == -1:
                    break
                node_ptr = next_node_ptr
            node_idx = self._code[node_ptr + 1]
            y[i] = self._values[node_idx]
        return y
def get_values_in_python ( self , X ) : n = len ( X ) y = self . _prepare_predictions ( n ) for i in range ( n ) : x = X [ i ] node_ptr = 0 while self . _code [ node_ptr ] : val = x [ self . _code [ node_ptr + 2 ] ] if np . isnan ( val ) : break child_ptrs = self . _code [ node_ptr + 3 : ] if self . _code [ node_ptr ] == 3 : node_idx = self . _code [ node_ptr + 1 ] next_node_ptr = child_ptrs [ int ( val > self . _thresholds [ node_idx ] ) ] else : next_node_ptr = child_ptrs [ int ( val ) ] if next_node_ptr == - 1 : break node_ptr = next_node_ptr node_idx = self . _code [ node_ptr + 1 ] y [ i ] = self . _values [ node_idx ] return y