Skip to content

Commit 7c31a0e

Browse files
authored
Update README.md
1 parent cb7894e commit 7c31a0e

File tree

1 file changed

+81
-49
lines changed
  • AI-and-Analytics/Getting-Started-Samples/IntelPython_XGBoost_GettingStarted

1 file changed

+81
-49
lines changed
Lines changed: 81 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Intel® Python XGBoost* Getting Started Sample
1+
# Intel® Optimization for XGBoost* Getting Started Sample
22

3-
The `Intel® Python XGBoost* Getting Started` sample demonstrates how to set up and train an XGBoost model on datasets for prediction.
3+
The `Intel® Optimization for XGBoost* Getting Started` sample demonstrates how to set up and train an XGBoost model on datasets for prediction.
44

55
| Area | Description
66
| :--- | :---
@@ -12,7 +12,7 @@ The `Intel® Python XGBoost* Getting Started` sample demonstrates how to set up
1212

1313
XGBoost* is a widely used gradient boosting library in the classical ML area. Designed for flexibility, performance, and portability, XGBoost* includes optimized distributed gradient boosting frameworks and implements Machine Learning algorithms underneath. Starting with 0.9 version of XGBoost, Intel has been up streaming optimizations through the `hist` histogram tree-building method. Starting with 1.3.3 version of XGBoost and beyond, Intel has also begun up streaming inference optimizations to XGBoost as well.
1414

