Skip to content

Commit bf201df

Browse files
authored
Update readme.md
1 parent 55979c4 commit bf201df

File tree

1 file changed

+47
-66
lines changed
  • AI-and-Analytics/Getting-Started-Samples/Intel_Extension_For_SKLearn_GettingStarted

1 file changed

+47
-66
lines changed

AI-and-Analytics/Getting-Started-Samples/Intel_Extension_For_SKLearn_GettingStarted/readme.md

Lines changed: 47 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Intel® Python Scikit-learn Extension Getting Started Sample
22

3-
The `Intel® Python Scikit-learn Extension Getting Started` sample demonstrates how to use a support vector machine classifier from Intel® Extension for Scikit-learn* for digit recognition problem. All other machine learning algorithms available with Scikit-learn can be used in the similar way. Intel® Extension for Scikit-learn* speeds up scikit-learn applications. The acceleration is achieved through the use of the Intel® oneAPI Data Analytics Library (oneDAL) [Intel oneAPI Data Analytics Library](https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/onedal.html).
3+
The `Intel® Python Scikit-learn Extension Getting Started` sample demonstrates how to use a support vector machine classifier from Intel® Extension for Scikit-learn* for digit recognition problem. All other machine learning algorithms available with Scikit-learn can be used in the similar way. Intel® Extension for Scikit-learn* speeds up scikit-learn applications. The acceleration is achieved through the use of the Intel® oneAPI Data Analytics Library (oneDAL) [Intel oneAPI Data Analytics Library](https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/onedal.html), which comes with [Intel® AI Analytics Toolkit (AI Kit)](https://software.intel.com/content/www/us/en/develop/tools/oneapi/ai-analytics-toolkit.html).
44

55

66
| Area | Description
@@ -9,6 +9,10 @@ The `Intel® Python Scikit-learn Extension Getting Started` sample demonstrates
99
| What you will learn | How to use a basic Intel® Extension for Scikit-learn* programming model for Intel CPUs
1010
| Time to complete | 5 minutes
1111

12+
13+
## Purpose
14+
15+
In this sample, you will run a support vector classifier model from sklearn with oneDAL Daal4py library memory objects. You will also learn how to train a model and save the information to a file. Intel® Extension for Scikit-learn* depends on Intel® Daal4py. Daal4py is a simplified API to oneDAL that allows for fast usage of the framework suited for Data Scientists or Machine Learning users. Built to help provide an abstraction to oneDAL for direct usage or integration into one's own framework.
1216
## Prerequisites
1317

1418
| Optimized for | Description
@@ -22,35 +26,13 @@ You can refer to the oneAPI [product page](https://software.intel.com/en-us/onea
2226

2327
oneDAL is ready for use once you finish the AI Kit installation and have run the post installation script.
2428

25-
## Purpose
26-
27-
In this sample, you will run a support vector classifier model from sklearn with oneDAL Daal4py library memory objects. You will also learn how to train a model and save the information to a file. Intel® Extension for Scikit-learn* depends on Intel® Daal4py. Daal4py is a simplified API to oneDAL that allows for fast usage of the framework suited for Data Scientists or Machine Learning users. Built to help provide an abstraction to oneDAL for direct usage or integration into one's own framework.
2829

2930
## Key Implementation Details
3031

31-
This Getting Started sample code is implemented for CPU using the Python language. Intel® Extension for Scikit-learn* is available as a part of Intel® AI Tools.
32-
33-
You will need to download and install the following toolkits, tools, and components to use the sample.
32+
This Getting Started sample code is implemented for CPU using the Python language. The example assumes you have Intel® Extension for 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](https://software.intel.com/en-us/oneapi/ai-kit). Intel® Extension for Scikit-learn* is available as a part of Intel® AI Analytics Toolkit (AI kit).
3433

35-
**1. Get Intel® AI Tools**
34+
## Environment Setup
3635

37-
Required AI Tools: Intel® Extension for Scikit-learn*
38-
<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.
39-
40-
**2. Install dependencies**
41-
```
42-
pip install -r requirements.txt
43-
```
44-
**Install Jupyter Notebook** by running `pip install notebook`. Alternatively, see [Installing Jupyter](https://jupyter.org/install) for detailed installation instructions.
45-
46-
## Run the Sample
47-
>**Note**: Before running the sample, make sure [Environment Setup](https://github.com/oneapi-src/oneAPI-samples/tree/master/AI-and-Analytics/Getting-Started-Samples/Intel_Extension_For_SKLearn_GettingStarted#environment-setup) is completed.
48-
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:
49-
* [AI Tools Offline Installer (Validated)](#ai-tools-offline-installer-validated)
50-
* [Conda/PIP](#condapip)
51-
* [Docker](#docker)
52-
53-
### AI Tools Offline Installer (Validated)
5436
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
5537
```
5638
source $HOME/intel/oneapi/intelpython/bin/activate
@@ -59,56 +41,55 @@ If you used a separate location, open a terminal and type the following
5941
```
6042
source <custom_path>/bin/activate
6143
```
62-
2. Activate the Conda environment:
44+
45+
2. Activate Conda with Root Access
46+
47+
Intel Python environment will be active by default. However, if you activated another environment, you can return with the following command.
6348
```
64-
conda activate sklearnex
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/Intel_Extension_For_SKLearn_GettingStarted
49+
source activate base
50+
pip install -r requirements.txt
7051
```
7152

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)
75-
```
76-
jupyter notebook --ip=0.0.0.0
53+
2a. Activate Conda without Root Access (Optional)
54+
55+
By default, the Intel® AI Analytics Toolkit is installed in the inteloneapi 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 and activate your desired conda environment using the following commands.
7756
```
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:
57+
conda create --name usr_intelpython --clone base
58+
source activate usr_intelpython
8159
```
82-
Intel_Extension_For_SKLearn_GettingStarted.ipynb
60+
3. Clone the GitHub repository
8361
```
84-
7. Change the kernel to sklearnex
85-
86-
8. Run every cell in the Notebook in sequence.
87-
88-
### Conda/PIP
89-
> **Note**: Make sure your Conda/Python environment with AI Tools installed is activated
90-
1. Clone the GitHub repository:
91-
```
9262
git clone https://github.com/oneapi-src/oneAPI-samples.git
93-
cd oneapi-samples/AI-and-Analytics/Getting-Started-Samples/Intel_Extension_For_SKLearn_GettingStarted
94-
```
95-
2. Launch Jupyter Notebook:
96-
> **Note**: You might need to register Conda kernel to Jupyter Notebook kernel,
97-
feel free to check [the instruction](https://github.com/IntelAI/models/tree/master/docs/notebooks/perf_analysis#option-1-conda-environment-creation)
98-
```
99-
jupyter notebook --ip=0.0.0.0
100-
```
101-
<!-- add other flags to jupyter notebook command if needed, such as port 8888 or allow-root -->
102-
4. Follow the instructions to open the URL with the token in your browser.
103-
5. Select the Notebook:
104-
```
105-
Intel_Extension_For_SKLearn_GettingStarted.ipynb
63+
cd oneapi-samples/AI-and-Analytics/Getting-Started-Samples
10664
```
10765

108-
6. Run every cell in the Notebook in sequence.
66+
### Install Jupyter Notebook
67+
68+
1. Change to the sample directory.
69+
2. Install Jupyter Notebook with the proper kernel.
70+
```
71+
conda install jupyter nb_conda_kernels
72+
```
73+
74+
#### View in Jupyter Notebook
75+
76+
>**Note**: This distributed execution cannot be launched from Jupyter Notebook, but you can still view inside the notebook to follow the included write-up and description.
77+
78+
1. Change to the sample directory.
79+
2. Launch Jupyter Notebook.
80+
```
81+
jupyter notebook
82+
```
83+
3. Locate and select the Notebook.
84+
```
85+
Intel_Extension_For_SKLearn_GettingStarted.ipynb
86+
```
87+
4. Click the **Run** button to move through the cells in sequence.
88+
89+
90+
#### Troubleshooting
10991

110-
### Docker
111-
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.
92+
If you receive an error message, troubleshoot the problem using the **Diagnostics Utility for Intel® oneAPI Toolkits**. The diagnostic utility provides configuration and system checks to help find missing dependencies, permissions errors, and other issues. See the *[Diagnostics Utility for Intel® oneAPI Toolkits User Guide](https://www.intel.com/content/www/us/en/develop/documentation/diagnostic-utility-user-guide/top.html)* for more information on using the utility.
11293

11394
## Example Output
11495

@@ -127,7 +108,7 @@ Model accuracy on test data: 0.9833333333333333
127108
## Related Samples
128109

129110
* [Intel® Python XGBoost* Getting Started](https://github.com/oneapi-src/oneAPI-samples/tree/master/AI-and-Analytics/Getting-Started-Samples/IntelPython_XGBoost_GettingStarted)
130-
* [Intel® Python Daal4py Getting Started](https://github.com/oneapi-src/oneAPI-samples/tree/master/AI-and-Analytics/Getting-Started-Samples/IntelPython_daal4py_GettingStarted)
111+
* [Intel® Python XGBoost Daal4py Prediction](https://github.com/oneapi-src/oneAPI-samples/tree/master/AI-and-Analytics/Features-and-Functionality/IntelPython_XGBoost_daal4pyPrediction)
131112

132113
## License
133114

0 commit comments

Comments
 (0)