Skip to content

Commit c3799f8

Browse files
authored
Update daal4py 2023.2.1 (#5)
* Update model builders * Fix daaal4py
1 parent e0cea12 commit c3799f8

25 files changed

+346
-187
lines changed

daal4py/_modules/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
</form>
5353
</div>
5454
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
55-
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
55+
<p class="caption" role="heading"><span class="caption-text">Contents</span></p>
5656
<ul>
5757
<li class="toctree-l1"><a class="reference internal" href="../index.html">About daal4py</a></li>
5858
<li class="toctree-l1"><a class="reference internal" href="../data.html">Data</a></li>

daal4py/_sources/algorithms.rst.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
Algorithms
1919
##########
2020

21+
.. include:: note.rst
22+
2123
Classification
2224
--------------
2325
See also |onedal-dg-classification|_.

daal4py/_sources/contents.rst.txt

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,10 @@
1-
.. ******************************************************************************
2-
.. * Copyright 2020 Intel Corporation
3-
.. *
4-
.. * Licensed under the Apache License, Version 2.0 (the "License");
5-
.. * you may not use this file except in compliance with the License.
6-
.. * You may obtain a copy of the License at
7-
.. *
8-
.. * http://www.apache.org/licenses/LICENSE-2.0
9-
.. *
10-
.. * Unless required by applicable law or agreed to in writing, software
11-
.. * distributed under the License is distributed on an "AS IS" BASIS,
12-
.. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
.. * See the License for the specific language governing permissions and
14-
.. * limitations under the License.
15-
.. *******************************************************************************/
1+
.. _contents::
162

17-
.. _contents:
3+
.. include:: note.rst
184

19-
########
20-
Contents
21-
########
225
.. toctree::
236
:maxdepth: 2
24-
:caption: Contents:
7+
:caption: Contents
258

269
About daal4py <index>
2710
Data <data>
@@ -30,4 +13,4 @@ Contents
3013
Distributed Mode <scaling>
3114
Streaming Mode <streaming>
3215
Examples <examples>
33-
Scikit-Learn API <sklearn>
16+
Scikit-Learn API <sklearn>

daal4py/_sources/data.rst.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
##########
2020
Input Data
2121
##########
22+
23+
.. include:: note.rst
24+
2225
All array arguments to compute functions and to algorithm constructors can be
2326
provided in different formats. daal4py will automatically do its best to work on
2427
the provided data with minimal overhead, most notably without copying the data.

daal4py/_sources/examples.rst.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
Examples
1919
##########
2020

21+
.. include:: note.rst
22+
2123
Below are examples on how to utilize daal4py for various usage styles.
2224

2325
General usage

daal4py/_sources/index.rst.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
#####################################################
2020
Fast, Scalable and Easy Machine Learning With DAAL4PY
2121
#####################################################
22+
23+
.. include:: note.rst
24+
2225
Daal4py makes your Machine Learning algorithms in Python lightning fast and easy to use. It provides
2326
highly configurable Machine Learning kernels, some of which support streaming input data and/or can
2427
be easily and efficiently scaled out to clusters of workstations. Internally it uses Intel(R)
Lines changed: 97 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,102 +1,97 @@
1-
.. ******************************************************************************
2-
.. * Copyright 2023 Intel Corporation
3-
.. *
4-
.. * Licensed under the Apache License, Version 2.0 (the "License");
5-
.. * you may not use this file except in compliance with the License.
6-
.. * You may obtain a copy of the License at
7-
.. *
8-
.. * http://www.apache.org/licenses/LICENSE-2.0
9-
.. *
10-
.. * Unless required by applicable law or agreed to in writing, software
11-
.. * distributed under the License is distributed on an "AS IS" BASIS,
12-
.. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
.. * See the License for the specific language governing permissions and
14-
.. * limitations under the License.
15-
.. *******************************************************************************/
16-
17-
.. _model-builders:
18-
19-
###############################################
20-
Model Builders for the Gradient Boosting Frameworks
21-
###############################################
22-
Introduction
23-
------------------
24-
Gradient boosting on decision trees is one of the most accurate and efficient
25-
machine learning algorithms for classification and regression.
26-
The most popular implementations of it are the XGBoost*,
27-
LightGBM*, and CatBoost* frameworks.
28-
daal4py Model Builders deliver the accelerated
29-
models inference of those frameworks. The inference is performed by the oneDAL GBT implementation tuned
30-
for the best performance on the Intel(R) Architecture.
31-
32-
Conversion
33-
---------
34-
The first step is to convert already trained model. There are similar
35-
APIs for different frameworks.
36-
XGBoost::
37-
38-
import daal4py as d4p
39-
d4p_model = d4p.get_gbt_model_from_xgboost(xgb_model)
40-
41-
LightGBM::
42-
43-
import daal4py as d4p
44-
d4p_model = d4p.get_gbt_model_from_lightgbm(lgb_model)
45-
46-
CatBoost::
47-
48-
import daal4py as d4p
49-
d4p_model = d4p.get_gbt_model_from_catboost(cb_model)
50-
51-
.. note:: Convert model only once and then use it for the inference.
52-
53-
Classification and Regression Inference
54-
---------
55-
GBT implementation in daal4py assumes separate APIs for the classification and regression.
56-
Specify the corresponding API and match the corresponding problem
57-
in the initial framework.
58-
59-
Classification::
60-
61-
d4p_cls_algo = d4p.gbt_classification_prediction(
62-
nClasses=params['classes_count'],
63-
resultsToEvaluate="computeClassLabels",
64-
fptype='float'
65-
)
66-
67-
Regression::
68-
69-
d4p_reg_algo = d4p.gbt_regression_prediction()
70-
71-
Next, daal4py algorithm object needs compute method to be called.
72-
Both the data and the previously converted model should be passed with the results of the prediction
73-
available within the ``.prediction`` parameter.
74-
75-
Compute::
76-
77-
d4p_predictions = d4p_reg_algo.compute(X_test, d4p_model).prediction
78-
79-
The one-line variant of the same code::
80-
81-
d4p_prediction = d4p.gbt_regression_prediction().compute(X_test, d4p_model).prediction
82-
83-
84-
Limitations
85-
---------------------------------
86-
Missing Values (NaN)
87-
Note that there is temporary limitation on the use of missing values
88-
(NaN) during training and prediction. This problem is addressed on
89-
the master branch and to be available in the 2023.2 release.
90-
91-
Examples
92-
---------------------------------
93-
Model Builders models conversion
94-
95-
- `XGBoost model conversion <https://github.com/intel/scikit-learn-intelex/blob/master/examples/daal4py/gbt_cls_model_create_from_xgboost_batch.py>`_
96-
- `LightGBM model conversion <https://github.com/intel/scikit-learn-intelex/blob/master/examples/daal4py/gbt_cls_model_create_from_lightgbm_batch.py>`_
97-
- `CatBoost model conversion <https://github.com/intel/scikit-learn-intelex/blob/master/examples/daal4py/gbt_cls_model_create_from_catboost_batch.py>`_
98-
99-
Articles and Blog Posts
100-
---------------------------------
101-
102-
- `Improving the Performance of XGBoost and LightGBM Inference <https://medium.com/intel-analytics-software/improving-the-performance-of-xgboost-and-lightgbm-inference-3b542c03447e>`_
1+
.. ******************************************************************************
2+
.. * Copyright 2023 Intel Corporation
3+
.. *
4+
.. * Licensed under the Apache License, Version 2.0 (the "License");
5+
.. * you may not use this file except in compliance with the License.
6+
.. * You may obtain a copy of the License at
7+
.. *
8+
.. * http://www.apache.org/licenses/LICENSE-2.0
9+
.. *
10+
.. * Unless required by applicable law or agreed to in writing, software
11+
.. * distributed under the License is distributed on an "AS IS" BASIS,
12+
.. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
.. * See the License for the specific language governing permissions and
14+
.. * limitations under the License.
15+
.. *******************************************************************************/
16+
17+
.. _model-builders:
18+
19+
###############################################
20+
Model Builders for the Gradient Boosting Frameworks
21+
###############################################
22+
23+
.. include:: note.rst
24+
25+
Introduction
26+
------------------
27+
Gradient boosting on decision trees is one of the most accurate and efficient
28+
machine learning algorithms for classification and regression.
29+
The most popular implementations of it are:
30+
31+
* XGBoost*
32+
* LightGBM*
33+
* CatBoost*
34+
35+
daal4py Model Builders deliver the accelerated
36+
models inference of those frameworks. The inference is performed by the oneDAL GBT implementation tuned
37+
for the best performance on the Intel(R) Architecture.
38+
39+
Conversion
40+
---------
41+
The first step is to convert already trained model. The
42+
API usage for different frameworks is the same:
43+
44+
XGBoost::
45+
46+
import daal4py as d4p
47+
d4p_model = d4p.mb.convert_model(xgb_model)
48+
49+
LightGBM::
50+
51+
import daal4py as d4p
52+
d4p_model = d4p.mb.convert_model(lgb_model)
53+
54+
CatBoost::
55+
56+
import daal4py as d4p
57+
d4p_model = d4p.mb.convert_model(cb_model)
58+
59+
.. note:: Convert model only once and then use it for the inference.
60+
61+
Classification and Regression Inference
62+
----------------------------------------
63+
64+
The API is the same for classification and regression inference.
65+
Based on the original model passed to the ``convert_model``, ``d4p_prediction`` is either the classification or regression output.
66+
67+
::
68+
69+
d4p_prediction = d4p_model.predict(test_data)
70+
71+
Here, the ``predict()`` method of ``d4p_model`` is being used to make predictions on the ``test_data`` dataset.
72+
The ``d4p_prediction`` variable stores the predictions made by the ``predict()`` method.
73+
74+
Scikit-learn-style Estimators
75+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
76+
77+
You can also use the scikit-learn-style classes ``GBTDAALClassifier`` and ``GBTDAALRegressor`` to convert and infer your models. For example:
78+
79+
::
80+
81+
from daal4py.sklearn.ensemble import GBTDAALRegressor
82+
reg = xgb.XGBRegressor()
83+
reg.fit(X, y)
84+
d4p_predt = GBTDAALRegressor.convert_model(reg).predict(X)
85+
86+
Examples
87+
---------------------------------
88+
Model Builders models conversion
89+
90+
- `XGBoost model conversion <https://github.com/intel/scikit-learn-intelex/blob/master/examples/daal4py/model_builders_xgboost.py>`_
91+
- `LightGBM model conversion <https://github.com/intel/scikit-learn-intelex/blob/master/examples/daal4py/model_builders_lightgbm.py>`_
92+
- `CatBoost model conversion <https://github.com/intel/scikit-learn-intelex/blob/master/examples/daal4py/model_builders_catboost.py>`_
93+
94+
Articles and Blog Posts
95+
---------------------------------
96+
97+
- `Improving the Performance of XGBoost and LightGBM Inference <https://medium.com/intel-analytics-software/improving-the-performance-of-xgboost-and-lightgbm-inference-3b542c03447e>`_

daal4py/_sources/note.rst.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.. _note:
2+
3+
.. note:: Scikit-learn patching functionality in daal4py was deprecated and moved to a separate package, `Intel(R) Extension for Scikit-learn* <https://github.com/intel/scikit-learn-intelex>`_.
4+
All future patches will be available only in Intel(R) Extension for Scikit-learn*. Use the scikit-learn-intelex package instead of daal4py for the scikit-learn acceleration.

daal4py/_sources/scaling.rst.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
###############################################
2020
Scaling on Distributed Memory (Multiprocessing)
2121
###############################################
22+
23+
.. include:: note.rst
24+
2225
It's Easy
2326
---------
2427
daal4py operates in SPMD style (Single Program Multiple Data), which means your

daal4py/_sources/sklearn.rst.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
Scikit-Learn API and patching
2121
#############################
2222

23+
.. include:: note.rst
24+
2325
Python interface to efficient Intel(R) oneAPI Data Analytics Library provided by daal4py allows one
2426
to create scikit-learn compatible estimators, transformers, clusterers, etc. powered by oneDAL which
2527
are nearly as efficient as native programs.

0 commit comments

Comments
 (0)