-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathsklearn.html
More file actions
executable file
·437 lines (318 loc) · 24.8 KB
/
sklearn.html
File metadata and controls
executable file
·437 lines (318 loc) · 24.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Scikit-Learn API and patching — daal4py 2021.1 documentation</title>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/style.css" type="text/css" />
<!--[if lt IE 9]>
<script src="_static/js/html5shiv.min.js"></script>
<![endif]-->
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="prev" title="Examples" href="examples.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="contents.html" class="icon icon-home"> daal4py
</a>
<div class="version">
2021
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<p class="caption"><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>
<li class="toctree-l1"><a class="reference internal" href="algorithms.html">Supported Algorithms</a></li>
<li class="toctree-l1"><a class="reference internal" href="scaling.html">Distribution</a></li>
<li class="toctree-l1"><a class="reference internal" href="streaming.html">Streaming</a></li>
<li class="toctree-l1"><a class="reference internal" href="examples.html">Examples</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Scikit-Learn API</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#onedal-accelerated-scikit-learn">oneDAL accelerated scikit-learn</a></li>
<li class="toctree-l2"><a class="reference internal" href="#scikit-learn-verbose">scikit-learn verbose</a></li>
<li class="toctree-l2"><a class="reference internal" href="#scikit-learn-api">scikit-learn API</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="contents.html">daal4py</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="contents.html" class="icon icon-home"></a> »</li>
<li>Scikit-Learn API and patching</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/sklearn.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="scikit-learn-api-and-patching">
<span id="sklearn"></span><h1>Scikit-Learn API and patching<a class="headerlink" href="#scikit-learn-api-and-patching" title="Permalink to this headline">¶</a></h1>
<p>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.</p>
<div class="section" id="onedal-accelerated-scikit-learn">
<span id="sklearn-patches"></span><h2>oneDAL accelerated scikit-learn<a class="headerlink" href="#onedal-accelerated-scikit-learn" title="Permalink to this headline">¶</a></h2>
<p>daal4py can dynamically patch scikit-learn estimators to use Intel(R) oneAPI Data Analytics Library
as the underlying solver, while getting the same solution faster.</p>
<p>It is possible to enable those patches without editing the code of a scikit-learn application by
using the following commandline flag:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">python</span> <span class="o">-</span><span class="n">m</span> <span class="n">daal4py</span> <span class="n">my_application</span><span class="o">.</span><span class="n">py</span>
</pre></div>
</div>
<p>If you are using Scikit-Learn from Intel® Distribution for Python, then
you can enable daal4py patches through an environment variable. To do this, set <code class="docutils literal notranslate"><span class="pre">USE_DAAL4PY_SKLEARN</span></code> to one of the values
<code class="docutils literal notranslate"><span class="pre">True</span></code>, <code class="docutils literal notranslate"><span class="pre">'1'</span></code>, <code class="docutils literal notranslate"><span class="pre">'y'</span></code>, <code class="docutils literal notranslate"><span class="pre">'yes'</span></code>, <code class="docutils literal notranslate"><span class="pre">'Y'</span></code>, <code class="docutils literal notranslate"><span class="pre">'YES'</span></code>, <code class="docutils literal notranslate"><span class="pre">'Yes'</span></code>, <code class="docutils literal notranslate"><span class="pre">'true'</span></code>, <code class="docutils literal notranslate"><span class="pre">'True'</span></code> or <code class="docutils literal notranslate"><span class="pre">'TRUE'</span></code> as shown below.</p>
<p>On Linux and Mac OS:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">export</span> <span class="n">USE_DAAL4PY_SKLEARN</span><span class="o">=</span><span class="mi">1</span>
</pre></div>
</div>
<p>On Windows:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="nb">set</span> <span class="n">USE_DAAL4PY_SKLEARN</span><span class="o">=</span><span class="mi">1</span>
</pre></div>
</div>
<p>To disable daal4py patches, set the <code class="docutils literal notranslate"><span class="pre">USE_DAAL4PY_SKLEARN</span></code> environment variable to 0.</p>
<p>Patches can also be enabled programmatically:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">daal4py.sklearn</span>
<span class="n">daal4py</span><span class="o">.</span><span class="n">sklearn</span><span class="o">.</span><span class="n">patch_sklearn</span><span class="p">()</span>
</pre></div>
</div>
<p>It is possible to undo the patch with:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">daal4py</span><span class="o">.</span><span class="n">sklearn</span><span class="o">.</span><span class="n">unpatch_sklearn</span><span class="p">()</span>
</pre></div>
</div>
<p id="sklearn-algorithms">Applying the monkey patch will impact the following existing scikit-learn
algorithms:</p>
<table class="colwidths-given docutils align-left">
<colgroup>
<col style="width: 15%" />
<col style="width: 15%" />
<col style="width: 46%" />
<col style="width: 23%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>Task</p></th>
<th class="head"><p>Functionality</p></th>
<th class="head"><p>Parameters support</p></th>
<th class="head"><p>Data support</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>Classification</p></td>
<td><p>SVC</p></td>
<td><p>All parameters except <code class="docutils literal notranslate"><span class="pre">poly</span></code> and <code class="docutils literal notranslate"><span class="pre">sigmoid</span></code> kernels.</p></td>
<td><p>No limitations.</p></td>
</tr>
<tr class="row-odd"><td><p>Classification</p></td>
<td><p>RandomForestClassifier</p></td>
<td><p>All parameters except <code class="docutils literal notranslate"><span class="pre">warmstart</span></code> = True and <code class="docutils literal notranslate"><span class="pre">cpp_alpha</span></code> != 0, <code class="docutils literal notranslate"><span class="pre">criterion</span></code> != ‘gini’.</p></td>
<td><p>Multi-output and sparse data is not supported.</p></td>
</tr>
<tr class="row-even"><td><p>Classification</p></td>
<td><p>KNeighborsClassifier</p></td>
<td><p>All parameters except <code class="docutils literal notranslate"><span class="pre">metric</span></code> != ‘euclidean’ or <code class="docutils literal notranslate"><span class="pre">minkowski</span></code> with <code class="docutils literal notranslate"><span class="pre">p</span></code> = 2.</p></td>
<td><p>Multi-output and sparse data is not supported.</p></td>
</tr>
<tr class="row-odd"><td><p>Classification</p></td>
<td><p>LogisticRegression</p></td>
<td><p>All parameters except <code class="docutils literal notranslate"><span class="pre">solver</span></code> != ‘lbfgs’ or ‘newton-cg’, <code class="docutils literal notranslate"><span class="pre">class_weight</span></code> != None, <code class="docutils literal notranslate"><span class="pre">sample_weight</span></code> != None.</p></td>
<td><p>Only dense data is supported.</p></td>
</tr>
<tr class="row-even"><td><p>Regression</p></td>
<td><p>RandomForestRegressor</p></td>
<td><p>All parameters except <code class="docutils literal notranslate"><span class="pre">warmstart</span></code> = True and <code class="docutils literal notranslate"><span class="pre">cpp_alpha</span></code> != 0, <code class="docutils literal notranslate"><span class="pre">criterion</span></code> != ‘mse’.</p></td>
<td><p>Multi-output and sparse data is not supported.</p></td>
</tr>
<tr class="row-odd"><td><p>Regression</p></td>
<td><p>KNeighborsRegressor</p></td>
<td><p>All parameters except <code class="docutils literal notranslate"><span class="pre">metric</span></code> != ‘euclidean’ or <code class="docutils literal notranslate"><span class="pre">minkowski</span></code> with <code class="docutils literal notranslate"><span class="pre">p</span></code> = 2.</p></td>
<td><p>Multi-output and sparse data is not supported.</p></td>
</tr>
<tr class="row-even"><td><p>Regression</p></td>
<td><p>LinearRegression</p></td>
<td><p>All parameters except <code class="docutils literal notranslate"><span class="pre">normalize</span></code> != False and <code class="docutils literal notranslate"><span class="pre">sample_weight</span></code> != None.</p></td>
<td><p>Only dense data is supported, #observations should be >= #features.</p></td>
</tr>
<tr class="row-odd"><td><p>Regression</p></td>
<td><p>Ridge</p></td>
<td><p>All parameters except <code class="docutils literal notranslate"><span class="pre">normalize</span></code> != False, <code class="docutils literal notranslate"><span class="pre">solver</span></code> != ‘auto’ and <code class="docutils literal notranslate"><span class="pre">sample_weight</span></code> != None.</p></td>
<td><p>Only dense data is supported, #observations should be >= #features.</p></td>
</tr>
<tr class="row-even"><td><p>Regression</p></td>
<td><p>ElasticNet</p></td>
<td><p>All parameters except <code class="docutils literal notranslate"><span class="pre">sample_weight</span></code> != None.</p></td>
<td><p>Multi-output and sparse data is not supported, #observations should be >= #features.</p></td>
</tr>
<tr class="row-odd"><td><p>Regression</p></td>
<td><p>Lasso</p></td>
<td><p>All parameters except <code class="docutils literal notranslate"><span class="pre">sample_weight</span></code> != None.</p></td>
<td><p>Multi-output and sparse data is not supported, #observations should be >= #features.</p></td>
</tr>
<tr class="row-even"><td><p>Clustering</p></td>
<td><p>KMeans</p></td>
<td><p>All parameters except <code class="docutils literal notranslate"><span class="pre">precompute_distances</span></code> and <code class="docutils literal notranslate"><span class="pre">sample_weight</span></code> != None.</p></td>
<td><p>No limitations.</p></td>
</tr>
<tr class="row-odd"><td><p>Clustering</p></td>
<td><p>DBSCAN</p></td>
<td><p>All parameters except <code class="docutils literal notranslate"><span class="pre">metric</span></code> != ‘euclidean’ or <code class="docutils literal notranslate"><span class="pre">minkowski</span></code> with <code class="docutils literal notranslate"><span class="pre">p</span></code> = 2.</p></td>
<td><p>Only dense data is supported.</p></td>
</tr>
<tr class="row-even"><td><p>Dimensionality reduction</p></td>
<td><p>PCA</p></td>
<td><p>All parameters except <code class="docutils literal notranslate"><span class="pre">svd_solver</span></code> != ‘full’.</p></td>
<td><p>Sparse data is not supported.</p></td>
</tr>
<tr class="row-odd"><td><p>Unsupervised</p></td>
<td><p>NearestNeighbors</p></td>
<td><p>All parameters except <code class="docutils literal notranslate"><span class="pre">metric</span></code> != ‘euclidean’ or <code class="docutils literal notranslate"><span class="pre">minkowski</span></code> with <code class="docutils literal notranslate"><span class="pre">p</span></code> = 2.</p></td>
<td><p>Sparse data is not supported.</p></td>
</tr>
<tr class="row-even"><td><p>Other</p></td>
<td><p>train_test_split</p></td>
<td><p>All parameters are supported.</p></td>
<td><p>Only dense data is supported.</p></td>
</tr>
<tr class="row-odd"><td><p>Other</p></td>
<td><p>assert_all_finite</p></td>
<td><p>All parameters are supported.</p></td>
<td><p>Only dense data is supported.</p></td>
</tr>
<tr class="row-even"><td><p>Other</p></td>
<td><p>pairwise_distance</p></td>
<td><p>With metric=``cosine`` and <code class="docutils literal notranslate"><span class="pre">correlation</span></code>.</p></td>
<td><p>Only dense data is supported.</p></td>
</tr>
</tbody>
</table>
<p>Monkey-patched scikit-learn classes and functions passes scikit-learn’s own test
suite, with few exceptions, specified in <a class="reference external" href="https://github.com/IntelPython/daal4py/blob/master/deselected_tests.yaml">deselected_tests.yaml</a>.</p>
<p>In particular the tests execute <a class="reference external" href="https://scikit-learn.org/stable/modules/generated/sklearn.utils.estimator_checks.check_estimator.html">check_estimator</a>
on all added and monkey-patched classes, which are discovered by means of
introspection. This assures scikit-learn API compatibility of all
<cite>daal4py.sklearn</cite> classes.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>daal4py supports optimizations for the last four versions of scikit-learn.
The latest release of daal4py-2021.1 supports scikit-learn 0.21.X, 0.22.X, 0.23.X and 0.24.X.</p>
</div>
</div>
<div class="section" id="scikit-learn-verbose">
<span id="sklearn-verbose"></span><h2>scikit-learn verbose<a class="headerlink" href="#scikit-learn-verbose" title="Permalink to this headline">¶</a></h2>
<p>To find out which implementation of the algorithm is currently used,
set the environment variable.</p>
<p>On Linux and Mac OS:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">export</span> <span class="n">IDP_SKLEARN_VERBOSE</span><span class="o">=</span><span class="n">INFO</span>
</pre></div>
</div>
<p>On Windows:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="nb">set</span> <span class="n">IDP_SKLEARN_VERBOSE</span><span class="o">=</span><span class="n">INFO</span>
</pre></div>
</div>
<p>During the calls that use Intel-optimized scikit-learn, you will receive additional print statements
that indicate which implementation is being called.
These print statements are only available for <a class="reference internal" href="#sklearn-algorithms"><span class="std std-ref">scikit-learn algorithms with daal4py patches</span></a>.</p>
<p>For example, for DBSCAN you get one of these print statements depending on which implementation is used:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">INFO</span><span class="p">:</span> <span class="n">sklearn</span><span class="o">.</span><span class="n">cluster</span><span class="o">.</span><span class="n">DBSCAN</span><span class="o">.</span><span class="n">fit</span><span class="p">:</span> <span class="n">uses</span> <span class="n">Intel</span><span class="p">(</span><span class="n">R</span><span class="p">)</span> <span class="n">oneAPI</span> <span class="n">Data</span> <span class="n">Analytics</span> <span class="n">Library</span> <span class="n">solver</span>
</pre></div>
</div>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">INFO</span><span class="p">:</span> <span class="n">sklearn</span><span class="o">.</span><span class="n">cluster</span><span class="o">.</span><span class="n">DBSCAN</span><span class="o">.</span><span class="n">fit</span><span class="p">:</span> <span class="n">uses</span> <span class="n">original</span> <span class="n">Scikit</span><span class="o">-</span><span class="n">learn</span> <span class="n">solver</span>
</pre></div>
</div>
</div>
<div class="section" id="scikit-learn-api">
<span id="sklearn-api"></span><h2>scikit-learn API<a class="headerlink" href="#scikit-learn-api" title="Permalink to this headline">¶</a></h2>
<p>The <code class="docutils literal notranslate"><span class="pre">daal4py.sklearn</span></code> package contains scikit-learn compatible API which
implement a subset of scikit-learn algorithms using Intel(R) oneAPI Data Analytics Library.</p>
<p>Currently, these include:</p>
<ol class="arabic simple">
<li><p><code class="docutils literal notranslate"><span class="pre">daal4py.sklearn.neighbors.KNeighborsClassifier</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">daal4py.sklearn.neighbors.KNeighborsRegressor</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">daal4py.sklearn.neighbors.NearestNeighbors</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">daal4py.sklearn.tree.DecisionTreeClassifier</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">daal4py.sklearn.ensemble.RandomForestClassifier</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">daal4py.sklearn.ensemble.RandomForestRegressor</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">daal4py.sklearn.ensemble.AdaBoostClassifier</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">daal4py.sklearn.cluster.KMeans</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">daal4py.sklearn.cluster.DBSCAN</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">daal4py.sklearn.decomposition.PCA</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">daal4py.sklearn.linear_model.Ridge</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">daal4py.sklearn.svm.SVC</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">daal4py.sklearn.linear_model.logistic_regression_path</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">daal4py.sklearn.linear_model.LogisticRegression</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">daal4py.sklearn.linear_model.ElasticNet</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">daal4py.sklearn.linear_model.Lasso</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">daal4py.sklearn.model_selection._daal_train_test_split</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">daal4py.sklearn.metrics._daal_roc_auc_score</span></code></p></li>
</ol>
<p>These classes are always available, whether the scikit-learn itself has been
patched, or not. For example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">daal4py.sklearn</span>
<span class="n">daal4py</span><span class="o">.</span><span class="n">sklearn</span><span class="o">.</span><span class="n">unpatch_sklearn</span><span class="p">()</span>
<span class="kn">import</span> <span class="nn">sklearn.datasets</span><span class="o">,</span> <span class="nn">sklearn.svm</span>
<span class="n">digits</span> <span class="o">=</span> <span class="n">sklearn</span><span class="o">.</span><span class="n">datasets</span><span class="o">.</span><span class="n">load_digits</span><span class="p">()</span>
<span class="n">X</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="n">digits</span><span class="o">.</span><span class="n">data</span><span class="p">,</span> <span class="n">digits</span><span class="o">.</span><span class="n">target</span>
<span class="n">clf_d</span> <span class="o">=</span> <span class="n">daal4py</span><span class="o">.</span><span class="n">sklearn</span><span class="o">.</span><span class="n">svm</span><span class="o">.</span><span class="n">SVC</span><span class="p">(</span><span class="n">kernel</span><span class="o">=</span><span class="s1">'rbf'</span><span class="p">,</span> <span class="n">gamma</span><span class="o">=</span><span class="s1">'scale'</span><span class="p">,</span> <span class="n">C</span> <span class="o">=</span> <span class="mf">0.5</span><span class="p">)</span><span class="o">.</span><span class="n">fit</span><span class="p">(</span><span class="n">X</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span>
<span class="n">clf_v</span> <span class="o">=</span> <span class="n">sklearn</span><span class="o">.</span><span class="n">svm</span><span class="o">.</span><span class="n">SVC</span><span class="p">(</span><span class="n">kernel</span><span class="o">=</span><span class="s1">'rbf'</span><span class="p">,</span> <span class="n">gamma</span><span class="o">=</span><span class="s1">'scale'</span><span class="p">,</span> <span class="n">C</span> <span class="o">=</span><span class="mf">0.5</span><span class="p">)</span><span class="o">.</span><span class="n">fit</span><span class="p">(</span><span class="n">X</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span>
<span class="n">clf_d</span><span class="o">.</span><span class="n">score</span><span class="p">(</span><span class="n">X</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span> <span class="c1"># output: 0.9905397885364496</span>
<span class="n">clf_v</span><span class="o">.</span><span class="n">score</span><span class="p">(</span><span class="n">X</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span> <span class="c1"># output: 0.9905397885364496</span>
</pre></div>
</div>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="examples.html" class="btn btn-neutral float-left" title="Examples" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
© Copyright 2021, Intel.
</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>