blob: 0a345b5afcbf1d0fd2156aafb62bd8edc0ec239c [file] [log] [blame]
<!-- HTML header for doxygen 1.8.4-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="keywords" content="madlib,postgres,greenplum,machine learning,data mining,deep learning,ensemble methods,data science,market basket analysis,affinity analysis,pca,lda,regression,elastic net,huber white,proportional hazards,k-means,latent dirichlet allocation,bayes,support vector machines,svm"/>
<title>MADlib: crf_feature_gen.sql_in File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
</script><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
<!-- hack in the navigation tree -->
<script type="text/javascript" src="eigen_navtree_hacks.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="madlib_extra.css" rel="stylesheet" type="text/css"/>
<!-- google analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-45382226-1', 'madlib.apache.org');
ga('send', 'pageview');
</script>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><a href="http://madlib.apache.org"><img alt="Logo" src="madlib.png" height="50" style="padding-left:0.5em;" border="0"/ ></a></td>
<td style="padding-left: 0.5em;">
<div id="projectname">
<span id="projectnumber">1.19.0</span>
</div>
<div id="projectbrief">User Documentation for Apache MADlib</div>
</td>
<td> <div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('crf__feature__gen_8sql__in.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="summary">
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">crf_feature_gen.sql_in File Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>SQL function for POS/NER feature extraction.
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a3548bd640c2af456f3755cb24b913ebd"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="crf__feature__gen_8sql__in.html#a3548bd640c2af456f3755cb24b913ebd">crf_train_fgen</a> (text train_segment_tbl, text regex_tbl, text label_tbl, text dictionary_tbl, text train_feature_tbl, text train_featureset_tbl)</td></tr>
<tr class="memdesc:a3548bd640c2af456f3755cb24b913ebd"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function extracts POS/NER features from the training data. <a href="#a3548bd640c2af456f3755cb24b913ebd">More...</a><br /></td></tr>
<tr class="separator:a3548bd640c2af456f3755cb24b913ebd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad9af2c3d1a4f1c937795634ca297dede"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="crf__feature__gen_8sql__in.html#ad9af2c3d1a4f1c937795634ca297dede">crf_test_fgen</a> (text test_segment_tbl, text dictionary_tbl, text label_tbl, text regex_tbl, text crf_weights_tbl, text viterbi_mtbl, text viterbi_rtbl)</td></tr>
<tr class="memdesc:ad9af2c3d1a4f1c937795634ca297dede"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function extracts POS/NER features from the testing data. <a href="#ad9af2c3d1a4f1c937795634ca297dede">More...</a><br /></td></tr>
<tr class="separator:ad9af2c3d1a4f1c937795634ca297dede"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><dl class="section date"><dt>Date</dt><dd>February 2012</dd></dl>
<dl class="section see"><dt>See also</dt><dd>For an introduction to POS/NER feature extraction, see the module description <a class="el" href="group__grp__crf.html">Conditional Random Field</a> </dd></dl>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="ad9af2c3d1a4f1c937795634ca297dede"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad9af2c3d1a4f1c937795634ca297dede">&#9670;&nbsp;</a></span>crf_test_fgen()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void crf_test_fgen </td>
<td>(</td>
<td class="paramtype">text&#160;</td>
<td class="paramname"><em>test_segment_tbl</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">text&#160;</td>
<td class="paramname"><em>dictionary_tbl</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">text&#160;</td>
<td class="paramname"><em>label_tbl</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">text&#160;</td>
<td class="paramname"><em>regex_tbl</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">text&#160;</td>
<td class="paramname"><em>crf_weights_tbl</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">text&#160;</td>
<td class="paramname"><em>viterbi_mtbl</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">text&#160;</td>
<td class="paramname"><em>viterbi_rtbl</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This feature extraction function will produce two factor tables, "m table" (<em>viterbi_mtbl</em>) and "r table" (<em>viterbi_rtbl</em>). The <em>viterbi_mtbl</em> table and <em>viterbi_rtbl</em> table are used to calculate the best label sequence for each sentence.</p>
<ul>
<li><em>viterbi_mtbl</em> table encodes the edge features which are solely dependent on upon current label and previous y value. The m table has three columns which are prev_label, label, and value respectively. If the number of labels in \( n \), then the m factor table will \( n^2 \) rows. Each row encodes the transition feature weight value from the previous label to the current label.</li>
</ul>
<p><em>startFeature</em> is considered as a special edge feature which is from the beginning to the first token. Likewise, <em>endFeature</em> can be considered as a special edge feature which is from the last token to the very end. So m table encodes the edgeFeature, startFeature, and endFeature. If the total number of labels in the label space is 45 from 0 to 44, then the m factor array is as follows: </p><pre>
0 1 2 3 4 5...44
startFeature -1 a a a a a a...a
edgeFeature 0 a a a a a a...a
edgeFeature 1 a a a a a a...a
...
edgeFeature 44 a a a a a a...a
endFeature 45 a a a a a a...a</pre><ul>
<li>viterbi_r table is related to specific tokens. It encodes the single state features, e.g., wordFeature, RegexFeature for all tokens. The r table is represented in the following way. <pre>
0 1 2 3 4...44
token1 a a a a a...a
token2 a a a a a...a</pre></li>
</ul>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">test_segment_tbl</td><td>Name of table containing all the tokenized testing sentences. </td></tr>
<tr><td class="paramname">dictionary_tbl</td><td>Name of table containing the dictionary_tbl. </td></tr>
<tr><td class="paramname">label_tbl</td><td>Name of table containing the the label space used in POS or other NLP tasks. </td></tr>
<tr><td class="paramname">regex_tbl</td><td>Name of table containing all the regular expressions to capture regex features. </td></tr>
<tr><td class="paramname">crf_weights_tbl</td><td>Name of the table containing featureset weights. </td></tr>
<tr><td class="paramname">viterbi_mtbl</td><td>Name of table to store the m factors. </td></tr>
<tr><td class="paramname">viterbi_rtbl</td><td>Name of table to store the r factors. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="a3548bd640c2af456f3755cb24b913ebd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3548bd640c2af456f3755cb24b913ebd">&#9670;&nbsp;</a></span>crf_train_fgen()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void crf_train_fgen </td>
<td>(</td>
<td class="paramtype">text&#160;</td>
<td class="paramname"><em>train_segment_tbl</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">text&#160;</td>
<td class="paramname"><em>regex_tbl</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">text&#160;</td>
<td class="paramname"><em>label_tbl</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">text&#160;</td>
<td class="paramname"><em>dictionary_tbl</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">text&#160;</td>
<td class="paramname"><em>train_feature_tbl</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">text&#160;</td>
<td class="paramname"><em>train_featureset_tbl</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">train_segment_tbl</td><td>Name of table containing all the tokenized training sentences. </td></tr>
<tr><td class="paramname">regex_tbl</td><td>Name of table containing all the regular expressions to capture regex features. </td></tr>
<tr><td class="paramname">label_tbl</td><td>Name of the label table containing unique ids and label names. </td></tr>
<tr><td class="paramname">dictionary_tbl</td><td>Name of table containing the dictionary_tbl. </td></tr>
<tr><td class="paramname">train_feature_tbl</td><td>features generated from the traning dataset </td></tr>
<tr><td class="paramname">train_featureset_tbl</td><td>unique feature set generated from the training dataset </td></tr>
</table>
</dd>
</dl>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_efbcf68973d247bbf15f9eecae7f24e3.html">ports</a></li><li class="navelem"><a class="el" href="dir_a4a48839224ef8488facbffa8a397967.html">postgres</a></li><li class="navelem"><a class="el" href="dir_dc596537ad427a4d866006d1a3e1fe29.html">modules</a></li><li class="navelem"><a class="el" href="dir_70e9abe17564e15776adcab8550c7667.html">crf</a></li><li class="navelem"><a class="el" href="crf__feature__gen_8sql__in.html">crf_feature_gen.sql_in</a></li>
<li class="footer">Generated on Wed Dec 15 2021 20:27:18 for MADlib by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
</ul>
</div>
</body>
</html>