xgboost icon indicating copy to clipboard operation
xgboost copied to clipboard

Include Usage Examples in Pip Package

Open dvmorris opened this issue 2 years ago • 2 comments

Would it be possible to include the usage examples in the pip package? This seems to be a common practice in other packages, like xgboost_ray.

For example, I can run this code after installing xgboost_ray:

https://github.com/ray-project/xgboost_ray/tree/master/xgboost_ray/examples

from xgboost_ray.examples import simple
simple.main(1, 4)

~
2023-11-01 14:59:08,801	INFO worker.py:1616 -- Started a local Ray instance. View the dashboard at 127.0.0.1:8265 
2023-11-01 14:59:10,655	INFO main.py:1140 -- [RayXGBoost] Created 4 new actors (4 total actors). Waiting until actors are ready for training.
2023-11-01 14:59:16,641	INFO main.py:1191 -- [RayXGBoost] Starting XGBoost training.
(_RemoteRayXGBoostActor pid=10499) [14:59:16] task [xgboost.ray]:134286839452944 got new rank 0
2023-11-01 14:59:20,728	INFO main.py:1708 -- [RayXGBoost] Finished XGBoost training on training data with total N=426 in 10.38 seconds (4.07 pure XGBoost training time).
Final validation error: 0.0280

dvmorris avatar Nov 01 '23 15:11 dvmorris

I like the idea of having examples close to the library, but we have a mix of examples, some are easy to run while others are more complicated. For instance, the example might require downloading a dataset, passing in a command line argument, etc. If we split the examples into two places, it might cause extra confusion for users to find examples.

trivialfis avatar Nov 02 '23 09:11 trivialfis

I was just suggesting that you include the examples in the pip package in their same format and structure. So they would continue to exist in the same place in github, but they would also get packaged into the pip package. At least the simple examples would be even easier to run.

dvmorris avatar Nov 02 '23 15:11 dvmorris

We will continue to use the documentation side and sphinx gallery to share examples, but it's unlikely that we will make extra specializations in packaging in the near future.

trivialfis avatar Aug 16 '24 11:08 trivialfis