{"id":732,"date":"2017-03-12T12:11:00","date_gmt":"2017-03-12T12:11:00","guid":{"rendered":"http:\/\/www.kelp-ml.org\/?page_id=732"},"modified":"2017-03-13T15:30:22","modified_gmt":"2017-03-13T15:30:22","slug":"kernel-compositions","status":"publish","type":"page","link":"http:\/\/www.kelp-ml.org\/?page_id=732","title":{"rendered":"Kernel Compositions"},"content":{"rendered":"<p><a href=\"http:\/\/www.kelp-ml.org\/kelp-javadoc\/current-version\/it\/uniroma2\/sag\/kelp\/kernel\/KernelComposition.html\">KernelComposition<\/a>s\u00a0operate enriching the\u00a0computation of another kernel. Details on these popular kernels can be found in (Shawe-Taylor and Cristianini, 2004).<\/p>\n<hr \/>\n<h3>Polynomial Kernel<\/h3>\n<p><strong>Java class<\/strong>: <a href=\"http:\/\/www.kelp-ml.org\/kelp-javadoc\/current-version\/it\/uniroma2\/sag\/kelp\/kernel\/standard\/PolynomialKernel.html\">PolynomialKernel<\/a><\/p>\n<p><strong>Source code<\/strong>: <a href=\"https:\/\/github.com\/SAG-KeLP\/kelp-core\/blob\/master\/src\/main\/java\/it\/uniroma2\/sag\/kelp\/kernel\/standard\/PolynomialKernel.java\" target=\"_blank\">PolynomialKernel.java<\/a><\/p>\n<p><strong>Maven Project<\/strong>: <a href=\"https:\/\/github.com\/SAG-KeLP\/kelp-core\">kelp-core<\/a><\/p>\n<p><strong>JSON type<\/strong>:\u00a0poly<\/p>\n<p><strong>Description<\/strong>: it\u00a0implicitly works in a features space where all the polynomials of the original features are available. As an example, a <img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.kelp-ml.org\/wp-content\/ql-cache\/quicklatex.com-9980056f03e6bbf28811681e26353914_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#50;&#94;&#123;&#110;&#100;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"15\" width=\"25\" style=\"vertical-align: 0px;\"\/> degree polynomial kernel applied over a linear kernel on\u00a0vector representations will automatically consider pairs of features in its similarity evaluation. Given a base kernel <em>K<\/em>, \u00a0the\u00a0<a href=\"http:\/\/www.kelp-ml.org\/kelp-javadoc\/current-version\/it\/uniroma2\/sag\/kelp\/kernel\/standard\/PolynomialKernel.html\">PolynomialKernel<\/a> applies the following\u00a0formula:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.kelp-ml.org\/wp-content\/ql-cache\/quicklatex.com-57509d0f8a877348502421921223f96c_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#40;&#112;&#111;&#108;&#121;&#95;&#75;&#40;&#120;&#44;&#121;&#41;&#61;&#92;&#98;&#105;&#103;&#32;&#40;&#32;&#97;&#75;&#40;&#120;&#44;&#121;&#41;&#43;&#98;&#32;&#92;&#98;&#105;&#103;&#32;&#41;&#32;&#94;&#100;&#92;&#41;&#32;\" title=\"Rendered by QuickLaTeX.com\" height=\"26\" width=\"231\" style=\"vertical-align: -7px;\"\/><\/p>\n<p>where\u00a0<img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.kelp-ml.org\/wp-content\/ql-cache\/quicklatex.com-d3882ad7682ea2ab89dbf5201930e7b3_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#100;&#44;&#32;&#97;&#44;&#32;&#98;\" title=\"Rendered by QuickLaTeX.com\" height=\"17\" width=\"42\" style=\"vertical-align: -4px;\"\/> are kernel parameters. Common values are\u00a0<img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.kelp-ml.org\/wp-content\/ql-cache\/quicklatex.com-90899c4debe310841a2f67893781f68c_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#100;&#61;&#50;\" title=\"Rendered by QuickLaTeX.com\" height=\"13\" width=\"41\" style=\"vertical-align: 0px;\"\/>,\u00a0<img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.kelp-ml.org\/wp-content\/ql-cache\/quicklatex.com-44db0db81bdc2def0aa21b7e350d2324_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#97;&#61;&#49;\" title=\"Rendered by QuickLaTeX.com\" height=\"13\" width=\"41\" style=\"vertical-align: -1px;\"\/> and\u00a0<img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.kelp-ml.org\/wp-content\/ql-cache\/quicklatex.com-597ae6c01abdebf6816c77f3ce1fd9de_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#98;&#61;&#48;\" title=\"Rendered by QuickLaTeX.com\" height=\"13\" width=\"40\" style=\"vertical-align: 0px;\"\/>.<\/p>\n<p><strong>Parameters<\/strong>:<\/p>\n<ul>\n<li><em>baseKernel<\/em>: the\u00a0base kernel whose output is enriched by this\u00a0kernel<\/li>\n<li><em>a<\/em>: the coefficient <em>a<\/em> in the formula above<\/li>\n<li><em>b<\/em>: the coefficient <em>b<\/em> in the formula above<\/li>\n<li><em>degree<\/em>: the degree <em>d<\/em> of the formula above<\/li>\n<\/ul>\n<hr \/>\n<h3>Radial Basis Function\u00a0Kernel<\/h3>\n<p><strong>Java class<\/strong>: <a href=\"http:\/\/www.kelp-ml.org\/kelp-javadoc\/current-version\/it\/uniroma2\/sag\/kelp\/kernel\/standard\/RbfKernel.html\">RbfKernel<\/a><\/p>\n<p><strong>Source code<\/strong>: <a href=\"https:\/\/github.com\/SAG-KeLP\/kelp-core\/blob\/master\/src\/main\/java\/it\/uniroma2\/sag\/kelp\/kernel\/standard\/RbfKernel.java\" target=\"_blank\">RbfKernel.java<\/a><\/p>\n<p><strong>Maven Project<\/strong>: <a href=\"https:\/\/github.com\/SAG-KeLP\/kelp-core\">kelp-core<\/a><\/p>\n<p><strong>JSON type<\/strong>:\u00a0rbf<\/p>\n<p><strong>Description<\/strong>: the Radial Basis Function (RBF) Kernel, a.k.a. Gaussian Kernel, enriches another kernel according to the following formula<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.kelp-ml.org\/wp-content\/ql-cache\/quicklatex.com-94e0be71697a6b2270aa722ce53db044_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#82;&#66;&#70;&#95;&#75;&#40;&#120;&#44;&#121;&#41;&#32;&#61;&#32;&#101;&#94;&#123;&#45;&#92;&#103;&#97;&#109;&#109;&#97;&#32;&#32;&#92;&#108;&#101;&#102;&#116;&#32;&#92;&#108;&#86;&#101;&#114;&#116;&#32;&#120;&#45;&#121;&#32;&#92;&#114;&#105;&#103;&#104;&#116;&#32;&#92;&#114;&#86;&#101;&#114;&#116;&#95;&#123;&#92;&#109;&#97;&#116;&#104;&#99;&#97;&#108;&#123;&#72;&#125;&#95;&#75;&#125;&#32;&#94;&#50;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"25\" width=\"204\" style=\"vertical-align: -4px;\"\/><\/p>\n<p>where:<img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.kelp-ml.org\/wp-content\/ql-cache\/quicklatex.com-66a12293e5adb7ef09eb4a308f5414fa_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#108;&#101;&#102;&#116;&#92;&#108;&#86;&#101;&#114;&#116;&#32;&#97;&#32;&#92;&#114;&#105;&#103;&#104;&#116;&#92;&#114;&#86;&#101;&#114;&#116;&#95;&#123;&#92;&#109;&#97;&#116;&#104;&#99;&#97;&#108;&#123;&#72;&#125;&#95;&#75;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"21\" width=\"47\" style=\"vertical-align: -7px;\"\/> is the norm of <img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.kelp-ml.org\/wp-content\/ql-cache\/quicklatex.com-5c53d6ebabdbcfa4e107550ea60b1b19_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#97;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"9\" style=\"vertical-align: 0px;\"\/> in the kernel space <img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.kelp-ml.org\/wp-content\/ql-cache\/quicklatex.com-42d3cf5d308c38b9302bcd954e449dbb_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#123;&#92;&#109;&#97;&#116;&#104;&#99;&#97;&#108;&#123;&#72;&#125;&#95;&#75;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"15\" width=\"28\" style=\"vertical-align: -3px;\"\/> generated by a base kernel <img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.kelp-ml.org\/wp-content\/ql-cache\/quicklatex.com-ea9c87a513e4a72624155d392fae86e2_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#75;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"16\" style=\"vertical-align: 0px;\"\/>.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.kelp-ml.org\/wp-content\/ql-cache\/quicklatex.com-d3ecad389066804f9bfb5f24a5090869_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#108;&#101;&#102;&#116;&#92;&#108;&#86;&#101;&#114;&#116;&#32;&#120;&#45;&#121;&#32;&#92;&#114;&#105;&#103;&#104;&#116;&#92;&#114;&#86;&#101;&#114;&#116;&#95;&#123;&#92;&#109;&#97;&#116;&#104;&#99;&#97;&#108;&#123;&#72;&#125;&#95;&#75;&#125;&#32;&#94;&#50;\" title=\"Rendered by QuickLaTeX.com\" height=\"24\" width=\"79\" style=\"vertical-align: -7px;\"\/> can be computed as <img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.kelp-ml.org\/wp-content\/ql-cache\/quicklatex.com-69cf94ac3c1047b1feacf5099168c861_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#108;&#101;&#102;&#116;&#92;&#108;&#86;&#101;&#114;&#116;&#32;&#120;&#45;&#121;&#32;&#92;&#114;&#105;&#103;&#104;&#116;&#92;&#114;&#86;&#101;&#114;&#116;&#95;&#123;&#92;&#109;&#97;&#116;&#104;&#99;&#97;&#108;&#123;&#72;&#125;&#95;&#75;&#125;&#32;&#94;&#50;&#32;&#61;&#32;&#92;&#108;&#101;&#102;&#116;&#92;&#108;&#86;&#101;&#114;&#116;&#32;&#120;&#32;&#92;&#114;&#105;&#103;&#104;&#116;&#92;&#114;&#86;&#101;&#114;&#116;&#95;&#123;&#92;&#109;&#97;&#116;&#104;&#99;&#97;&#108;&#123;&#72;&#125;&#95;&#75;&#125;&#32;&#94;&#50;&#32;&#43;&#32;&#92;&#108;&#101;&#102;&#116;&#92;&#108;&#86;&#101;&#114;&#116;&#32;&#121;&#32;&#92;&#114;&#105;&#103;&#104;&#116;&#92;&#114;&#86;&#101;&#114;&#116;&#95;&#123;&#92;&#109;&#97;&#116;&#104;&#99;&#97;&#108;&#123;&#72;&#125;&#95;&#75;&#125;&#32;&#94;&#50;&#32;&#45;&#32;&#50;&#75;&#40;&#120;&#44;&#121;&#41;&#32;&#61;&#32;&#75;&#40;&#120;&#44;&#120;&#41;&#32;&#43;&#32;&#75;&#40;&#121;&#44;&#121;&#41;&#32;&#45;&#32;&#50;&#75;&#40;&#120;&#44;&#121;&#41;\" title=\"Rendered by QuickLaTeX.com\" height=\"24\" width=\"564\" style=\"vertical-align: -7px;\"\/>. This allows to apply the RBF operation to any kernel base kernel <em>K. <\/em>It depends on a width\u00a0 parameter\u00a0<img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.kelp-ml.org\/wp-content\/ql-cache\/quicklatex.com-4de02fc502ed5dbd15f371728ea270a3_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#103;&#97;&#109;&#109;&#97;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"10\" style=\"vertical-align: -4px;\"\/> which regulates how fast the\u00a0<a href=\"http:\/\/www.kelp-ml.org\/kelp-javadoc\/current-version\/it\/uniroma2\/sag\/kelp\/kernel\/standard\/RbfKernel.html\">RbfKernel<\/a>\u00a0similarity decays w.r.t. the distance of the input objects in<img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.kelp-ml.org\/wp-content\/ql-cache\/quicklatex.com-42d3cf5d308c38b9302bcd954e449dbb_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#123;&#92;&#109;&#97;&#116;&#104;&#99;&#97;&#108;&#123;&#72;&#125;&#95;&#75;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"15\" width=\"28\" style=\"vertical-align: -3px;\"\/>. It can be proven that the Gaussian Kernel produces an infinite dimensional RKHS.<\/p>\n<p><strong>Parameters<\/strong>:<\/p>\n<ul>\n<li><em>baseKernel<\/em>: the\u00a0base kernel whose output is enriched by this\u00a0kernel<\/li>\n<li><em>gamma<\/em>: the gamma parameter in the formula above<\/li>\n<\/ul>\n<hr \/>\n<h3>Normalization\u00a0Kernel<\/h3>\n<p><strong>Java class<\/strong>: <a href=\"http:\/\/www.kelp-ml.org\/kelp-javadoc\/current-version\/it\/uniroma2\/sag\/kelp\/kernel\/standard\/NormalizationKernel.html\">NormalizationKernel<\/a><\/p>\n<p><strong>Source code<\/strong>: <a href=\"https:\/\/github.com\/SAG-KeLP\/kelp-core\/blob\/master\/src\/main\/java\/it\/uniroma2\/sag\/kelp\/kernel\/standard\/NormalizationKernel.java\" target=\"_blank\">NormalizationKernel.java<\/a><\/p>\n<p><strong>Maven Project<\/strong>: <a href=\"https:\/\/github.com\/SAG-KeLP\/kelp-core\">kelp-core<\/a><\/p>\n<p><strong>JSON type<\/strong>:\u00a0norm<\/p>\n<p><strong>Description<\/strong>: it normalizes another kernel <em>K<\/em> according to the following formula:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.kelp-ml.org\/wp-content\/ql-cache\/quicklatex.com-d74727203f95114555984846fae8ef9c_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#78;&#95;&#123;&#75;&#125;&#40;&#120;&#44;&#121;&#41;&#32;&#61;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#75;&#40;&#120;&#44;&#121;&#41;&#125;&#123;&#92;&#115;&#113;&#114;&#116;&#123;&#75;&#40;&#120;&#44;&#120;&#41;&#75;&#40;&#121;&#44;&#121;&#41;&#125;&#125;&#32;&#61;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#92;&#112;&#104;&#105;&#40;&#120;&#41;&#92;&#99;&#100;&#111;&#116;&#32;&#92;&#112;&#104;&#105;&#40;&#121;&#41;&#125;&#123;&#92;&#115;&#113;&#114;&#116;&#123;&#32;&#92;&#108;&#101;&#102;&#116;&#32;&#92;&#124;&#32;&#92;&#112;&#104;&#105;&#40;&#120;&#41;&#32;&#92;&#114;&#105;&#103;&#104;&#116;&#32;&#92;&#124;&#94;&#50;&#32;&#92;&#108;&#101;&#102;&#116;&#32;&#92;&#124;&#32;&#92;&#112;&#104;&#105;&#40;&#121;&#41;&#32;&#92;&#114;&#105;&#103;&#104;&#116;&#32;&#92;&#124;&#94;&#50;&#125;&#125;&#32;&#61;&#32;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#92;&#112;&#104;&#105;&#40;&#120;&#41;&#125;&#123;&#92;&#108;&#101;&#102;&#116;&#32;&#92;&#124;&#32;&#92;&#112;&#104;&#105;&#40;&#120;&#41;&#32;&#92;&#114;&#105;&#103;&#104;&#116;&#32;&#92;&#124;&#125;&#32;&#92;&#99;&#100;&#111;&#116;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#92;&#112;&#104;&#105;&#40;&#121;&#41;&#125;&#123;&#92;&#108;&#101;&#102;&#116;&#32;&#92;&#124;&#32;&#92;&#112;&#104;&#105;&#40;&#121;&#41;&#32;&#92;&#114;&#105;&#103;&#104;&#116;&#32;&#92;&#124;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"35\" width=\"454\" style=\"vertical-align: -15px;\"\/><\/p>\n<p>where <img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.kelp-ml.org\/wp-content\/ql-cache\/quicklatex.com-006bb587ec9036c2bc1773ffca785be7_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#112;&#104;&#105;&#40;&#92;&#99;&#100;&#111;&#116;&#41;\" title=\"Rendered by QuickLaTeX.com\" height=\"18\" width=\"29\" style=\"vertical-align: -4px;\"\/> is the implicit projection function operated by the kernel <em>K<\/em>. The normalization operation corresponds to a dot product in the RKHS of the normalized projections of the input instances. When <em>K<\/em>\u00a0is <a href=\"http:\/\/www.kelp-ml.org\/kelp-javadoc\/current-version\/it\/uniroma2\/sag\/kelp\/kernel\/vector\/LinearKernel.html\">LinearKernel<\/a><strong>\u00a0<\/strong>on two vectors, the\u00a0<a href=\"http:\/\/www.kelp-ml.org\/kelp-javadoc\/current-version\/it\/uniroma2\/sag\/kelp\/kernel\/standard\/NormalizationKernel.html\">NormalizationKernel<\/a>\u00a0equals to the cosine similarity between the two vectors. The normalization operation is required when the instances to be compared are very different in size, in order to avoid that large instances (for instance long texts) are associated with larger similarities. For instance it is usually applied to tree kernels, in order properly compare trees having very different sizes.<\/p>\n<p><strong>Parameters<\/strong>:<\/p>\n<ul>\n<li><em>baseKernel<\/em>: the\u00a0base kernel whose output is enriched by this\u00a0kernel<\/li>\n<\/ul>\n<hr \/>\n<h3>References<\/h3>\n<p>John Shawe-Taylor and Nello Cristianini.\u00a0<em>Kernel Methods for Pattern Analysis<\/em>. Cambridge University Press, New York, NY, USA, 2004. ISBN 0521813972.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>KernelCompositions\u00a0operate enriching the\u00a0computation of another kernel. Details on these popular kernels can be found in (Shawe-Taylor and Cristianini, 2004). Polynomial Kernel Java class: PolynomialKernel Source code: PolynomialKernel.java Maven Project: kelp-core JSON type:\u00a0poly Description: it\u00a0implicitly works in a features space where all the polynomials of the original features are available. As an example, a degree polynomial <a href=\"http:\/\/www.kelp-ml.org\/?page_id=732\" rel=\"nofollow\"><span class=\"sr-only\">Read more about Kernel Compositions<\/span>[&hellip;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"http:\/\/www.kelp-ml.org\/index.php?rest_route=\/wp\/v2\/pages\/732"}],"collection":[{"href":"http:\/\/www.kelp-ml.org\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/www.kelp-ml.org\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/www.kelp-ml.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.kelp-ml.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=732"}],"version-history":[{"count":6,"href":"http:\/\/www.kelp-ml.org\/index.php?rest_route=\/wp\/v2\/pages\/732\/revisions"}],"predecessor-version":[{"id":772,"href":"http:\/\/www.kelp-ml.org\/index.php?rest_route=\/wp\/v2\/pages\/732\/revisions\/772"}],"wp:attachment":[{"href":"http:\/\/www.kelp-ml.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=732"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}