Skip to content

MAINT Replace unsigned char with uint8_t in codebase #29588

Closed
@adam2392

Description

@adam2392

In #25572, we defined typedefs for commonly used Cython types throughout the codebase. Running grep -rl "unsigned char" ./sklearn, I found the following files contain unsigned char, which could be replaced with uint8_t from https://github.com/scikit-learn/scikit-learn/blob/main/sklearn/utils/_typedefs.pxd.

  • ./sklearn/metrics/_pairwise_distances_reduction/_radius_neighbors_classmode.pyx.tp
  • ./sklearn/ensemble/_hist_gradient_boosting/common.pxd
  • ./sklearn/ensemble/_hist_gradient_boosting/_bitset.pyx
  • ./sklearn/ensemble/_hist_gradient_boosting/_predictor.pyx
  • ./sklearn/ensemble/_hist_gradient_boosting/splitting.pyx
  • ./sklearn/ensemble/_hist_gradient_boosting/histogram.pyx
  • ./sklearn/ensemble/_hist_gradient_boosting/_binning.pyx
  • ./sklearn/ensemble/_hist_gradient_boosting/_bitset.pxd
  • ./sklearn/linear_model/_sgd_fast.pyx.tp

Is there any reason to leave these as unsigned char vs replacing them with the uint8_t to consolidate our types?

To address this issue, it would be best to open up a PR one-by-one and implement the said change and cimport statement, and then link to the issue here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions