You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
4
4
5
5
| Area | Description
6
6
| :--- | :---
7
+
| Category | Getting Started
7
8
| What you will learn | Basic daal4py programming model for Intel CPUs
8
9
| Time to complete | 5 minutes
9
-
| Category | Getting Started
10
10
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).
12
11
13
12
## Purpose
14
13
@@ -23,6 +22,7 @@ In this sample, you will run a batch Linear Regression model with oneDAL daal4py
23
22
| OS | Ubuntu* 20.04 (or newer)
24
23
| Hardware | Intel Atom® processors <br> Intel® Core™ processor family <br> Intel® Xeon® processor family <br> Intel® Xeon® Scalable processor family
25
24
| 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).
26
26
27
27
### For Local Development Environments
28
28
@@ -35,89 +35,95 @@ You will need to download and install the following toolkits, tools, and compone
35
35
36
36
## Key Implementation Details
37
37
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.
56
39
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.
58
41
59
-
1. Activate the conda environment.
42
+
## Environment Setup
60
43
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.
71
45
72
-
```
73
-
conda create --name usr_intelpython --clone base
74
-
source activate usr_intelpython
75
-
```
46
+
**1. Get Intel® AI Tools**
76
47
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.
81
50
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.
83
56
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:
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
cd oneapi-samples/AI-and-Analytics/Getting-Started-Samples/IntelPython_daal4py_GettingStarted
106
+
```
99
107
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
+
```
105
120
106
-
### Run the Python Script Locally
121
+
6. Run every cell in the Notebook in sequence.
107
122
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.
114
125
115
-
2. Run the Python script.
116
-
```
117
-
python IntelPython_daal4py_GettingStarted.py
118
-
```
119
126
120
-
The script saves the output files in the included ``models`` and ``results`` directories.
121
127
122
128
## Example Output
123
129
@@ -147,10 +153,16 @@ Here is one of our loaded model's features:
147
153
1.58423529e-02 -4.57542900e-01]]
148
154
[CODE_SAMPLE_COMPLETED_SUCCESFULLY]
149
155
```
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)
150
160
151
161
## License
152
162
153
163
Code samples are licensed under the MIT license. See
154
164
[License.txt](https://github.com/oneapi-src/oneAPI-samples/blob/master/License.txt) for details.
155
165
156
166
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