{"id":183,"date":"2017-02-13T18:04:12","date_gmt":"2017-02-13T18:04:12","guid":{"rendered":"http:\/\/sag.art.uniroma2.it\/kelp_wordpress\/?page_id=183"},"modified":"2017-07-20T10:50:31","modified_gmt":"2017-07-20T10:50:31","slug":"data-structures","status":"publish","type":"page","link":"http:\/\/www.kelp-ml.org\/?page_id=183","title":{"rendered":"Data and Representations"},"content":{"rendered":"<p>In KeLP, a machine learning instance is modeled by the class <a href=\"http:\/\/www.kelp-ml.org\/kelp-javadoc\/current-version\/it\/uniroma2\/sag\/kelp\/data\/example\/Example.html\" target=\"_blank\">Example<\/a>. As illustrated in the Figure below,\u00a0there are three\u00a0implementations of such class:<\/p>\n<ul>\n<li><a href=\"http:\/\/www.kelp-ml.org\/kelp-javadoc\/current-version\/it\/uniroma2\/sag\/kelp\/data\/example\/SimpleExample.html\">SimpleExample<\/a>:\u00a0it models an individual machine learning instance. It is suitable for most of the scenarios.<\/li>\n<li><a href=\"http:\/\/www.kelp-ml.org\/kelp-javadoc\/current-version\/it\/uniroma2\/sag\/kelp\/data\/example\/ExamplePair.html\">ExamplePair<\/a>:\u00a0it models machine learning instances naturally structured into pairs, such as <em>question-answer<\/em> in Question Answering or <em>text-hypothesis<\/em> in Recognizing Textual Entailment.<\/li>\n<li><a href=\"http:\/\/www.kelp-ml.org\/kelp-javadoc\/current-version\/it\/uniroma2\/sag\/kelp\/data\/example\/SequenceExample.html\">SequenceExample<\/a>:\u00a0it\u00a0models a sequence of <a href=\"http:\/\/www.kelp-ml.org\/kelp-javadoc\/current-version\/it\/uniroma2\/sag\/kelp\/data\/example\/Example.html\" target=\"_blank\">Example<\/a>s, each containing a set of <a href=\"http:\/\/www.kelp-ml.org\/kelp-javadoc\/current-version\/it\/uniroma2\/sag\/kelp\/data\/representation\/Representation.html\">Representation<\/a>s and a set of <a href=\"http:\/\/www.kelp-ml.org\/kelp-javadoc\/current-version\/it\/uniroma2\/sag\/kelp\/data\/label\/Label.html\">Label<\/a>s. This\u00a0object is used by machine learning methods operating over sequences.<\/li>\n<\/ul>\n<p>Every example has a set of <a href=\"http:\/\/www.kelp-ml.org\/kelp-javadoc\/current-version\/it\/uniroma2\/sag\/kelp\/data\/label\/StringLabel.html\">StringLabel<\/a>s for classification tasks and a set of <a href=\"http:\/\/www.kelp-ml.org\/kelp-javadoc\/current-version\/it\/uniroma2\/sag\/kelp\/data\/label\/NumericLabel.html\">NumericLabel<\/a>s for regression problems. Multiple labels associated to a single example allow for tackling multi-label classification or multi-variate regression tasks. An example can have no label, as in the case of clustering problems.<\/p>\n<p>Furthermore, an example is composed by a set of representations. This allows to model data instances from different viewpoints, and to perform a joint learning model, where multiple representations are exploited at the same time (i.e., using kernel combinations).<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-142\" src=\"http:\/\/www.kelp-ml.org\/wp-content\/uploads\/2017\/02\/MLP_DATA_class_diagram-1.png\" alt=\"\" width=\"1120\" height=\"932\" srcset=\"http:\/\/www.kelp-ml.org\/wp-content\/uploads\/2017\/02\/MLP_DATA_class_diagram-1.png 1120w, http:\/\/www.kelp-ml.org\/wp-content\/uploads\/2017\/02\/MLP_DATA_class_diagram-1-300x250.png 300w, http:\/\/www.kelp-ml.org\/wp-content\/uploads\/2017\/02\/MLP_DATA_class_diagram-1-768x639.png 768w, http:\/\/www.kelp-ml.org\/wp-content\/uploads\/2017\/02\/MLP_DATA_class_diagram-1-1024x852.png 1024w\" sizes=\"(max-width: 1120px) 100vw, 1120px\" \/><\/p>\n<hr \/>\n<h3>Existing Representations<\/h3>\n<p>KeLP\u00a0supports both vectorial and structured data to model learning instances.<br \/>\nFor example, <a href=\"http:\/\/www.kelp-ml.org\/kelp-javadoc\/current-version\/it\/uniroma2\/sag\/kelp\/data\/representation\/vector\/SparseVector.html\">SparseVector<\/a> can host a Bag-of-Words model, while <a href=\"http:\/\/www.kelp-ml.org\/kelp-javadoc\/current-version\/it\/uniroma2\/sag\/kelp\/data\/representation\/vector\/DenseVector.html\">DenseVector<\/a> can represent data derived from low dimensional embeddings. They are both available into <em>kelp-core<\/em>, allowing to have the standard environment provided by most of the existing machine learning platforms.<\/p>\n<p><em>kelp-additional-kernels<\/em> provides structure representations:<\/p>\n<ul>\n<li><a href=\"http:\/\/www.kelp-ml.org\/kelp-javadoc\/current-version\/it\/uniroma2\/sag\/kelp\/data\/representation\/tree\/TreeRepresentation.html\">TreeRepresentation<\/a>:\u00a0it models a tree structure that can be employed for representing syntactic trees.<\/li>\n<li><a href=\"http:\/\/www.kelp-ml.org\/kelp-javadoc\/current-version\/it\/uniroma2\/sag\/kelp\/data\/representation\/sequence\/SequenceRepresentation.html\">SequenceRepresentation<\/a>:\u00a0it models a sequence that can be employed for representing, for example, sequences of words.<\/li>\n<li><a href=\"http:\/\/www.kelp-ml.org\/kelp-javadoc\/current-version\/it\/uniroma2\/sag\/kelp\/data\/representation\/graph\/DirectedGraphRepresentation.html\">DirectedGraphRepresentation<\/a>:\u00a0it models a directed unweighted graph structure, i.e., any set of nodes and directed edges connecting them. Edges do not have any weight or label.<\/li>\n<\/ul>\n<p>The nodes in these three representations are associated with a generic structure <a href=\"http:\/\/www.kelp-ml.org\/kelp-javadoc\/current-version\/it\/uniroma2\/sag\/kelp\/data\/representation\/structure\/StructureElement.html\">StructureElement<\/a> containing the node label and possible additional information. For example, in a <a href=\"http:\/\/www.kelp-ml.org\/kelp-javadoc\/current-version\/it\/uniroma2\/sag\/kelp\/data\/representation\/tree\/TreeRepresentation.html\">TreeRepresentation<\/a>\u00a0of a sentence, leaves can represent lexical items. Nodes can thus model lexical items, where the node label represent the word, and the additional information can be constituted by a vector representation of that\u00a0word, as the ones produced by Word Embedding (e.g., Word2Vec) methods.<\/p>\n<p>Finally, a <a href=\"http:\/\/www.kelp-ml.org\/kelp-javadoc\/current-version\/it\/uniroma2\/sag\/kelp\/data\/representation\/string\/StringRepresentation.html\">StringRepresentation <\/a>is included to store a plain text, useful for associating a comment to an example.<\/p>\n<p>To generate input data structures for KeLP please refer to this <a href=\"http:\/\/www.kelp-ml.org\/?page_id=1025\">page<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In KeLP, a machine learning instance is modeled by the class Example. As illustrated in the Figure below,\u00a0there are three\u00a0implementations of such class: SimpleExample:\u00a0it models an individual machine learning instance. It is suitable for most of the scenarios. ExamplePair:\u00a0it models machine learning instances naturally structured into pairs, such as question-answer in Question Answering or text-hypothesis <a href=\"http:\/\/www.kelp-ml.org\/?page_id=183\" rel=\"nofollow\"><span class=\"sr-only\">Read more about Data and Representations<\/span>[&hellip;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":112,"menu_order":4,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"http:\/\/www.kelp-ml.org\/index.php?rest_route=\/wp\/v2\/pages\/183"}],"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=183"}],"version-history":[{"count":12,"href":"http:\/\/www.kelp-ml.org\/index.php?rest_route=\/wp\/v2\/pages\/183\/revisions"}],"predecessor-version":[{"id":1040,"href":"http:\/\/www.kelp-ml.org\/index.php?rest_route=\/wp\/v2\/pages\/183\/revisions\/1040"}],"up":[{"embeddable":true,"href":"http:\/\/www.kelp-ml.org\/index.php?rest_route=\/wp\/v2\/pages\/112"}],"wp:attachment":[{"href":"http:\/\/www.kelp-ml.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=183"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}