Dispatch for QuantileDMatrix.
(
proxy: "_ProxyDMatrix",
data: DataType,
)
| 1711 | |
| 1712 | |
| 1713 | def dispatch_proxy_set_data( |
| 1714 | proxy: "_ProxyDMatrix", |
| 1715 | data: DataType, |
| 1716 | ) -> None: |
| 1717 | """Dispatch for QuantileDMatrix.""" |
| 1718 | if ( |
| 1719 | not _is_cudf_ser(data) |
| 1720 | and not _is_pandas_series(data) |
| 1721 | and not _is_polars_series(data) |
| 1722 | ): |
| 1723 | _check_data_shape(data) |
| 1724 | |
| 1725 | if isinstance(data, CudfTransformed): |
| 1726 | # pylint: disable=W0212 |
| 1727 | proxy._ref_data_from_cuda_columnar(data) |
| 1728 | return |
| 1729 | if _is_cupy_alike(data): |
| 1730 | proxy._ref_data_from_cuda_interface(data) # pylint: disable=W0212 |
| 1731 | return |
| 1732 | if _is_dlpack(data): |
| 1733 | data = _transform_dlpack(data) |
| 1734 | proxy._ref_data_from_cuda_interface(data) # pylint: disable=W0212 |
| 1735 | return |
| 1736 | # Host |
| 1737 | if isinstance(data, (ArrowTransformed, PandasTransformed)): |
| 1738 | proxy._ref_data_from_columnar(data) # pylint: disable=W0212 |
| 1739 | return |
| 1740 | if _is_np_array_like(data): |
| 1741 | _check_data_shape(data) |
| 1742 | proxy._ref_data_from_array(data) # pylint: disable=W0212 |
| 1743 | return |
| 1744 | if is_scipy_csr(data): |
| 1745 | proxy._ref_data_from_csr(data) # pylint: disable=W0212 |
| 1746 | return |
| 1747 | |
| 1748 | err = TypeError("Value type is not supported for data iterator:" + str(type(data))) |
| 1749 | raise err |
no test coverage detected