forked from fastai/fastai
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tabular.data.html
494 lines (379 loc) · 29.7 KB
/
tabular.data.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
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
---
title: tabular.data
keywords: fastai
sidebar: home_sidebar
summary: "Base class to deal with tabular data and get a DataBunch"
---
<!--
#################################################
### THIS FILE WAS AUTOGENERATED! DO NOT EDIT! ###
#################################################
# file to edit: docs_src/tabular.data.ipynb
# instructions: https://docs.fast.ai/gen_doc_main.html
-->
<div class="container" id="notebook-container">
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h2 id="Tabular-data-handling">Tabular data handling<a class="anchor-link" href="#Tabular-data-handling">¶</a></h2>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>This module defines the main class to handle tabular data in the fastai library: <a href="/tabular.data.html#TabularDataBunch"><code>TabularDataBunch</code></a>. As always, there is also a helper function to quickly get your data.</p>
<p>To allow you to easily create a <a href="/basic_train.html#Learner"><code>Learner</code></a> for your data, it provides <a href="/tabular.data.html#tabular_learner"><code>tabular_learner</code></a>.</p>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_markdown rendered_html output_subarea ">
<h2 id="TabularDataBunch" class="doc_header"><code>class</code> <code>TabularDataBunch</code><a href="https://github.com/fastai/fastai/blob/master/fastai/tabular/data.py#L85" class="source_link" style="float:right">[source]</a><a class="source_link" data-toggle="collapse" data-target="#TabularDataBunch-pytest" style="float:right; padding-right:10px">[test]</a></h2><blockquote><p><code>TabularDataBunch</code>(<strong><code>train_dl</code></strong>:<a href="https://pytorch.org/docs/stable/data.html#torch.utils.data.DataLoader"><code>DataLoader</code></a>, <strong><code>valid_dl</code></strong>:<a href="https://pytorch.org/docs/stable/data.html#torch.utils.data.DataLoader"><code>DataLoader</code></a>, <strong><code>fix_dl</code></strong>:<a href="https://pytorch.org/docs/stable/data.html#torch.utils.data.DataLoader"><code>DataLoader</code></a>=<strong><em><code>None</code></em></strong>, <strong><code>test_dl</code></strong>:<code>Optional</code>[<a href="https://pytorch.org/docs/stable/data.html#torch.utils.data.DataLoader"><code>DataLoader</code></a>]=<strong><em><code>None</code></em></strong>, <strong><code>device</code></strong>:<a href="https://pytorch.org/docs/stable/tensor_attributes.html#torch-device"><code>device</code></a>=<strong><em><code>None</code></em></strong>, <strong><code>dl_tfms</code></strong>:<code>Optional</code>[<code>Collection</code>[<code>Callable</code>]]=<strong><em><code>None</code></em></strong>, <strong><code>path</code></strong>:<code>PathOrStr</code>=<strong><em><code>'.'</code></em></strong>, <strong><code>collate_fn</code></strong>:<code>Callable</code>=<strong><em><code>'data_collate'</code></em></strong>, <strong><code>no_check</code></strong>:<code>bool</code>=<strong><em><code>False</code></em></strong>) :: <a href="/basic_data.html#DataBunch"><code>DataBunch</code></a></p>
</blockquote>
<div class="collapse" id="TabularDataBunch-pytest"><div class="card card-body pytest_card"><a type="button" data-toggle="collapse" data-target="#TabularDataBunch-pytest" class="close" aria-label="Close"><span aria-hidden="true">×</span></a><p>No tests found for <code>TabularDataBunch</code>. To contribute a test please refer to <a href="/dev/test.html">this guide</a> and <a href="https://forums.fast.ai/t/improving-expanding-functional-tests/32929">this discussion</a>.</p></div></div><p>Create a <a href="/basic_data.html#DataBunch"><code>DataBunch</code></a> suitable for tabular data.</p>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>The best way to quickly get your data in a <a href="/basic_data.html#DataBunch"><code>DataBunch</code></a> suitable for tabular data is to organize it in two (or three) dataframes. One for training, one for validation, and if you have it, one for testing. Here we are interested in a subsample of the <a href="https://archive.ics.uci.edu/ml/datasets/adult">adult dataset</a>.</p>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">path</span> <span class="o">=</span> <span class="n">untar_data</span><span class="p">(</span><span class="n">URLs</span><span class="o">.</span><span class="n">ADULT_SAMPLE</span><span class="p">)</span>
<span class="n">df</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">read_csv</span><span class="p">(</span><span class="n">path</span><span class="o">/</span><span class="s1">'adult.csv'</span><span class="p">)</span>
<span class="n">valid_idx</span> <span class="o">=</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">df</span><span class="p">)</span><span class="o">-</span><span class="mi">2000</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">df</span><span class="p">))</span>
<span class="n">df</span><span class="o">.</span><span class="n">head</span><span class="p">()</span>
</pre></div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_html rendered_html output_subarea output_execute_result">
<div>
<style scoped>
.dataframe tbody tr th:only-of-type {
vertical-align: middle;
}
.dataframe tbody tr th {
vertical-align: top;
}
.dataframe thead th {
text-align: right;
}
</style>
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>age</th>
<th>workclass</th>
<th>fnlwgt</th>
<th>education</th>
<th>education-num</th>
<th>marital-status</th>
<th>occupation</th>
<th>relationship</th>
<th>race</th>
<th>sex</th>
<th>capital-gain</th>
<th>capital-loss</th>
<th>hours-per-week</th>
<th>native-country</th>
<th>salary</th>
</tr>
</thead>
<tbody>
<tr>
<th>0</th>
<td>49</td>
<td>Private</td>
<td>101320</td>
<td>Assoc-acdm</td>
<td>12.0</td>
<td>Married-civ-spouse</td>
<td>NaN</td>
<td>Wife</td>
<td>White</td>
<td>Female</td>
<td>0</td>
<td>1902</td>
<td>40</td>
<td>United-States</td>
<td>>=50k</td>
</tr>
<tr>
<th>1</th>
<td>44</td>
<td>Private</td>
<td>236746</td>
<td>Masters</td>
<td>14.0</td>
<td>Divorced</td>
<td>Exec-managerial</td>
<td>Not-in-family</td>
<td>White</td>
<td>Male</td>
<td>10520</td>
<td>0</td>
<td>45</td>
<td>United-States</td>
<td>>=50k</td>
</tr>
<tr>
<th>2</th>
<td>38</td>
<td>Private</td>
<td>96185</td>
<td>HS-grad</td>
<td>NaN</td>
<td>Divorced</td>
<td>NaN</td>
<td>Unmarried</td>
<td>Black</td>
<td>Female</td>
<td>0</td>
<td>0</td>
<td>32</td>
<td>United-States</td>
<td><50k</td>
</tr>
<tr>
<th>3</th>
<td>38</td>
<td>Self-emp-inc</td>
<td>112847</td>
<td>Prof-school</td>
<td>15.0</td>
<td>Married-civ-spouse</td>
<td>Prof-specialty</td>
<td>Husband</td>
<td>Asian-Pac-Islander</td>
<td>Male</td>
<td>0</td>
<td>0</td>
<td>40</td>
<td>United-States</td>
<td>>=50k</td>
</tr>
<tr>
<th>4</th>
<td>42</td>
<td>Self-emp-not-inc</td>
<td>82297</td>
<td>7th-8th</td>
<td>NaN</td>
<td>Married-civ-spouse</td>
<td>Other-service</td>
<td>Wife</td>
<td>Black</td>
<td>Female</td>
<td>0</td>
<td>0</td>
<td>50</td>
<td>United-States</td>
<td><50k</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">cat_names</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'workclass'</span><span class="p">,</span> <span class="s1">'education'</span><span class="p">,</span> <span class="s1">'marital-status'</span><span class="p">,</span> <span class="s1">'occupation'</span><span class="p">,</span> <span class="s1">'relationship'</span><span class="p">,</span> <span class="s1">'race'</span><span class="p">,</span> <span class="s1">'sex'</span><span class="p">,</span> <span class="s1">'native-country'</span><span class="p">]</span>
<span class="n">dep_var</span> <span class="o">=</span> <span class="s1">'salary'</span>
</pre></div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>The initialization of <a href="/tabular.data.html#TabularDataBunch"><code>TabularDataBunch</code></a> is the same as <a href="/basic_data.html#DataBunch"><code>DataBunch</code></a> so you really want to use the factory method instead.</p>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_markdown rendered_html output_subarea ">
<h4 id="TabularDataBunch.from_df" class="doc_header"><code>from_df</code><a href="https://github.com/fastai/fastai/blob/master/fastai/tabular/data.py#L87" class="source_link" style="float:right">[source]</a><a class="source_link" data-toggle="collapse" data-target="#TabularDataBunch-from_df-pytest" style="float:right; padding-right:10px">[test]</a></h4><blockquote><p><code>from_df</code>(<strong><code>path</code></strong>, <strong><code>df</code></strong>:<code>DataFrame</code>, <strong><code>dep_var</code></strong>:<code>str</code>, <strong><code>valid_idx</code></strong>:<code>Collection</code>[<code>int</code>], <strong><code>procs</code></strong>:<code>Optional</code>[<code>Collection</code>[<a href="/tabular.transform.html#TabularProc"><code>TabularProc</code></a>]]=<strong><em><code>None</code></em></strong>, <strong><code>cat_names</code></strong>:<code>OptStrList</code>=<strong><em><code>None</code></em></strong>, <strong><code>cont_names</code></strong>:<code>OptStrList</code>=<strong><em><code>None</code></em></strong>, <strong><code>classes</code></strong>:<code>Collection</code>[<code>T_co</code>]=<strong><em><code>None</code></em></strong>, <strong><code>test_df</code></strong>=<strong><em><code>None</code></em></strong>, <strong><code>bs</code></strong>:<code>int</code>=<strong><em><code>64</code></em></strong>, <strong><code>val_bs</code></strong>:<code>int</code>=<strong><em><code>None</code></em></strong>, <strong><code>num_workers</code></strong>:<code>int</code>=<strong><em><code>4</code></em></strong>, <strong><code>dl_tfms</code></strong>:<code>Optional</code>[<code>Collection</code>[<code>Callable</code>]]=<strong><em><code>None</code></em></strong>, <strong><code>device</code></strong>:<a href="https://pytorch.org/docs/stable/tensor_attributes.html#torch-device"><code>device</code></a>=<strong><em><code>None</code></em></strong>, <strong><code>collate_fn</code></strong>:<code>Callable</code>=<strong><em><code>'data_collate'</code></em></strong>, <strong><code>no_check</code></strong>:<code>bool</code>=<strong><em><code>False</code></em></strong>) → <a href="/basic_data.html#DataBunch"><code>DataBunch</code></a></p>
</blockquote>
<div class="collapse" id="TabularDataBunch-from_df-pytest"><div class="card card-body pytest_card"><a type="button" data-toggle="collapse" data-target="#TabularDataBunch-from_df-pytest" class="close" aria-label="Close"><span aria-hidden="true">×</span></a><p>Tests found for <code>from_df</code>:</p><p>Some other tests where <code>from_df</code> is used:</p><ul><li><code>pytest -sv tests/test_tabular_data.py::test_from_df</code> <a href="https://github.com/fastai/fastai/blob/master/tests/test_tabular_data.py#L5" class="source_link" style="float:right">[source]</a></li></ul><p>To run tests please refer to this <a href="/dev/test.html#quick-guide">guide</a>.</p></div></div><p>Create a <a href="/basic_data.html#DataBunch"><code>DataBunch</code></a> from <code>df</code> and <code>valid_idx</code> with <code>dep_var</code>. <code>kwargs</code> are passed to <a href="/basic_data.html#DataBunch.create"><code>DataBunch.create</code></a>.</p>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>Optionally, use <code>test_df</code> for the test set. The dependent variable is <code>dep_var</code>, while the categorical and continuous variables are in the <code>cat_names</code> columns and <code>cont_names</code> columns respectively. If <code>cont_names</code> is None then we assume all variables that aren't dependent or categorical are continuous. The <a href="/tabular.data.html#TabularProcessor"><code>TabularProcessor</code></a> in <code>procs</code> are applied to the dataframes as preprocessing, then the categories are replaced by their codes+1 (leaving 0 for <code>nan</code>) and the continuous variables are normalized.</p>
<p>Note that the <a href="/tabular.data.html#TabularProcessor"><code>TabularProcessor</code></a> should be passed as <code>Callable</code>: the actual initialization with <code>cat_names</code> and <code>cont_names</code> is done during the preprocessing.</p>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">procs</span> <span class="o">=</span> <span class="p">[</span><span class="n">FillMissing</span><span class="p">,</span> <span class="n">Categorify</span><span class="p">,</span> <span class="n">Normalize</span><span class="p">]</span>
<span class="n">data</span> <span class="o">=</span> <span class="n">TabularDataBunch</span><span class="o">.</span><span class="n">from_df</span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="n">df</span><span class="p">,</span> <span class="n">dep_var</span><span class="p">,</span> <span class="n">valid_idx</span><span class="o">=</span><span class="n">valid_idx</span><span class="p">,</span> <span class="n">procs</span><span class="o">=</span><span class="n">procs</span><span class="p">,</span> <span class="n">cat_names</span><span class="o">=</span><span class="n">cat_names</span><span class="p">)</span>
</pre></div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>You can then easily create a <a href="/basic_train.html#Learner"><code>Learner</code></a> for this data with <a href="/tabular.data.html#tabular_learner"><code>tabular_learner</code></a>.</p>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_markdown rendered_html output_subarea ">
<h4 id="tabular_learner" class="doc_header"><code>tabular_learner</code><a href="https://github.com/fastai/fastai/blob/master/fastai/tabular/data.py#L171" class="source_link" style="float:right">[source]</a><a class="source_link" data-toggle="collapse" data-target="#tabular_learner-pytest" style="float:right; padding-right:10px">[test]</a></h4><blockquote><p><code>tabular_learner</code>(<strong><code>data</code></strong>:<a href="/basic_data.html#DataBunch"><code>DataBunch</code></a>, <strong><code>layers</code></strong>:<code>Collection</code>[<code>int</code>], <strong><code>emb_szs</code></strong>:<code>Dict</code>[<code>str</code>, <code>int</code>]=<strong><em><code>None</code></em></strong>, <strong><code>metrics</code></strong>=<strong><em><code>None</code></em></strong>, <strong><code>ps</code></strong>:<code>Collection</code>[<code>float</code>]=<strong><em><code>None</code></em></strong>, <strong><code>emb_drop</code></strong>:<code>float</code>=<strong><em><code>0.0</code></em></strong>, <strong><code>y_range</code></strong>:<code>OptRange</code>=<strong><em><code>None</code></em></strong>, <strong><code>use_bn</code></strong>:<code>bool</code>=<strong><em><code>True</code></em></strong>, <strong>**<code>learn_kwargs</code></strong>)</p>
</blockquote>
<div class="collapse" id="tabular_learner-pytest"><div class="card card-body pytest_card"><a type="button" data-toggle="collapse" data-target="#tabular_learner-pytest" class="close" aria-label="Close"><span aria-hidden="true">×</span></a><p>No tests found for <code>tabular_learner</code>. To contribute a test please refer to <a href="/dev/test.html">this guide</a> and <a href="https://forums.fast.ai/t/improving-expanding-functional-tests/32929">this discussion</a>.</p></div></div><p>Get a <a href="/basic_train.html#Learner"><code>Learner</code></a> using <code>data</code>, with <code>metrics</code>, including a <a href="/tabular.models.html#TabularModel"><code>TabularModel</code></a> created using the remaining params.</p>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p><code>emb_szs</code> is a <code>dict</code> mapping categorical column names to embedding sizes; you only need to pass sizes for columns where you want to override the default behaviour of the model.</p>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_markdown rendered_html output_subarea ">
<h2 id="TabularList" class="doc_header"><code>class</code> <code>TabularList</code><a href="https://github.com/fastai/fastai/blob/master/fastai/tabular/data.py#L104" class="source_link" style="float:right">[source]</a><a class="source_link" data-toggle="collapse" data-target="#TabularList-pytest" style="float:right; padding-right:10px">[test]</a></h2><blockquote><p><code>TabularList</code>(<strong><code>items</code></strong>:<code>Iterator</code>[<code>T_co</code>], <strong><code>cat_names</code></strong>:<code>OptStrList</code>=<strong><em><code>None</code></em></strong>, <strong><code>cont_names</code></strong>:<code>OptStrList</code>=<strong><em><code>None</code></em></strong>, <strong><code>procs</code></strong>=<strong><em><code>None</code></em></strong>, <strong>**<code>kwargs</code></strong>) → <code>TabularList</code> :: <a href="/data_block.html#ItemList"><code>ItemList</code></a></p>
</blockquote>
<div class="collapse" id="TabularList-pytest"><div class="card card-body pytest_card"><a type="button" data-toggle="collapse" data-target="#TabularList-pytest" class="close" aria-label="Close"><span aria-hidden="true">×</span></a><p>Tests found for <code>TabularList</code>:</p><p>Some other tests where <code>TabularList</code> is used:</p><ul><li><code>pytest -sv tests/test_tabular_data.py::test_from_df</code> <a href="https://github.com/fastai/fastai/blob/master/tests/test_tabular_data.py#L5" class="source_link" style="float:right">[source]</a></li></ul><p>To run tests please refer to this <a href="/dev/test.html#quick-guide">guide</a>.</p></div></div><p>Basic <a href="/data_block.html#ItemList"><code>ItemList</code></a> for tabular data.</p>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>Basic class to create a list of inputs in <code>items</code> for tabular data. <code>cat_names</code> and <code>cont_names</code> are the names of the categorical and the continuous variables respectively. <code>processor</code> will be applied to the inputs or one will be created from the transforms in <code>procs</code>.</p>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_markdown rendered_html output_subarea ">
<h4 id="TabularList.from_df" class="doc_header"><code>from_df</code><a href="https://github.com/fastai/fastai/blob/master/fastai/tabular/data.py#L119" class="source_link" style="float:right">[source]</a><a class="source_link" data-toggle="collapse" data-target="#TabularList-from_df-pytest" style="float:right; padding-right:10px">[test]</a></h4><blockquote><p><code>from_df</code>(<strong><code>df</code></strong>:<code>DataFrame</code>, <strong><code>cat_names</code></strong>:<code>OptStrList</code>=<strong><em><code>None</code></em></strong>, <strong><code>cont_names</code></strong>:<code>OptStrList</code>=<strong><em><code>None</code></em></strong>, <strong><code>procs</code></strong>=<strong><em><code>None</code></em></strong>, <strong>**<code>kwargs</code></strong>) → <code>ItemList</code></p>
</blockquote>
<div class="collapse" id="TabularList-from_df-pytest"><div class="card card-body pytest_card"><a type="button" data-toggle="collapse" data-target="#TabularList-from_df-pytest" class="close" aria-label="Close"><span aria-hidden="true">×</span></a><p>Tests found for <code>from_df</code>:</p><ul><li><code>pytest -sv tests/test_tabular_data.py::test_from_df</code> <a href="https://github.com/fastai/fastai/blob/master/tests/test_tabular_data.py#L5" class="source_link" style="float:right">[source]</a></li></ul><p>To run tests please refer to this <a href="/dev/test.html#quick-guide">guide</a>.</p></div></div><p>Get the list of inputs in the <code>col</code> of <code>path/csv_name</code>.</p>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_markdown rendered_html output_subarea ">
<h4 id="TabularList.get_emb_szs" class="doc_header"><code>get_emb_szs</code><a href="https://github.com/fastai/fastai/blob/master/fastai/tabular/data.py#L130" class="source_link" style="float:right">[source]</a><a class="source_link" data-toggle="collapse" data-target="#TabularList-get_emb_szs-pytest" style="float:right; padding-right:10px">[test]</a></h4><blockquote><p><code>get_emb_szs</code>(<strong><code>sz_dict</code></strong>=<strong><em><code>None</code></em></strong>)</p>
</blockquote>
<div class="collapse" id="TabularList-get_emb_szs-pytest"><div class="card card-body pytest_card"><a type="button" data-toggle="collapse" data-target="#TabularList-get_emb_szs-pytest" class="close" aria-label="Close"><span aria-hidden="true">×</span></a><p>No tests found for <code>get_emb_szs</code>. To contribute a test please refer to <a href="/dev/test.html">this guide</a> and <a href="https://forums.fast.ai/t/improving-expanding-functional-tests/32929">this discussion</a>.</p></div></div><p>Return the default embedding sizes suitable for this data or takes the ones in <code>sz_dict</code>.</p>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_markdown rendered_html output_subarea ">
<h4 id="TabularList.show_xys" class="doc_header"><code>show_xys</code><a href="https://github.com/fastai/fastai/blob/master/fastai/tabular/data.py#L137" class="source_link" style="float:right">[source]</a><a class="source_link" data-toggle="collapse" data-target="#TabularList-show_xys-pytest" style="float:right; padding-right:10px">[test]</a></h4><blockquote><p><code>show_xys</code>(<strong><code>xs</code></strong>, <strong><code>ys</code></strong>)</p>
</blockquote>
<div class="collapse" id="TabularList-show_xys-pytest"><div class="card card-body pytest_card"><a type="button" data-toggle="collapse" data-target="#TabularList-show_xys-pytest" class="close" aria-label="Close"><span aria-hidden="true">×</span></a><p>No tests found for <code>show_xys</code>. To contribute a test please refer to <a href="/dev/test.html">this guide</a> and <a href="https://forums.fast.ai/t/improving-expanding-functional-tests/32929">this discussion</a>.</p></div></div><p>Show the <code>xs</code> (inputs) and <code>ys</code> (targets).</p>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_markdown rendered_html output_subarea ">
<h4 id="TabularList.show_xyzs" class="doc_header"><code>show_xyzs</code><a href="https://github.com/fastai/fastai/blob/master/fastai/tabular/data.py#L154" class="source_link" style="float:right">[source]</a><a class="source_link" data-toggle="collapse" data-target="#TabularList-show_xyzs-pytest" style="float:right; padding-right:10px">[test]</a></h4><blockquote><p><code>show_xyzs</code>(<strong><code>xs</code></strong>, <strong><code>ys</code></strong>, <strong><code>zs</code></strong>)</p>
</blockquote>
<div class="collapse" id="TabularList-show_xyzs-pytest"><div class="card card-body pytest_card"><a type="button" data-toggle="collapse" data-target="#TabularList-show_xyzs-pytest" class="close" aria-label="Close"><span aria-hidden="true">×</span></a><p>No tests found for <code>show_xyzs</code>. To contribute a test please refer to <a href="/dev/test.html">this guide</a> and <a href="https://forums.fast.ai/t/improving-expanding-functional-tests/32929">this discussion</a>.</p></div></div><p>Show <code>xs</code> (inputs), <code>ys</code> (targets) and <code>zs</code> (predictions).</p>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_markdown rendered_html output_subarea ">
<h2 id="TabularLine" class="doc_header"><code>class</code> <code>TabularLine</code><a href="https://github.com/fastai/fastai/blob/master/fastai/tabular/data.py#L24" class="source_link" style="float:right">[source]</a><a class="source_link" data-toggle="collapse" data-target="#TabularLine-pytest" style="float:right; padding-right:10px">[test]</a></h2><blockquote><p><code>TabularLine</code>(<strong><code>cats</code></strong>, <strong><code>conts</code></strong>, <strong><code>classes</code></strong>, <strong><code>names</code></strong>) :: <a href="/core.html#ItemBase"><code>ItemBase</code></a></p>
</blockquote>
<div class="collapse" id="TabularLine-pytest"><div class="card card-body pytest_card"><a type="button" data-toggle="collapse" data-target="#TabularLine-pytest" class="close" aria-label="Close"><span aria-hidden="true">×</span></a><p>No tests found for <code>TabularLine</code>. To contribute a test please refer to <a href="/dev/test.html">this guide</a> and <a href="https://forums.fast.ai/t/improving-expanding-functional-tests/32929">this discussion</a>.</p></div></div>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>An object that will contain the encoded <code>cats</code>, the continuous variables <code>conts</code>, the <code>classes</code> and the <code>names</code> of the columns. This is the basic input for a dataset dealing with tabular data.</p>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_markdown rendered_html output_subarea ">
<h2 id="TabularProcessor" class="doc_header"><code>class</code> <code>TabularProcessor</code><a href="https://github.com/fastai/fastai/blob/master/fastai/tabular/data.py#L38" class="source_link" style="float:right">[source]</a><a class="source_link" data-toggle="collapse" data-target="#TabularProcessor-pytest" style="float:right; padding-right:10px">[test]</a></h2><blockquote><p><code>TabularProcessor</code>(<strong><code>ds</code></strong>:<a href="/core.html#ItemBase"><code>ItemBase</code></a>=<strong><em><code>None</code></em></strong>, <strong><code>procs</code></strong>=<strong><em><code>None</code></em></strong>) :: <a href="/data_block.html#PreProcessor"><code>PreProcessor</code></a></p>
</blockquote>
<div class="collapse" id="TabularProcessor-pytest"><div class="card card-body pytest_card"><a type="button" data-toggle="collapse" data-target="#TabularProcessor-pytest" class="close" aria-label="Close"><span aria-hidden="true">×</span></a><p>No tests found for <code>TabularProcessor</code>. To contribute a test please refer to <a href="/dev/test.html">this guide</a> and <a href="https://forums.fast.ai/t/improving-expanding-functional-tests/32929">this discussion</a>.</p></div></div><p>Regroup the <code>procs</code> in one <a href="/data_block.html#PreProcessor"><code>PreProcessor</code></a>.</p>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>Create a <a href="/data_block.html#PreProcessor"><code>PreProcessor</code></a> from <code>procs</code>.</p>
</div>
</div>
</div>
</div>