This is an automated email from the ASF dual-hosted git repository.
myui pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/incubator-hivemall-site.git
The following commit(s) were added to refs/heads/asf-site by this push:
new c9f3745 Revised bagging entry
c9f3745 is described below
commit c9f3745da45dfdf4964978f25c023b3b08de2943
Author: Makoto Yui <[email protected]>
AuthorDate: Thu Aug 27 18:08:33 2020 +0900
Revised bagging entry
---
userguide/binaryclass/news20_generic_bagging.html | 30 +++++++++--------------
1 file changed, 11 insertions(+), 19 deletions(-)
diff --git a/userguide/binaryclass/news20_generic_bagging.html
b/userguide/binaryclass/news20_generic_bagging.html
index 0f8cd90..f9ddc4f 100644
--- a/userguide/binaryclass/news20_generic_bagging.html
+++ b/userguide/binaryclass/news20_generic_bagging.html
@@ -2410,23 +2410,13 @@ In this tutorial, we show how to apply bagging (i.e.,
prediction ensemble) for m
) <span class="hljs-keyword">as</span> (feature,weight)
<span class="hljs-keyword">from</span>
news20b_train_x3
-),
-models <span class="hljs-keyword">as</span> (
- <span class="hljs-keyword">select</span>
- taskid() <span class="hljs-keyword">as</span> modelid,
- feature,
- weight
- <span class="hljs-keyword">from</span>
- train
)
<span class="hljs-keyword">select</span>
- modelid,
+ taskid() <span class="hljs-keyword">as</span> modelid,
feature,
- voted_avg(weight) <span class="hljs-keyword">as</span> weight <span
class="hljs-comment">-- or simply avg(weight)</span>
-<span class="hljs-keyword">from</span>
- models
-<span class="hljs-keyword">group</span> <span class="hljs-keyword">by</span>
- modelid, feature;
+ weight
+<span class="hljs-keyword">from</span>
+ train;
</code></pre>
<h2 id="prediction">prediction</h2>
<pre><code class="lang-sql"><span class="hljs-keyword">create</span> <span
class="hljs-keyword">table</span> bagging_predict
@@ -2443,7 +2433,7 @@ models <span class="hljs-keyword">as</span> (
<span class="hljs-keyword">group</span> <span class="hljs-keyword">by</span>
<span class="hljs-keyword">rowid</span>, modelid
),
-voted <span class="hljs-keyword">as</span> (
+bagging <span class="hljs-keyword">as</span> (
<span class="hljs-keyword">select</span>
<span class="hljs-keyword">rowid</span>,
voted_avg(total_weight) <span class="hljs-keyword">as</span> total_weight
@@ -2454,10 +2444,12 @@ voted <span class="hljs-keyword">as</span> (
)
<span class="hljs-keyword">select</span>
<span class="hljs-keyword">rowid</span>,
- <span class="hljs-keyword">max</span>(total_weight) <span
class="hljs-keyword">as</span> total_weight, <span class="hljs-comment">-- max
is dummy </span>
- <span class="hljs-keyword">case</span> <span
class="hljs-keyword">when</span> <span
class="hljs-keyword">sum</span>(total_weight) > <span
class="hljs-number">0.0</span> <span class="hljs-keyword">then</span> <span
class="hljs-number">1</span> <span class="hljs-keyword">else</span> <span
class="hljs-number">-1</span> <span class="hljs-keyword">end</span> <span
class="hljs-keyword">as</span> label
+ total_weight,
+ <span class="hljs-comment">-- <span class="hljs-doctag">Note:</span>
sum(total_weight) > 0.0 equals to sigmoid(total_weight) > 0.5</span>
+ <span class="hljs-comment">--
https://en.wikipedia.org/wiki/Sigmoid_function</span>
+ <span class="hljs-keyword">case</span> <span
class="hljs-keyword">when</span> total_weight > <span
class="hljs-number">0.0</span> <span class="hljs-keyword">then</span> <span
class="hljs-number">1</span> <span class="hljs-keyword">else</span> <span
class="hljs-number">-1</span> <span class="hljs-keyword">end</span> <span
class="hljs-keyword">as</span> label
<span class="hljs-keyword">from</span>
- voted
+ bagging
<span class="hljs-keyword">group</span> <span class="hljs-keyword">by</span>
<span class="hljs-keyword">rowid</span>;
</code></pre>
@@ -2533,7 +2525,7 @@ Apache Hivemall is an effort undergoing incubation at The
Apache Software Founda
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
- gitbook.page.hasChanged({"page":{"title":"Baggnig
classiers","level":"6.3.5","depth":2,"next":{"title":"AdaGradRDA, AdaGrad,
AdaDelta","level":"6.3.6","depth":2,"path":"binaryclass/news20_adagrad.md","ref":"binaryclass/news20_adagrad.md","articles":[]},"previous":{"title":"General
Binary
Classifier","level":"6.3.4","depth":2,"path":"binaryclass/news20_generic.md","ref":"binaryclass/news20_generic.md","articles":[]},"dir":"ltr"},"config":{"plugins":["theme-api","edit-link","gi
[...]
+ gitbook.page.hasChanged({"page":{"title":"Baggnig
classiers","level":"6.3.5","depth":2,"next":{"title":"AdaGradRDA, AdaGrad,
AdaDelta","level":"6.3.6","depth":2,"path":"binaryclass/news20_adagrad.md","ref":"binaryclass/news20_adagrad.md","articles":[]},"previous":{"title":"General
Binary
Classifier","level":"6.3.4","depth":2,"path":"binaryclass/news20_generic.md","ref":"binaryclass/news20_generic.md","articles":[]},"dir":"ltr"},"config":{"plugins":["theme-api","edit-link","gi
[...]
});
</script>
</div>