| <!-- 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.4"/> |
| <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: Summary</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="navtree.js"></script> |
| <script type="text/javascript"> |
| $(document).ready(initResizable); |
| $(window).load(resizeHeight); |
| </script> |
| <link href="search/search.css" rel="stylesheet" type="text/css"/> |
| <script type="text/javascript" src="search/search.js"></script> |
| <script type="text/javascript"> |
| $(document).ready(function() { searchBox.OnSelectItem(0); }); |
| </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 src="../mathjax/MathJax.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', 'auto'); |
| 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 style="padding-left: 0.5em;"> |
| <div id="projectname">MADlib |
|  <span id="projectnumber">1.2</span> <span style="font-size:10pt; font-style:italic"><a href="../latest/./group__grp__summary.html"> A newer version is available</a></span> |
| </div> |
| <div id="projectbrief">User Documentation</div> |
| </td> |
| <!--BEGIN VERSIONS LINKS--> |
| <td style="padding-left: 0.5em;"> |
| <div class="versionlist"><ul> |
| <li class="head">More versions:</li> |
| <li><a href="../v1.1/index.html">v1.1</li> |
| <li><a href="../v1.0/index.html">v1.0</li> |
| <li><a href="../v0.7/index.html">v0.7</li> |
| <li><a href="../v0.5/index.html">v0.5</li></ul> |
| </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.4 --> |
| <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('group__grp__summary.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)"> |
| <a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Groups</a></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="headertitle"> |
| <div class="title">Summary<div class="ingroups"><a class="el" href="group__grp__desc__stats.html">Descriptive Statistics</a></div></div> </div> |
| </div><!--header--> |
| <div class="contents"> |
| <div class="toc"> <ul> |
| <li> |
| <a href="#about">About</a> </li> |
| <li> |
| <a href="#help">Online Help</a> </li> |
| <li> |
| <a href="#usage">Usage</a> </li> |
| <li> |
| <a href="#notes">Notes</a> </li> |
| <li> |
| <a href="#output">Output</a> </li> |
| <li> |
| <a href="#examples">Examples</a> </li> |
| <li> |
| <a href="#seealso">See Also</a> </li> |
| </ul> |
| </div><p><a class="anchor" id="about"></a></p> |
| <dl class="section user"><dt>About</dt><dd></dd></dl> |
| <p>The MADlib <b><a class="el" href="summary_8sql__in.html#a14ff66aaa0248c5e2741dfaf2e360881">summary()</a></b> function is a generic function used to produce summary statistics from any data table. The function invokes various methods from the MADlib library to provide an overview of the data.</p> |
| <p><a class="anchor" id="help"></a></p> |
| <dl class="section user"><dt>Online Help:</dt><dd></dd></dl> |
| <p>To display basic information for the <b><a class="el" href="summary_8sql__in.html#a14ff66aaa0248c5e2741dfaf2e360881">summary()</a></b> function, call it with no argument: </p> |
| <pre class="fragment">summary() |
| </pre><p>To display the full syntax of the function, call the function with the 'usage' argument: </p> |
| <pre class="fragment">summary('usage') |
| </pre><p><a class="anchor" id="usage"></a></p> |
| <dl class="section user"><dt>Usage</dt><dd>The <b><a class="el" href="summary_8sql__in.html#a14ff66aaa0248c5e2741dfaf2e360881">summary()</a></b> function has the following syntax: <pre class="fragment">summary (source_table, output_table, |
| target_cols := NULL, |
| grouping_cols := NULL, |
| get_distinct := True, |
| get_quartiles := True, |
| ntile_array := NULL, |
| how_many_mfv := 10, |
| get_estimates := True) |
| </pre> <dl class="arglist"> |
| <dt>source_table </dt> |
| <dd>TEXT. The name of the table containing the input data. </dd> |
| <dt>output_table </dt> |
| <dd>TEXT. The name of the table to contain the output summary data. </dd> |
| <dt>target_columns </dt> |
| <dd>TEXT. A comma-separated list of columns to summarize. If NULL, summaries are produced for all columns. Default NULL. </dd> |
| <dt>grouping_cols </dt> |
| <dd>TEXT. A comma-separated list of columns on which to group results. If NULL, summaries are produced on the complete table. Default: NULL. </dd> |
| <dt>get_distinct </dt> |
| <dd>BOOLEAN. If true, distinct values are counted. Default: True. </dd> |
| <dt>get_quartiles </dt> |
| <dd>BOOLEAN. If true, qartiles are computed. Default: True. </dd> |
| <dt>ntile_array </dt> |
| <dd>FLOAT8[]. An array of quantile values to compute. If NULL, quantile values are not computed. Default: NULL. </dd> |
| <dt>how_many_mfv </dt> |
| <dd>INTEGER. The number of most-frequent-values to compute. Default: 10. </dd> |
| <dt>get_estimates </dt> |
| <dd>BOOLEAN. If true, estimated values are produced. If False, exact values are calculated. Default: True. </dd> |
| </dl> |
| </dd></dl> |
| <p><a class="anchor" id="notes"></a></p> |
| <dl class="section note"><dt>Note</dt><dd><ul> |
| <li>All table names can be optionally schema qualified (current_schemas() would be searched if a schema name is not provided) and all table and column names should follow case-sensitivity and quoting rules per the database. (For instance, 'mytable' and 'MyTable' both resolve to the same entity, i.e. 'mytable'. If mixed-case or multi-byte characters are desired for entity names then the string should be double-quoted; in this case the input would be '"MyTable"').</li> |
| <li>Estimated values are only implemented for the distinct values computation.</li> |
| <li>The <em>get_estimates</em> parameter controls computation for two statistics:<ul> |
| <li>If <em>get_estimates</em> is True then the distinct value computation is estimated. Further, the most frequent values computation is computed using a "quick and dirty" method that does parallel aggregation in GPDB at the expense of missing some of the most frequent values.</li> |
| <li>If <em>get_estimates</em> is False then the distinct values are computed in a slow but exact method. The most frequent values are computed using a faithful implementation that preserves the approximation guarantees of the Cormode/Muthukrishnan method (more information in <a class="el" href="group__grp__mfvsketch.html">MFV (Most Frequent Values)</a>).</li> |
| </ul> |
| </li> |
| </ul> |
| </dd></dl> |
| <p><a class="anchor" id="output"></a></p> |
| <dl class="section user"><dt>Output:</dt><dd></dd></dl> |
| <p>The <b><a class="el" href="summary_8sql__in.html#a14ff66aaa0248c5e2741dfaf2e360881">summary()</a></b> function returns a composite type containing three fields: </p> |
| <dl class="arglist"> |
| <dt>output_table </dt> |
| <dd>TEXT. The name of the output table. </dd> |
| <dt>row_count </dt> |
| <dd>INTEGER. The number of rows in the output table. </dd> |
| <dt>duration </dt> |
| <dd>FLOAT8. The time taken (in seconds) to compute the summary. </dd> |
| </dl> |
| <p>Summary statistics are saved in a table with the name specifed in the <em>output_table</em> argument. The table can contain the following columns: </p> |
| <dl class="arglist"> |
| <dt>group_by </dt> |
| <dd>Group-by column name. NULL if none provided. </dd> |
| <dt>group_by_value </dt> |
| <dd>Value of the Group-by column. NULL if there is no grouping. </dd> |
| <dt>target_column </dt> |
| <dd>Targeted column values for which summary is requested. </dd> |
| <dt>column_number </dt> |
| <dd>Physical column number for the target column, as described in <em>pg_attribute</em>. </dd> |
| <dt>data_type </dt> |
| <dd>Data type of the target column. Standard GPDB type descriptors are displayed. </dd> |
| <dt>row_count </dt> |
| <dd>Number of rows for the target column. </dd> |
| <dt>distinct_values </dt> |
| <dd>Number of distinct values in the target column. </dd> |
| <dt>missing_values </dt> |
| <dd>Number of missing values in the target column. </dd> |
| <dt>blank_values </dt> |
| <dd>Number of blank values. Blanks are defined by this regular expression:<pre class="fragment">'^\w*$'</pre> </dd> |
| <dt>fraction_missing </dt> |
| <dd>Percentage of total rows that are missing, as a decimal value, e.g. 0.3. </dd> |
| <dt>fraction_blank </dt> |
| <dd>Percentage of total rows that are blank, as a decimal value, e.g. 0.3. </dd> |
| <dt>mean </dt> |
| <dd>Mean value of target column if target is numeric, otherwise NULL. </dd> |
| <dt>variance </dt> |
| <dd>Variance of target column if target is numeric, otherwise NULL. </dd> |
| <dt>min </dt> |
| <dd>Minimum value of target column. For strings this is the length of the shortest string. </dd> |
| <dt>max </dt> |
| <dd>Maximum value of target column. For strings this is the length of the longest string. </dd> |
| <dt>first_quartile </dt> |
| <dd>First quartile (25th percentile), only for numeric columns. </dd> |
| <dt>median </dt> |
| <dd>Median value of target column, if target is numeric, otherwise NULL. </dd> |
| <dt>third_quartile </dt> |
| <dd>Third quartile (25th percentile), only for numeric columns. </dd> |
| <dt>quantile_array </dt> |
| <dd>Percentile values corresponding to <em>ntile_array</em>. </dd> |
| <dt>most_frequent_values </dt> |
| <dd>An array containing the most frequently occurring values. The <em>how_many_mfv</em> argument determines the length of the array, 10 by default. </dd> |
| <dt>mfv_frequencies </dt> |
| <dd>Array containing the frequency count for each of the most frequent values. </dd> |
| </dl> |
| <p><a class="anchor" id="examples"></a></p> |
| <dl class="section user"><dt>Examples</dt><dd><ol type="1"> |
| <li>View online help for the <b><a class="el" href="summary_8sql__in.html#a14ff66aaa0248c5e2741dfaf2e360881">summary()</a></b> function. <pre class="fragment">sql> SELECT * FROM madlib.summary('usage'); |
| </pre></li> |
| <li>Create an input data set. <pre class="fragment">sql> CREATE TABLE houses (id INT, tax INT, bedroom INT, bath FLOAT, price INT, |
| size INT, lot INT); |
| sql> COPY houses FROM STDIN WITH DELIMITER '|'; |
| 1 | 590 | 2 | 1 | 50000 | 770 | 22100 |
| 2 | 1050 | 3 | 2 | 85000 | 1410 | 12000 |
| 3 | 20 | 3 | 1 | 22500 | 1060 | 3500 |
| 4 | 870 | 2 | 2 | 90000 | 1300 | 17500 |
| 5 | 1320 | 3 | 2 | 133000 | 1500 | 30000 |
| 6 | 1350 | 2 | 1 | 90500 | 820 | 25700 |
| 7 | 2790 | 3 | 2.5 | 260000 | 2130 | 25000 |
| 8 | 680 | 2 | 1 | 142500 | 1170 | 22000 |
| 9 | 1840 | 3 | 2 | 160000 | 1500 | 19000 |
| 10 | 3680 | 4 | 2 | 240000 | 2790 | 20000 |
| 11 | 1660 | 3 | 1 | 87000 | 1030 | 17500 |
| 12 | 1620 | 3 | 2 | 118600 | 1250 | 20000 |
| 13 | 3100 | 3 | 2 | 140000 | 1760 | 38000 |
| 14 | 2070 | 2 | 3 | 148000 | 1550 | 14000 |
| 15 | 650 | 3 | 1.5 | 65000 | 1450 | 12000 |
| \. |
| </pre></li> |
| <li>Run the <b><a class="el" href="summary_8sql__in.html#a14ff66aaa0248c5e2741dfaf2e360881">summary()</a></b> function. <pre class="fragment">sql> SELECT * FROM |
| madlib.summary('houses', 'houses_summary', |
| 'tax,bedroom,lot,bath,price,size,lot', |
| 'bedroom', True, True, NULL, 5, False); |
| output_table | row_count | duration |
| ----------------+-----------+---------------- |
| houses_summary | 21 | 0.207587003708 |
| (1 row) |
| </pre></li> |
| <li>View the summary data. <pre class="fragment">-- Turn on expanded display for readability. |
| sql> \x on |
| sql> SELECT * FROM houses_summary; |
| -[ RECORD 1 ]--------+----------------------------------- |
| group_by | bedroom |
| group_by_value | 3 |
| target_column | tax |
| column_number | 2 |
| data_type | int4 |
| row_count | 9 |
| distinct_values | 9 |
| missing_values | 0 |
| blank_values | |
| fraction_missing | 0 |
| fraction_blank | |
| mean | 1561.11111111111 |
| variance | 936736.111111111 |
| min | 20 |
| max | 3100 |
| most_frequent_values | {20,1320,2790,1840,1660} |
| mfv_frequencies | {1,1,1,1,1} |
| -[ RECORD 2 ]--------+----------------------------------- |
| group_by | bedroom |
| group_by_value | 3 |
| target_column | bath |
| column_number | 4 |
| ... |
| </pre></li> |
| </ol> |
| </dd></dl> |
| <p><a class="anchor" id="seealso"></a></p> |
| <dl class="section see"><dt>See Also</dt><dd>File <a class="el" href="summary_8sql__in.html" title="Summary function for descriptive statistics. ">summary.sql_in</a> documenting the <b><a class="el" href="summary_8sql__in.html#a14ff66aaa0248c5e2741dfaf2e360881">summary()</a></b> function </dd> |
| <dd> |
| <a class="el" href="group__grp__mfvsketch.html">MFV (Most Frequent Values)</a> </dd></dl> |
| </div><!-- contents --> |
| </div><!-- doc-content --> |
| <!-- start footer part --> |
| <div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> |
| <ul> |
| <li class="footer">Generated on Thu Jan 9 2014 20:35:40 for MADlib by |
| <a href="http://www.doxygen.org/index.html"> |
| <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.4 </li> |
| </ul> |
| </div> |
| </body> |
| </html> |