Skip to content

Commit 55979c4

Browse files
authored
Update README.md (#2233)
* Update README.md changes by Stefana Raileanu * Update README.md environment setup template instructions * Update README.md
1 parent 3a64b1a commit 55979c4

File tree

1 file changed

+84
-72
lines changed
  • AI-and-Analytics/Getting-Started-Samples/IntelPython_daal4py_GettingStarted

1 file changed

+84
-72
lines changed
Lines changed: 84 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
# `Intel® Python Daal4py Getting Started` Sample
1+
# Intel® Python Daal4py Getting Started Sample
22

3-
The `Intel® Python Daal4py Getting Started` sample code shows how to do batch linear regression using the Python API package daal4py powered by the Intel® oneAPI Data Analytics Library (oneDAL).
3+
The `Intel® Python Daal4py Getting Started` sample code shows how to do batch linear regression using the Python API package daal4py powered by the [Intel® oneAPI Data Analytics Library (oneDAL)](https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/onedal.html).
44

55
| Area | Description
66
| :--- | :---
7+
| Category | Getting Started
78
| What you will learn | Basic daal4py programming model for Intel CPUs
89
| Time to complete | 5 minutes
9-
| Category | Getting Started
1010

11-
The sample demonstrates how to use software products that are powered by the [Intel® oneAPI Data Analytics Library (oneDAL)](https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/onedal.html) and some components found in the [Intel® AI Tools](https://software.intel.com/content/www/us/en/develop/tools/oneapi/ai-analytics-toolkit.html).
1211

1312
## Purpose
1413

@@ -23,6 +22,7 @@ In this sample, you will run a batch Linear Regression model with oneDAL daal4py
2322
| OS | Ubuntu* 20.04 (or newer)
2423
| Hardware | Intel Atom® processors <br> Intel® Core™ processor family <br> Intel® Xeon® processor family <br> Intel® Xeon® Scalable processor family
2524
| Software | Intel® oneAPI Data Analytics Library (oneDAL)
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).
2626
2727
### For Local Development Environments
2828

@@ -35,89 +35,95 @@ You will need to download and install the following toolkits, tools, and compone
3535

3636
## Key Implementation Details
3737

38-
This get started sample code is implemented for CPUs using the Python language. The example assumes you have daal4py and scikit-learn 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 Analytics Toolkit.
39-
40-
The Intel® oneAPI Data Analytics Library (oneDAL) is ready for use once you finish the Intel® AI Analytics Toolkit installation and have run the post installation script.
41-
42-
## Configure Environment (Only applicable to AI Tools Offline Installer)
43-
If you have already set up the PIP or Conda environment and installed AI Tools go directly to Run the Notebook.
44-
45-
> **Note**: If you have not already done so, set up your CLI
46-
> environment by sourcing the `setvars` script in the root of your oneAPI installation.
47-
>
48-
> Linux*:
49-
> - For system wide installations: `. /opt/intel/oneapi/setvars.sh`
50-
> - For private installations: ` . ~/intel/oneapi/setvars.sh`
51-
> - For non-POSIX shells, like csh, use the following command: `bash -c 'source <install-dir>/setvars.sh ; exec csh'`
52-
>
53-
> For more information on configuring environment variables, see *[Use the setvars Script with Linux* or macOS*](https://www.intel.com/content/www/us/en/develop/documentation/oneapi-programming-guide/top/oneapi-development-environment-setup/use-the-setvars-script-with-linux-or-macos.html)*.
54-
55-
38+
- This get started sample code is implemented for CPUs using the Python language. The example assumes you have daal4py and scikit-learn 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 Analytics Toolkit.
5639

57-
### Steps for Intel AI Tools Offline Installer
40+
- The Intel® oneAPI Data Analytics Library (oneDAL) is ready for use once you finish the Intel® AI Analytics Toolkit installation and have run the post installation script.
5841

59-
1. Activate the conda environment.
42+
## Environment Setup
6043

61-
1. If you have the root access to your oneAPI installation path, choose this option.
62-
63-
Intel Python environment will be active by default. However, if you activated another environment, you can return with the following command.
64-
```
65-
source activate base
66-
```
67-
68-
2. If you do not have the root access to your oneAPI installation path, choose this option.
69-
70-
By default, the Intel® AI Tools are installed in the ``/opt/intel/oneapi`` folder, which requires root privileges to manage it. If you would like to bypass using root access to manage your conda environment, then you can clone your desired conda environment and activate it using the following commands.
44+
You will need to download and install the following toolkits, tools, and components to use the sample.
7145

72-
```
73-
conda create --name usr_intelpython --clone base
74-
source activate usr_intelpython
75-
```
46+
**1. Get Intel® AI Tools**
7647

77-
2. Install Jupyter Notebook. (Skip this step for Intel® DevCloud.)
78-
```
79-
conda install jupyter nb_conda_kernels
80-
```
48+
Required AI Tools: Intel® Optimization for XGBoost*
49+
<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.
8150

82-
## Run the `Intel® Python Daal4py Getting Started` Sample
51+
**2. Install dependencies**
52+
```
53+
pip install -r requirements.txt
54+
```
55+
**Install Jupyter Notebook** by running `pip install notebook`. Alternatively, see [Installing Jupyter](https://jupyter.org/install) for detailed installation instructions.
8356

84-
You can run the sample code in a Jupyter Notebook or as a Python script locally.
57+
## Run the Sample
58+
>**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_daal4py_GettingStarted#environment-setup) is completed.
59+
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:
60+
* [AI Tools Offline Installer (Validated)](#ai-tools-offline-installer-validated)
61+
* [Conda/PIP](#condapip)
62+
* [Docker](#docker)
8563

86-
### Run the Jupyter Notebook
64+
### AI Tools Offline Installer (Validated)
65+
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
66+
```
67+
source $HOME/intel/oneapi/intelpython/bin/activate
68+
```
69+
If you used a separate location, open a terminal and type the following
70+
```
71+
source <custom_path>/bin/activate
72+
```
73+
2. Activate the Conda environment:
74+
<!-- specify the name of conda environment for this sample, if there are several options - list all relevant names of environments -->
75+
```
76+
conda activate xgboost
77+
```
78+
3. Clone the GitHub repository:
79+
```
80+
git clone https://github.com/oneapi-src/oneAPI-samples.git
81+
cd oneapi-samples/AI-and-Analytics/Getting-Started-Samples/IntelPython_daal4py_GettingStarted
82+
```
83+
4. Launch Jupyter Notebook:
84+
> **Note**: You might need to register Conda kernel to Jupyter Notebook kernel,
85+
feel free to check [the instruction](https://github.com/IntelAI/models/tree/master/docs/notebooks/perf_analysis#option-1-conda-environment-creation)
86+
```
87+
jupyter notebook --ip=0.0.0.0
88+
```
89+
<!-- add other flags to jupyter notebook command if needed, such as port 8888 or allow-root -->
90+
5. Follow the instructions to open the URL with the token in your browser.
91+
6. Select the Notebook:
92+
```
93+
IntelPython_daal4py_GettingStarted.ipynb
94+
```
8795

88-
1. Activate the conda environment.
89-
```
90-
source activate base
91-
# or
92-
source activate usr_intelpython
93-
```
96+
7. Change the kernel to xgboost
97+
98+
8. Run every cell in the Notebook in sequence.
9499

95-
2. Start the Jupyter notebook server.
96-
```
97-
jupyter notebook
98-
```
100+
### Conda/PIP
101+
> **Note**: Make sure your Conda/Python environment with AI Tools installed is activated
102+
1. Clone the GitHub repository:
103+
```
104+
git clone https://github.com/oneapi-src/oneAPI-samples.git
105+
cd oneapi-samples/AI-and-Analytics/Getting-Started-Samples/IntelPython_daal4py_GettingStarted
106+
```
99107

100-
3. Locate and select the Notebook.
101-
```
102-
IntelPython_daal4py_GettingStarted.ipynb
103-
```
104-
4. Click the **Run** button to execute all cells in the Notebook in sequence.
108+
2. Launch Jupyter Notebook:
109+
> **Note**: You might need to register Conda kernel to Jupyter Notebook kernel,
110+
feel free to check [the instruction](https://github.com/IntelAI/models/tree/master/docs/notebooks/perf_analysis#option-1-conda-environment-creation)
111+
```
112+
jupyter notebook --ip=0.0.0.0
113+
```
114+
<!-- add other flags to jupyter notebook command if needed, such as port 8888 or allow-root -->
115+
4. Follow the instructions to open the URL with the token in your browser.
116+
5. Select the Notebook:
117+
```
118+
IntelPython_daal4py_GettingStarted.ipynb.ipynb
119+
```
105120

106-
### Run the Python Script Locally
121+
6. Run every cell in the Notebook in sequence.
107122

108-
1. Activate the conda environment.
109-
```
110-
source activate base
111-
# or
112-
source activate usr_intelpython
113-
```
123+
### Docker
124+
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.
114125

115-
2. Run the Python script.
116-
```
117-
python IntelPython_daal4py_GettingStarted.py
118-
```
119126

120-
The script saves the output files in the included ``models`` and ``results`` directories.
121127

122128
## Example Output
123129

@@ -147,10 +153,16 @@ Here is one of our loaded model's features:
147153
1.58423529e-02 -4.57542900e-01]]
148154
[CODE_SAMPLE_COMPLETED_SUCCESFULLY]
149155
```
156+
## Related Samples
157+
158+
* [Intel® Python XGBoost* Getting Started Sample](https://github.com/oneapi-src/oneAPI-samples/tree/master/AI-and-Analytics/Getting-Started-Samples/IntelPython_XGBoost_GettingStarted)
159+
* [Intel® Python Scikit-learn Extension Getting Started Sample](https://github.com/oneapi-src/oneAPI-samples/tree/master/AI-and-Analytics/Getting-Started-Samples/Intel_Extension_For_SKLearn_GettingStarted#intel-python-scikit-learn-extension-getting-started-sample)
150160

151161
## License
152162

153163
Code samples are licensed under the MIT license. See
154164
[License.txt](https://github.com/oneapi-src/oneAPI-samples/blob/master/License.txt) for details.
155165

156166
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).
167+
168+
*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)