forked from scikit-learn/scikit-learn.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsklearn.datasets.fetch_kddcup99.html
470 lines (435 loc) · 17.9 KB
/
sklearn.datasets.fetch_kddcup99.html
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
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>sklearn.datasets.fetch_kddcup99 — scikit-learn 0.20.dev0 documentation</title>
<!-- htmltitle is before nature.css - we use this hack to load bootstrap first -->
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="../../_static/css/bootstrap.min.css" media="screen" />
<link rel="stylesheet" href="../../_static/css/bootstrap-responsive.css"/>
<link rel="stylesheet" href="../../_static/nature.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../_static/gallery.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '0.20.dev0',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="../../_static/jquery.js"></script>
<script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script>
<script type="text/javascript" src="../../_static/js/copybutton.js"></script>
<script type="text/javascript" src="../../_static/js/extra.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS_SVG"></script>
<link rel="shortcut icon" href="../../_static/favicon.ico"/>
<link rel="author" title="About these documents" href="../../about.html" />
<link rel="search" title="Search" href="../../search.html" />
<link rel="next" title="sklearn.datasets.fetch_lfw_pairs" href="sklearn.datasets.fetch_lfw_pairs.html" />
<link rel="prev" title="sklearn.datasets.fetch_covtype" href="sklearn.datasets.fetch_covtype.html" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="../../_static/js/bootstrap.min.js" type="text/javascript"></script>
<script>
VERSION_SUBDIR = (function(groups) {
return groups ? groups[1] : null;
})(location.href.match(/^https?:\/\/scikit-learn.org\/([^\/]+)/));
</script>
<link rel="canonical" href="http://scikit-learn.org/stable/modules/generated/sklearn.datasets.fetch_kddcup99.html" />
<script type="text/javascript">
$("div.buttonNext, div.buttonPrevious").hover(
function () {
$(this).css('background-color', '#FF9C34');
},
function () {
$(this).css('background-color', '#A7D6E2');
}
);
function showMenu() {
var topNav = document.getElementById("scikit-navbar");
if (topNav.className === "navbar") {
topNav.className += " responsive";
} else {
topNav.className = "navbar";
}
};
</script>
</head>
<body>
<div class="header-wrapper">
<div class="header">
<p class="logo"><a href="../../index.html">
<img src="../../_static/scikit-learn-logo-small.png" alt="Logo"/>
</a>
</p><div class="navbar" id="scikit-navbar">
<ul>
<li><a href="../../index.html">Home</a></li>
<li><a href="../../install.html">Installation</a></li>
<li class="btn-li"><div class="btn-group">
<a href="../../documentation.html">Documentation</a>
<a class="btn dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li class="link-title">Scikit-learn <script>document.write(DOCUMENTATION_OPTIONS.VERSION + (VERSION_SUBDIR ? " (" + VERSION_SUBDIR + ")" : ""));</script></li>
<li><a href="../../tutorial/index.html">Tutorials</a></li>
<li><a href="../../user_guide.html">User guide</a></li>
<li><a href="../classes.html">API</a></li>
<li><a href="../../glossary.html">Glossary</a></li>
<li><a href="../../faq.html">FAQ</a></li>
<li><a href="../../developers/contributing.html">Contributing</a></li>
<li class="divider"></li>
<script>if (VERSION_SUBDIR != "stable") document.write('<li><a href="http://scikit-learn.org/stable/documentation.html">Stable version</a></li>')</script>
<script>if (VERSION_SUBDIR != "dev") document.write('<li><a href="http://scikit-learn.org/dev/documentation.html">Development version</a></li>')</script>
<li><a href="http://scikit-learn.org/dev/versions.html">All available versions</a></li>
<li><a href="../../_downloads/scikit-learn-docs.pdf">PDF documentation</a></li>
</ul>
</div>
</li>
<li><a href="../../auto_examples/index.html">Examples</a></li>
</ul>
<a href="javascript:void(0);" onclick="showMenu()">
<div class="nav-icon">
<div class="hamburger-line"></div>
<div class="hamburger-line"></div>
<div class="hamburger-line"></div>
</div>
</a>
<div class="search_form">
<div class="gcse-search" id="cse" style="width: 100%;"></div>
</div>
</div> <!-- end navbar --></div>
</div>
<!-- GitHub "fork me" ribbon -->
<a href="https://github.com/scikit-learn/scikit-learn">
<img class="fork-me"
style="position: absolute; top: 0; right: 0; border: 0;"
src="../../_static/img/forkme.png"
alt="Fork me on GitHub" />
</a>
<div class="content-wrapper">
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<div class="rel">
<div class="rellink">
<a href="sklearn.datasets.fetch_covtype.html"
accesskey="P">Previous
<br/>
<span class="smallrellink">
sklearn.datas...
</span>
<span class="hiddenrellink">
sklearn.datasets.fetch_covtype
</span>
</a>
</div>
<div class="spacer">
</div>
<div class="rellink">
<a href="sklearn.datasets.fetch_lfw_pairs.html"
accesskey="N">Next
<br/>
<span class="smallrellink">
sklearn.datas...
</span>
<span class="hiddenrellink">
sklearn.datasets.fetch_lfw_pairs
</span>
</a>
</div>
<!-- Ad a link to the 'up' page -->
<div class="spacer">
</div>
<div class="rellink">
<a href="../classes.html">
Up
<br/>
<span class="smallrellink">
API Reference
</span>
<span class="hiddenrellink">
API Reference
</span>
</a>
</div>
</div>
<p class="doc-version"><b>scikit-learn v0.20.dev0</b><br/>
<a href="http://scikit-learn.org/stable/support.html#documentation-resources">Other versions</a></p>
<p class="citing">Please <b><a href="../../about.html#citing-scikit-learn" style="font-size: 110%;">cite us </a></b>if you use the software.</p>
<ul>
<li><a class="reference internal" href="#"><code class="docutils literal"><span class="pre">sklearn.datasets</span></code>.fetch_kddcup99</a></li>
</ul>
</div>
</div>
<input type="checkbox" id="nav-trigger" class="nav-trigger" checked />
<label for="nav-trigger"></label>
<div class="content">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="sklearn-datasets-fetch-kddcup99">
<h1><a class="reference internal" href="../classes.html#module-sklearn.datasets" title="sklearn.datasets"><code class="xref py py-mod docutils literal"><span class="pre">sklearn.datasets</span></code></a>.fetch_kddcup99<a class="headerlink" href="#sklearn-datasets-fetch-kddcup99" title="Permalink to this headline">¶</a></h1>
<dl class="function">
<dt id="sklearn.datasets.fetch_kddcup99">
<code class="descclassname">sklearn.datasets.</code><code class="descname">fetch_kddcup99</code><span class="sig-paren">(</span><em>subset=None</em>, <em>data_home=None</em>, <em>shuffle=False</em>, <em>random_state=None</em>, <em>percent10=True</em>, <em>download_if_missing=True</em>, <em>return_X_y=False</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/474b5e0/sklearn/datasets/kddcup99.py#L48"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.datasets.fetch_kddcup99" title="Permalink to this definition">¶</a></dt>
<dd><p>Load and return the kddcup 99 dataset (classification).</p>
<p>The KDD Cup ‘99 dataset was created by processing the tcpdump portions
of the 1998 DARPA Intrusion Detection System (IDS) Evaluation dataset,
created by MIT Lincoln Lab [1]. The artificial data was generated using
a closed network and hand-injected attacks to produce a large number of
different types of attack with normal activity in the background.
As the initial goal was to produce a large training set for supervised
learning algorithms, there is a large proportion (80.1%) of abnormal
data which is unrealistic in real world, and inappropriate for unsupervised
anomaly detection which aims at detecting ‘abnormal’ data, ie</p>
<ol class="arabic simple">
<li>qualitatively different from normal data.</li>
<li>in large minority among the observations.</li>
</ol>
<p>We thus transform the KDD Data set into two different data sets: SA and SF.</p>
<ul class="simple">
<li>SA is obtained by simply selecting all the normal data, and a small
proportion of abnormal data to gives an anomaly proportion of 1%.</li>
<li>SF is obtained as in [2]
by simply picking up the data whose attribute logged_in is positive, thus
focusing on the intrusion attack, which gives a proportion of 0.3% of
attack.</li>
<li>http and smtp are two subsets of SF corresponding with third feature
equal to ‘http’ (resp. to ‘smtp’)</li>
</ul>
<p>General KDD structure :</p>
<table border="1" class="docutils">
<colgroup>
<col width="28%" />
<col width="72%" />
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td>Samples total</td>
<td>4898431</td>
</tr>
<tr class="row-even"><td>Dimensionality</td>
<td>41</td>
</tr>
<tr class="row-odd"><td>Features</td>
<td>discrete (int) or continuous (float)</td>
</tr>
<tr class="row-even"><td>Targets</td>
<td>str, ‘normal.’ or name of the anomaly type</td>
</tr>
</tbody>
</table>
<p>SA structure :</p>
<table border="1" class="docutils">
<colgroup>
<col width="28%" />
<col width="72%" />
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td>Samples total</td>
<td>976158</td>
</tr>
<tr class="row-even"><td>Dimensionality</td>
<td>41</td>
</tr>
<tr class="row-odd"><td>Features</td>
<td>discrete (int) or continuous (float)</td>
</tr>
<tr class="row-even"><td>Targets</td>
<td>str, ‘normal.’ or name of the anomaly type</td>
</tr>
</tbody>
</table>
<p>SF structure :</p>
<table border="1" class="docutils">
<colgroup>
<col width="28%" />
<col width="72%" />
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td>Samples total</td>
<td>699691</td>
</tr>
<tr class="row-even"><td>Dimensionality</td>
<td>4</td>
</tr>
<tr class="row-odd"><td>Features</td>
<td>discrete (int) or continuous (float)</td>
</tr>
<tr class="row-even"><td>Targets</td>
<td>str, ‘normal.’ or name of the anomaly type</td>
</tr>
</tbody>
</table>
<p>http structure :</p>
<table border="1" class="docutils">
<colgroup>
<col width="28%" />
<col width="72%" />
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td>Samples total</td>
<td>619052</td>
</tr>
<tr class="row-even"><td>Dimensionality</td>
<td>3</td>
</tr>
<tr class="row-odd"><td>Features</td>
<td>discrete (int) or continuous (float)</td>
</tr>
<tr class="row-even"><td>Targets</td>
<td>str, ‘normal.’ or name of the anomaly type</td>
</tr>
</tbody>
</table>
<p>smtp structure :</p>
<table border="1" class="docutils">
<colgroup>
<col width="28%" />
<col width="72%" />
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td>Samples total</td>
<td>95373</td>
</tr>
<tr class="row-even"><td>Dimensionality</td>
<td>3</td>
</tr>
<tr class="row-odd"><td>Features</td>
<td>discrete (int) or continuous (float)</td>
</tr>
<tr class="row-even"><td>Targets</td>
<td>str, ‘normal.’ or name of the anomaly type</td>
</tr>
</tbody>
</table>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.18.</span></p>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>subset</strong> : None, ‘SA’, ‘SF’, ‘http’, ‘smtp’</p>
<blockquote>
<div><p>To return the corresponding classical subsets of kddcup 99.
If None, return the entire kddcup 99 dataset.</p>
</div></blockquote>
<p><strong>data_home</strong> : string, optional</p>
<blockquote>
<div><p>Specify another download and cache folder for the datasets. By default
all scikit-learn data is stored in ‘~/scikit_learn_data’ subfolders.
.. versionadded:: 0.19</p>
</div></blockquote>
<p><strong>shuffle</strong> : bool, default=False</p>
<blockquote>
<div><p>Whether to shuffle dataset.</p>
</div></blockquote>
<p><strong>random_state</strong> : int, RandomState instance or None (default)</p>
<blockquote>
<div><p>Determines random number generation for dataset shuffling and for
selection of abnormal samples if <cite>subset=’SA’</cite>. Pass an int for
reproducible output across multiple function calls.
See <a class="reference internal" href="../../glossary.html#term-random-state"><span class="xref std std-term">Glossary</span></a>.</p>
</div></blockquote>
<p><strong>percent10</strong> : bool, default=True</p>
<blockquote>
<div><p>Whether to load only 10 percent of the data.</p>
</div></blockquote>
<p><strong>download_if_missing</strong> : bool, default=True</p>
<blockquote>
<div><p>If False, raise a IOError if the data is not locally available
instead of trying to download the data from the source site.</p>
</div></blockquote>
<p><strong>return_X_y</strong> : boolean, default=False.</p>
<blockquote>
<div><p>If True, returns <code class="docutils literal"><span class="pre">(data,</span> <span class="pre">target)</span></code> instead of a Bunch object. See
below for more information about the <cite>data</cite> and <cite>target</cite> object.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.20.</span></p>
</div>
</div></blockquote>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>data</strong> : Bunch</p>
<blockquote>
<div><p>Dictionary-like object, the interesting attributes are:
‘data’, the data to learn and ‘target’, the regression target for each
sample.</p>
</div></blockquote>
<p><strong>(data, target)</strong> : tuple if <code class="docutils literal"><span class="pre">return_X_y</span></code> is True</p>
<blockquote class="last">
<div><div class="versionadded">
<p><span class="versionmodified">New in version 0.20.</span></p>
</div>
</div></blockquote>
</td>
</tr>
</tbody>
</table>
<p class="rubric">References</p>
<table class="docutils citation" frame="void" id="r339340" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id1">[R339340]</a></td><td>Analysis and Results of the 1999 DARPA Off-Line Intrusion
Detection Evaluation Richard Lippmann, Joshua W. Haines,
David J. Fried, Jonathan Korba, Kumar Das</td></tr>
</tbody>
</table>
<table class="docutils citation" frame="void" id="r340340" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id2">[R340340]</a></td><td>K. Yamanishi, J.-I. Takeuchi, G. Williams, and P. Milne. Online
unsupervised outlier detection using finite mixtures with
discounting learning algorithms. In Proceedings of the sixth
ACM SIGKDD international conference on Knowledge discovery
and data mining, pages 320-324. ACM Press, 2000.</td></tr>
</tbody>
</table>
</dd></dl>
<div class="clearer"></div></div>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
</div>
<div class="footer">
© 2007 - 2018, scikit-learn developers (BSD License).
<a href="../../_sources/modules/generated/sklearn.datasets.fetch_kddcup99.rst.txt" rel="nofollow">Show this page source</a>
</div>
<div class="rel">
<div class="buttonPrevious">
<a href="sklearn.datasets.fetch_covtype.html">Previous
</a>
</div>
<div class="buttonNext">
<a href="sklearn.datasets.fetch_lfw_pairs.html">Next
</a>
</div>
</div>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-22606712-2']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<script>
(function() {
var cx = '016639176250731907682:tjtqbvtvij0';
var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true;
gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s);
})();
</script>
</body>
</html>