Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion daal4py/_modules/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<p class="caption" role="heading"><span class="caption-text">Contents</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../index.html">About daal4py</a></li>
<li class="toctree-l1"><a class="reference internal" href="../data.html">Data</a></li>
Expand Down
2 changes: 2 additions & 0 deletions daal4py/_sources/algorithms.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
Algorithms
##########

.. include:: note.rst

Classification
--------------
See also |onedal-dg-classification|_.
Expand Down
25 changes: 4 additions & 21 deletions daal4py/_sources/contents.rst.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,10 @@
.. ******************************************************************************
.. * Copyright 2020 Intel Corporation
.. *
.. * Licensed under the Apache License, Version 2.0 (the "License");
.. * you may not use this file except in compliance with the License.
.. * You may obtain a copy of the License at
.. *
.. * http://www.apache.org/licenses/LICENSE-2.0
.. *
.. * Unless required by applicable law or agreed to in writing, software
.. * distributed under the License is distributed on an "AS IS" BASIS,
.. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
.. * See the License for the specific language governing permissions and
.. * limitations under the License.
.. *******************************************************************************/
.. _contents::

.. _contents:
.. include:: note.rst

########
Contents
########
.. toctree::
:maxdepth: 2
:caption: Contents:
:caption: Contents

About daal4py <index>
Data <data>
Expand All @@ -30,4 +13,4 @@ Contents
Distributed Mode <scaling>
Streaming Mode <streaming>
Examples <examples>
Scikit-Learn API <sklearn>
Scikit-Learn API <sklearn>
3 changes: 3 additions & 0 deletions daal4py/_sources/data.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
##########
Input Data
##########

.. include:: note.rst

All array arguments to compute functions and to algorithm constructors can be
provided in different formats. daal4py will automatically do its best to work on
the provided data with minimal overhead, most notably without copying the data.
Expand Down
2 changes: 2 additions & 0 deletions daal4py/_sources/examples.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
Examples
##########

.. include:: note.rst

Below are examples on how to utilize daal4py for various usage styles.

General usage
Expand Down
3 changes: 3 additions & 0 deletions daal4py/_sources/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
#####################################################
Fast, Scalable and Easy Machine Learning With DAAL4PY
#####################################################

.. include:: note.rst

Daal4py makes your Machine Learning algorithms in Python lightning fast and easy to use. It provides
highly configurable Machine Learning kernels, some of which support streaming input data and/or can
be easily and efficiently scaled out to clusters of workstations. Internally it uses Intel(R)
Expand Down
199 changes: 97 additions & 102 deletions daal4py/_sources/model-builders.rst.txt
Original file line number Diff line number Diff line change
@@ -1,102 +1,97 @@
.. ******************************************************************************
.. * Copyright 2023 Intel Corporation
.. *
.. * Licensed under the Apache License, Version 2.0 (the "License");
.. * you may not use this file except in compliance with the License.
.. * You may obtain a copy of the License at
.. *
.. * http://www.apache.org/licenses/LICENSE-2.0
.. *
.. * Unless required by applicable law or agreed to in writing, software
.. * distributed under the License is distributed on an "AS IS" BASIS,
.. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
.. * See the License for the specific language governing permissions and
.. * limitations under the License.
.. *******************************************************************************/

.. _model-builders:

###############################################
Model Builders for the Gradient Boosting Frameworks
###############################################
Introduction
------------------
Gradient boosting on decision trees is one of the most accurate and efficient
machine learning algorithms for classification and regression.
The most popular implementations of it are the XGBoost*,
LightGBM*, and CatBoost* frameworks.
daal4py Model Builders deliver the accelerated
models inference of those frameworks. The inference is performed by the oneDAL GBT implementation tuned
for the best performance on the Intel(R) Architecture.

Conversion
---------
The first step is to convert already trained model. There are similar
APIs for different frameworks.
XGBoost::

import daal4py as d4p
d4p_model = d4p.get_gbt_model_from_xgboost(xgb_model)

LightGBM::

import daal4py as d4p
d4p_model = d4p.get_gbt_model_from_lightgbm(lgb_model)

CatBoost::

import daal4py as d4p
d4p_model = d4p.get_gbt_model_from_catboost(cb_model)

.. note:: Convert model only once and then use it for the inference.

Classification and Regression Inference
---------
GBT implementation in daal4py assumes separate APIs for the classification and regression.
Specify the corresponding API and match the corresponding problem
in the initial framework.

Classification::

d4p_cls_algo = d4p.gbt_classification_prediction(
nClasses=params['classes_count'],
resultsToEvaluate="computeClassLabels",
fptype='float'
)

Regression::

d4p_reg_algo = d4p.gbt_regression_prediction()

Next, daal4py algorithm object needs compute method to be called.
Both the data and the previously converted model should be passed with the results of the prediction
available within the ``.prediction`` parameter.

Compute::

d4p_predictions = d4p_reg_algo.compute(X_test, d4p_model).prediction

The one-line variant of the same code::

d4p_prediction = d4p.gbt_regression_prediction().compute(X_test, d4p_model).prediction


Limitations
---------------------------------
Missing Values (NaN)
Note that there is temporary limitation on the use of missing values
(NaN) during training and prediction. This problem is addressed on
the master branch and to be available in the 2023.2 release.

Examples
---------------------------------
Model Builders models conversion

- `XGBoost model conversion <https://github.com/intel/scikit-learn-intelex/blob/master/examples/daal4py/gbt_cls_model_create_from_xgboost_batch.py>`_
- `LightGBM model conversion <https://github.com/intel/scikit-learn-intelex/blob/master/examples/daal4py/gbt_cls_model_create_from_lightgbm_batch.py>`_
- `CatBoost model conversion <https://github.com/intel/scikit-learn-intelex/blob/master/examples/daal4py/gbt_cls_model_create_from_catboost_batch.py>`_

