2929// cython will convert this struct into an numpy structured array
3030// This is the layout that sklearn expects for its tree traversal mechanics
3131struct skl_tree_node {
32- ssize_t left_child;
33- ssize_t right_child;
34- ssize_t feature;
32+ Py_ssize_t left_child;
33+ Py_ssize_t right_child;
34+ Py_ssize_t feature;
3535 double threshold;
3636 double impurity;
37- ssize_t n_node_samples;
37+ Py_ssize_t n_node_samples;
3838 double weighted_n_node_samples;
3939
4040 skl_tree_node ()
@@ -128,7 +128,7 @@ class toSKLearnTreeObjectVisitor : public TNVT<M>::visitor_type, public TreeStat
128128
129129 size_t node_id;
130130 size_t max_n_classes;
131- std::vector<ssize_t > parents;
131+ std::vector<Py_ssize_t > parents;
132132};
133133
134134// This is the function for getting the tree state from a forest which we use in cython
@@ -199,7 +199,7 @@ bool NodeDepthCountNodeVisitor<M>::onSplitNode(const typename TNVT<M>::split_des
199199template <typename M>
200200toSKLearnTreeObjectVisitor<M>::toSKLearnTreeObjectVisitor(size_t _depth, size_t _n_nodes, size_t _n_leafs, size_t _max_n_classes)
201201 : node_id(0 ),
202- parents (arange<ssize_t >(-1 , _depth-1 ))
202+ parents (arange<Py_ssize_t >(-1 , _depth-1 ))
203203{
204204 max_n_classes = _max_n_classes;
205205 node_count = _n_nodes;
@@ -216,7 +216,7 @@ bool toSKLearnTreeObjectVisitor<M>::onSplitNode(const typename TNVT<M>::split_de
216216{
217217 if (desc.level > 0 ) {
218218 // has parents
219- ssize_t parent = parents[desc.level - 1 ];
219+ Py_ssize_t parent = parents[desc.level - 1 ];
220220 if (node_ar[parent].left_child > 0 ) {
221221 assert (node_ar[node_id].right_child < 0 );
222222 node_ar[parent].right_child = node_id;
@@ -254,7 +254,7 @@ template<typename M>
254254bool toSKLearnTreeObjectVisitor<M>::_onLeafNode(const daal::algorithms::tree_utils::NodeDescriptor &desc)
255255{
256256 if (desc.level ) {
257- ssize_t parent = parents[desc.level - 1 ];
257+ Py_ssize_t parent = parents[desc.level - 1 ];
258258 if (node_ar[parent].left_child > 0 ) {
259259 assert (node_ar[node_id].right_child < 0 );
260260 node_ar[parent].right_child = node_id;
0 commit comments