forked from fastai/fastai
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tabular.models.html
63 lines (44 loc) · 4.31 KB
/
tabular.models.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
---
title: tabular.models
keywords: fastai
sidebar: home_sidebar
summary: "Model for training tabular/structured data"
---
<!--
#################################################
### THIS FILE WAS AUTOGENERATED! DO NOT EDIT! ###
#################################################
# file to edit: docs_src/tabular.models.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="Simple-model-for-tabular-data">Simple model for tabular data<a class="anchor-link" href="#Simple-model-for-tabular-data">¶</a></h2>
</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="TabularModel" class="doc_header"><code>class</code> <code>TabularModel</code><a href="https://github.com/fastai/fastai/blob/master/fastai/tabular/models.py#L9" class="source_link" style="float:right">[source]</a><a class="source_link" data-toggle="collapse" data-target="#TabularModel-pytest" style="float:right; padding-right:10px">[test]</a></h2><blockquote><p><code>TabularModel</code>(<strong><code>emb_szs</code></strong>:<code>ListSizes</code>, <strong><code>n_cont</code></strong>:<code>int</code>, <strong><code>out_sz</code></strong>:<code>int</code>, <strong><code>layers</code></strong>:<code>Collection</code>[<code>int</code>], <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>bn_final</code></strong>:<code>bool</code>=<strong><em><code>False</code></em></strong>) :: <a href="/core.html#PrePostInitMeta"><code>PrePostInitMeta</code></a> :: <a href="/torch_core.html#Module"><code>Module</code></a></p>
</blockquote>
<div class="collapse" id="TabularModel-pytest"><div class="card card-body pytest_card"><a type="button" data-toggle="collapse" data-target="#TabularModel-pytest" class="close" aria-label="Close"><span aria-hidden="true">×</span></a><p>No tests found for <code>TabularModel</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>Basic model 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><code>emb_szs</code> match each categorical variable size with an embedding size, <code>n_cont</code> is the number of continuous variables. The model consists of <code>Embedding</code> layers for the categorical variables, followed by a <code>Dropout</code> of <code>emb_drop</code>, and a <code>BatchNorm</code> for the continuous variables. The results are concatenated and followed by blocks of <code>BatchNorm</code>, <code>Dropout</code>, <code>Linear</code> and <code>ReLU</code> (the first block skips <code>BatchNorm</code> and <code>Dropout</code>, the last block skips the <code>ReLU</code>).</p>
<p>The sizes of the blocks are given in <a href="/layers.html#layers"><code>layers</code></a> and the probabilities of the <code>Dropout</code> in <code>ps</code>. The last size is <code>out_sz</code>, and we add a last activation that is a sigmoid rescaled to cover <code>y_range</code> (if it's not <code>None</code>). Lastly, if <code>use_bn</code> is set to False, all <code>BatchNorm</code> layers are skipped except the one applied to the continuous variables.</p>
<p>Generally it's easiest to just create a learner with <a href="/tabular.data.html#tabular_learner"><code>tabular_learner</code></a>, which will automatically create a <a href="/tabular.models.html#TabularModel"><code>TabularModel</code></a> for you.</p>
</div>
</div>
</div>
</div>