Articles and Blog Posts
---------------------------------

- `Improving the Performance of XGBoost and LightGBM Inference <https://medium.com/intel-analytics-software/improving-the-performance-of-xgboost-and-lightgbm-inference-3b542c03447e>`_
.. ******************************************************************************
.. * Copyright 2023 Intel Corporation
.. *
.. * Licensed under the Apache License, Version 2.0 (the "License");
.. * you may not use this file except in compliance with the License.
.. * You may obtain a copy of the License at
.. *
.. * http://www.apache.org/licenses/LICENSE-2.0
.. *
.. * Unless required by applicable law or agreed to in writing, software
.. * distributed under the License is distributed on an "AS IS" BASIS,
.. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
.. * See the License for the specific language governing permissions and
.. * limitations under the License.
.. *******************************************************************************/

.. _model-builders:

###############################################
Model Builders for the Gradient Boosting Frameworks
###############################################

.. include:: note.rst

Introduction
------------------
Gradient boosting on decision trees is one of the most accurate and efficient
machine learning algorithms for classification and regression.
The most popular implementations of it are:

* XGBoost*
* LightGBM*
* CatBoost*

daal4py Model Builders deliver the accelerated
models inference of those frameworks. The inference is performed by the oneDAL GBT implementation tuned
for the best performance on the Intel(R) Architecture.

Conversion
---------
The first step is to convert already trained model. The
API usage for different frameworks is the same:

XGBoost::

import daal4py as d4p
d4p_model = d4p.mb.convert_model(xgb_model)

LightGBM::

import daal4py as d4p
d4p_model = d4p.mb.convert_model(lgb_model)

CatBoost::

import daal4py as d4p
d4p_model = d4p.mb.convert_model(cb_model)

.. note:: Convert model only once and then use it for the inference.

Classification and Regression Inference
----------------------------------------

The API is the same for classification and regression inference.
Based on the original model passed to the ``convert_model``, ``d4p_prediction`` is either the classification or regression output.

::

d4p_prediction = d4p_model.predict(test_data)

Here, the ``predict()`` method of ``d4p_model`` is being used to make predictions on the ``test_data`` dataset.
The ``d4p_prediction`` variable stores the predictions made by the ``predict()`` method.

Scikit-learn-style Estimators
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

You can also use the scikit-learn-style classes ``GBTDAALClassifier`` and ``GBTDAALRegressor`` to convert and infer your models. For example:

::

from daal4py.sklearn.ensemble import GBTDAALRegressor
reg = xgb.XGBRegressor()
reg.fit(X, y)
d4p_predt = GBTDAALRegressor.convert_model(reg).predict(X)

Examples
---------------------------------
Model Builders models conversion

- `XGBoost model conversion <https://github.com/intel/scikit-learn-intelex/blob/master/examples/daal4py/model_builders_xgboost.py>`_
- `LightGBM model conversion <https://github.com/intel/scikit-learn-intelex/blob/master/examples/daal4py/model_builders_lightgbm.py>`_
- `CatBoost model conversion <https://github.com/intel/scikit-learn-intelex/blob/master/examples/daal4py/model_builders_catboost.py>`_

Articles and Blog Posts
---------------------------------

- `Improving the Performance of XGBoost and LightGBM Inference <https://medium.com/intel-analytics-software/improving-the-performance-of-xgboost-and-lightgbm-inference-3b542c03447e>`_
4 changes: 4 additions & 0 deletions daal4py/_sources/note.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.. _note:

.. 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>`_.
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.
3 changes: 3 additions & 0 deletions daal4py/_sources/scaling.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
###############################################
Scaling on Distributed Memory (Multiprocessing)
###############################################

.. include:: note.rst

It's Easy
---------
daal4py operates in SPMD style (Single Program Multiple Data), which means your
Expand Down
2 changes: 2 additions & 0 deletions daal4py/_sources/sklearn.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
Scikit-Learn API and patching
#############################

.. include:: note.rst

Python interface to efficient Intel(R) oneAPI Data Analytics Library provided by daal4py allows one
to create scikit-learn compatible estimators, transformers, clusterers, etc. powered by oneDAL which
are nearly as efficient as native programs.
Expand Down
3 changes: 3 additions & 0 deletions daal4py/_sources/streaming.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
##############
Streaming Data
##############

.. include:: note.rst

For large quantities of data it might be impossible to provide all input data at
once. This might be because the data resides in multiple files and merging it is
to costly (or not feasible in other ways). In other cases the data is simply too
Expand Down
7 changes: 6 additions & 1 deletion daal4py/algorithms.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<p class="caption" role="heading"><span class="caption-text">Contents</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="index.html">About daal4py</a></li>
<li class="toctree-l1"><a class="reference internal" href="data.html">Data</a></li>
Expand Down Expand Up @@ -548,6 +548,11 @@

<section id="algorithms">
<h1>Algorithms<a class="headerlink" href="#algorithms" title="Permalink to this heading"></a></h1>
<div class="admonition note" id="note">
<p class="admonition-title">Note</p>
<p>Scikit-learn patching functionality in daal4py was deprecated and moved to a separate package, <a class="reference external" href="https://github.com/intel/scikit-learn-intelex">Intel(R) Extension for Scikit-learn*</a>.
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.</p>
</div>
<section id="classification">
<h2>Classification<a class="headerlink" href="#classification" title="Permalink to this heading"></a></h2>
<p>See also <a class="reference external" href="https://oneapi-src.github.io/oneDAL/daal/usage/training-and-prediction/classification.html">Intel(R) oneAPI Data Analytics Library Classification</a>.</p>
Expand Down
Loading