15-
In this code sample, you will learn how to use Intel optimizations for XGBoost published as part of Intel® AI Tools. The sample also illustrates how to set up and train an XGBoost* model on datasets for prediction. It also demonstrates how to use software products that can be found in the [Intel® AI Tools](https://software.intel.com/content/www/us/en/develop/tools/oneapi/ai-analytics-toolkit.html).
15+
In this code sample, you will learn how to use Intel optimizations for XGBoost published as part of AI Tools. The sample also illustrates how to set up and train an XGBoost* model on datasets for prediction. It also demonstrates how to use software products that can be found in the [AI Tools](https://software.intel.com/content/www/us/en/develop/tools/oneapi/ai-analytics-toolkit.html).
1616

1717
## Prerequisites
1818

@@ -22,96 +22,126 @@ In this code sample, you will learn how to use Intel optimizations for XGBoost p
2222
| Hardware | Intel Atom® Processors <br> Intel® Core™ Processor Family <br> Intel® Xeon® Processor Family <br> Intel® Xeon® Scalable processor family
2323
| Software | XGBoost*
2424

25+
> **Note**: AI and Analytics samples are validated on AI Tools Offline Installer. For the full list of validated platforms refer to [Platform Validation](https://github.com/oneapi-src/oneAPI-samples/tree/master?tab=readme-ov-file#platform-validation).
26+
2527
## Key Implementation Details
2628

27-
- This Getting Started sample code is implemented for CPU using the Python language. The example assumes you have XGboost installed inside a conda environment, similar to what is delivered with the installation of the Intel® Distribution for Python* as part of the [Intel® AI Tools](https://software.intel.com/en-us/oneapi/ai-kit).
29+
- This Getting Started sample code is implemented for CPU using the Python language. The example assumes you have XGboost installed inside a conda environment, similar to what is delivered with the installation of the Intel® Distribution for Python*.
2830

29-
- XGBoost* is ready for use once you finish the Intel® AI Tools installation and have run the post installation script.
31+
- XGBoost* is ready for use once you finish the AI Tools installation and have run the post installation script.
3032

3133
## Environment Setup
3234

3335
You will need to download and install the following toolkits, tools, and components to use the sample.
3436

35-
**1. Get Intel® AI Tools**
37+
**1. Get AI Tools**
3638

3739
Required AI Tools: Intel® Optimization for XGBoost*
3840
<br>If you have not already, select and install these Tools via [AI Tools Selector](https://www.intel.com/content/www/us/en/developer/tools/oneapi/ai-tools-selector.html). AI and Analytics samples are validated on AI Tools Offline Installer. It is recommended to select Offline Installer option in AI Tools Selector.
41+
>**Note**: If Docker option is chosen in AI Tools Selector, refer to [Working with Preset Containers](https://github.com/intel/ai-containers/tree/main/preset) to learn how to run the docker and samples.
3942
40-
**2. Install dependencies**
43+
**2. (Offline Installer) Activate the AI Tools bundle base environment**
44+
<!-- this step is from AI Tools GSG, please don't modify unless GSG is updated -->
45+
If the default path is used during the installation of AI Tools:
4146
```
42-
pip install -r requirements.txt
47+
source $HOME/intel/oneapi/intelpython/bin/activate
48+
```
49+
If a non-default path is used:
50+
```
51+
source <custom_path>/bin/activate
52+
```
53+
54+
**3. (Offline Installer) Activate relevant Conda environment**
55+
```
56+
conda activate base
57+
```
58+
59+
**4. Clone the GitHub repository**
60+
```
61+
git clone https://github.com/oneapi-src/oneAPI-samples.git
62+
cd oneAPI-samples/AI-and-Analytics/Getting-Started-Samples/IntelPython_XGBoost_GettingStarted
63+
```
64+
65+
**5. Install dependencies**
66+
>**Note**: Before running the following commands, make sure your Conda/Python environment with AI Tools installed is activated
67+
4368
```
44-
**Install Jupyter Notebook** by running `pip install notebook`. Alternatively, see [Installing Jupyter](https://jupyter.org/install) for detailed installation instructions.
69+
pip install -r requirements.txt
70+
pip install notebook
71+
```
72+
For Jupyter Notebook, refer to [Installing Jupyter](https://jupyter.org/install) for detailed installation instructions.
4573

4674
## Run the Sample
4775
>**Note**: Before running the sample, make sure [Environment Setup](https://github.com/oneapi-src/oneAPI-samples/tree/master/AI-and-Analytics/Getting-Started-Samples/IntelPython_XGBoost_GettingStarted#environment-setup) is completed.
76+
4877
Go to the section which corresponds to the installation method chosen in [AI Tools Selector](https://www.intel.com/content/www/us/en/developer/tools/oneapi/ai-tools-selector.html) to see relevant instructions:
4978
* [AI Tools Offline Installer (Validated)](#ai-tools-offline-installer-validated)
5079
* [Conda/PIP](#condapip)
5180
* [Docker](#docker)
5281

5382
### AI Tools Offline Installer (Validated)
54-
1. If you have not already done so, activate the AI Tools bundle base environment. If you used the default location to install AI Tools, open a terminal and type the following
55-
```
56-
source $HOME/intel/oneapi/intelpython/bin/activate
57-
```
58-
If you used a separate location, open a terminal and type the following
83+
84+
**1. Register Conda kernel to Jupyter Notebook kernel**
85+
86+
If the default path is used during the installation of AI Tools:
5987
```
60-
source <custom_path>/bin/activate
88+
$HOME/intel/oneapi/intelpython/envs/base/bin/python -m ipykernel install --user --name=base
6189
```
62-
2. Activate the Conda environment:
90+
If a non-default path is used:
6391
```
64-
conda activate xgboost
65-
```
66-
3. Clone the GitHub repository:
67-
```
68-
git clone https://github.com/oneapi-src/oneAPI-samples.git
69-
cd oneAPI-samples/AI-and-Analytics/Getting-Started-Samples/IntelPython_XGBoost_GettingStarted
92+
<custom_path>/bin/python -m ipykernel install --user --name=base
7093
```
71-
72-
4. Launch Jupyter Notebook:
73-
> **Note**: You might need to register Conda kernel to Jupyter Notebook kernel,
74-
feel free to check [the instruction](https://github.com/IntelAI/models/tree/master/docs/notebooks/perf_analysis#option-1-conda-environment-creation)
94+
**2. Launch Jupyter Notebook**
95+
<!-- add other flags to jupyter notebook command if needed, such as port 8888 or allow-root -->
7596
```
7697
jupyter notebook --ip=0.0.0.0
7798
```
78-
<!-- add other flags to jupyter notebook command if needed, such as port 8888 or allow-root -->
79-
5. Follow the instructions to open the URL with the token in your browser.
80-
6. Select the Notebook:
99+
**3. Follow the instructions to open the URL with the token in your browser**
100+
101+
**4. Select the Notebook**
102+
<!-- add sample file name -->
81103
```
82104
IntelPython_XGBoost_GettingStarted.ipynb
83105
```
84-
85-
7. Change the kernel to xgboost
86-
87-
8. Run every cell in the Notebook in sequence.
106+
**5. Change the kernel to `base`**
107+
<!-- specify relevant kernel name(s), for example `pytorch` -->
108+
**6. Run every cell in the Notebook in sequence**
88109

89110
### Conda/PIP
90-
> **Note**: Make sure your Conda/Python environment with AI Tools installed is activated
91-
1. Clone the GitHub repository:
92-
```
93-
git clone https://github.com/oneapi-src/oneAPI-samples.git
94-
cd oneapi-samples/AI-and-Analytics/Getting-Started-Samples/IntelPython_XGBoost_GettingStarted
111+
> **Note**: Before running the instructions below, make sure your Conda/Python environment with AI Tools installed is activated
112+
113+
**1. Register Conda/Python kernel to Jupyter Notebook kernel**
114+
<!-- keep placeholders in this step, user could use any name for Conda/PIP env -->
115+
For Conda:
116+
```
117+
<CONDA_PATH_TO_ENV>/bin/python -m ipykernel install --user --name=<your-env-name>
118+
```
119+
To know <CONDA_PATH_TO_ENV>, run `conda env list` and find your Conda environment path.
120+
121+
For PIP:
122+
```
123+
python -m ipykernel install --user --name=<your-env-name>
95124
```
96-
2. Launch Jupyter Notebook:
97-
> **Note**: You might need to register Conda kernel to Jupyter Notebook kernel,
98-
feel free to check [the instruction](https://github.com/IntelAI/models/tree/master/docs/notebooks/perf_analysis#option-1-conda-environment-creation)
125+
**2. Launch Jupyter Notebook**
126+
<!-- add other flags to jupyter notebook command if needed, such as port 8888 or allow-root -->
99127
```
100128
jupyter notebook --ip=0.0.0.0
101129
```
102-
<!-- add other flags to jupyter notebook command if needed, such as port 8888 or allow-root -->
103-
4. Follow the instructions to open the URL with the token in your browser.
104-
5. Select the Notebook:
130+
**3. Follow the instructions to open the URL with the token in your browser**
131+
132+
**4. Select the Notebook**
133+
<!-- add sample file name -->
105134
```
106135
IntelPython_XGBoost_GettingStarted.ipynb
107136
```
108-
6. Run every cell in the Notebook in sequence.
137+
**5. Change the kernel to `<your-env-name>`**
138+
<!-- leave <your-env-name> as a placeholder as user could choose any name for the env -->
139+
140+
**6. Run every cell in the Notebook in sequence**
109141

110142
### Docker
111143
AI Tools Docker images already have Get Started samples pre-installed. Refer to [Working with Preset Containers](https://github.com/intel/ai-containers/tree/main/preset) to learn how to run the docker and samples.
112144

113-
114-
115145
## Example Output
116146

117147
>**Note**: Your numbers might be different.
@@ -129,8 +159,10 @@ RMSE: 11.113036205909719
129159
## License
130160

131161
Code samples are licensed under the MIT license. See
132-
[License.txt](https://github.com/oneapi-src/oneAPI-samples/blob/master/License.txt) for details.
162+
[License.txt](https://github.com/oneapi-src/oneAPI-samples/blob/master/License.txt)
163+
for details.
133164

134-
Third party program Licenses can be found here: [third-party-programs.txt](https://github.com/oneapi-src/oneAPI-samples/blob/master/third-party-programs.txt).
165+
Third party program Licenses can be found here:
166+
[third-party-programs.txt](https://github.com/oneapi-src/oneAPI-samples/blob/master/third-party-programs.txt)
135167

136168
*Other names and brands may be claimed as the property of others. [Trademarks](https://www.intel.com/content/www/us/en/legal/trademarks.html)

0 commit comments

Comments
 (0)