shap/tree_shap.h
inline void extend_path(PathElement *unique_path, unsigned unique_depth,
                        tfloat zero_fraction, tfloat one_fraction, int feature_index) {
  unique_path[unique_depth].feature_index = feature_index;
  unique_path[unique_depth].zero_fraction = zero_fraction;
  unique_path[unique_depth].one_fraction = one_fraction;
  unique_path[unique_depth].pweight = (unique_depth == 0 ? 1.0f : 0.0f);
  for (int i = unique_depth - 1; i >= 0; i--) {
    unique_path[i + 1].pweight += one_fraction * unique_path[i].pweight * (i + 1)
                                  / static_cast<tfloat>(unique_depth + 1);
    unique_path[i].pweight = zero_fraction * unique_path[i].pweight * (unique_depth - i)
                             / static_cast<tfloat>(unique_depth + 1);
  }
}
// extend our decision path with a fraction of one and zero extensions
extend our decision path with a fraction of one and zero extensions
extend our decision path with a fraction of one and zero extensions
inline void extend_path(PathElement *unique_path, unsigned unique_depth,
                        tfloat zero_fraction, tfloat one_fraction, int feature_index) {
  unique_path[unique_depth].feature_index = feature_index;
  unique_path[unique_depth].zero_fraction = zero_fraction;
  unique_path[unique_depth].one_fraction = one_fraction;
  unique_path[unique_depth].pweight = (unique_depth == 0 ? 1.0f : 0.0f);
  for (int i = unique_depth - 1; i >= 0; i--) {
    unique_path[i + 1].pweight += one_fraction * unique_path[i].pweight * (i + 1)
                                  / static_cast<tfloat>(unique_depth + 1);
    unique_path[i].pweight = zero_fraction * unique_path[i].pweight * (unique_depth - i)
                             / static_cast<tfloat>(unique_depth + 1);
  }
}
inline void extend_path ( PathElement * unique_path , unsigned unique_depth , tfloat zero_fraction , tfloat one_fraction , int feature_index ) { unique_path [ unique_depth ] . feature_index = feature_index ; unique_path [ unique_depth ] . zero_fraction = zero_fraction ; unique_path [ unique_depth ] . one_fraction = one_fraction ; unique_path [ unique_depth ] . pweight = ( unique_depth == 0 ? 1.0f : 0.0f ) ; for ( int i = unique_depth - 1 ; i >= 0 ; i -- ) { unique_path [ i + 1 ] . pweight += one_fraction * unique_path [ i ] . pweight * ( i + 1 ) / static_cast < tfloat > ( unique_depth + 1 ) ; unique_path [ i ] . pweight = zero_fraction * unique_path [ i ] . pweight * ( unique_depth - i ) / static_cast < tfloat > ( unique_depth + 1 ) ; } }
extend our decision path with a fraction of one and zero extensions
extend our decision path with a fraction of one and zero extensions