blob: 6475b916cb230b5c48098ef27118b0ef374beb97 (
plain) (
tree)
|
|
<!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/html; charset=utf-8" />
<title>pyspark.mllib.stat.test — PySpark 1.5.0 documentation</title>
<link rel="stylesheet" href="../../../../_static/nature.css" type="text/css" />
<link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../../../',
VERSION: '1.5.0',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../../../../_static/jquery.js"></script>
<script type="text/javascript" src="../../../../_static/underscore.js"></script>
<script type="text/javascript" src="../../../../_static/doctools.js"></script>
<link rel="top" title="PySpark 1.5.0 documentation" href="../../../../index.html" />
<link rel="up" title="Module code" href="../../../index.html" />
</head>
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="nav-item nav-item-0"><a href="../../../../index.html">PySpark 1.5.0 documentation</a> »</li>
<li class="nav-item nav-item-1"><a href="../../../index.html" accesskey="U">Module code</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<h1>Source code for pyspark.mllib.stat.test</h1><div class="highlight"><pre>
<span class="c">#</span>
<span class="c"># Licensed to the Apache Software Foundation (ASF) under one or more</span>
<span class="c"># contributor license agreements. See the NOTICE file distributed with</span>
<span class="c"># this work for additional information regarding copyright ownership.</span>
<span class="c"># The ASF licenses this file to You under the Apache License, Version 2.0</span>
<span class="c"># (the "License"); you may not use this file except in compliance with</span>
<span class="c"># the License. You may obtain a copy of the License at</span>
<span class="c">#</span>
<span class="c"># http://www.apache.org/licenses/LICENSE-2.0</span>
<span class="c">#</span>
<span class="c"># Unless required by applicable law or agreed to in writing, software</span>
<span class="c"># distributed under the License is distributed on an "AS IS" BASIS,</span>
<span class="c"># WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
<span class="c"># See the License for the specific language governing permissions and</span>
<span class="c"># limitations under the License.</span>
<span class="c">#</span>
<span class="kn">from</span> <span class="nn">pyspark.mllib.common</span> <span class="kn">import</span> <span class="n">inherit_doc</span><span class="p">,</span> <span class="n">JavaModelWrapper</span>
<span class="n">__all__</span> <span class="o">=</span> <span class="p">[</span><span class="s">"ChiSqTestResult"</span><span class="p">,</span> <span class="s">"KolmogorovSmirnovTestResult"</span><span class="p">]</span>
<span class="k">class</span> <span class="nc">TestResult</span><span class="p">(</span><span class="n">JavaModelWrapper</span><span class="p">):</span>
<span class="sd">"""</span>
<span class="sd"> Base class for all test results.</span>
<span class="sd"> """</span>
<span class="nd">@property</span>
<span class="k">def</span> <span class="nf">pValue</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">"""</span>
<span class="sd"> The probability of obtaining a test statistic result at least as</span>
<span class="sd"> extreme as the one that was actually observed, assuming that the</span>
<span class="sd"> null hypothesis is true.</span>
<span class="sd"> """</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_java_model</span><span class="o">.</span><span class="n">pValue</span><span class="p">()</span>
<span class="nd">@property</span>
<span class="k">def</span> <span class="nf">degreesOfFreedom</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">"""</span>
<span class="sd"> Returns the degree(s) of freedom of the hypothesis test.</span>
<span class="sd"> Return type should be Number(e.g. Int, Double) or tuples of Numbers.</span>
<span class="sd"> """</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_java_model</span><span class="o">.</span><span class="n">degreesOfFreedom</span><span class="p">()</span>
<span class="nd">@property</span>
<span class="k">def</span> <span class="nf">statistic</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">"""</span>
<span class="sd"> Test statistic.</span>
<span class="sd"> """</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_java_model</span><span class="o">.</span><span class="n">statistic</span><span class="p">()</span>
<span class="nd">@property</span>
<span class="k">def</span> <span class="nf">nullHypothesis</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">"""</span>
<span class="sd"> Null hypothesis of the test.</span>
<span class="sd"> """</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_java_model</span><span class="o">.</span><span class="n">nullHypothesis</span><span class="p">()</span>
<span class="k">def</span> <span class="nf">__str__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_java_model</span><span class="o">.</span><span class="n">toString</span><span class="p">()</span>
<span class="nd">@inherit_doc</span>
<div class="viewcode-block" id="ChiSqTestResult"><a class="viewcode-back" href="../../../../pyspark.mllib.html#pyspark.mllib.stat.ChiSqTestResult">[docs]</a><span class="k">class</span> <span class="nc">ChiSqTestResult</span><span class="p">(</span><span class="n">TestResult</span><span class="p">):</span>
<span class="sd">"""</span>
<span class="sd"> Contains test results for the chi-squared hypothesis test.</span>
<span class="sd"> """</span>
<span class="nd">@property</span>
<span class="k">def</span> <span class="nf">method</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">"""</span>
<span class="sd"> Name of the test method</span>
<span class="sd"> """</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_java_model</span><span class="o">.</span><span class="n">method</span><span class="p">()</span>
</div>
<span class="nd">@inherit_doc</span>
<span class="k">class</span> <span class="nc">KolmogorovSmirnovTestResult</span><span class="p">(</span><span class="n">TestResult</span><span class="p">):</span>
<span class="sd">"""</span>
<span class="sd"> Contains test results for the Kolmogorov-Smirnov test.</span>
<span class="sd"> """</span>
</pre></div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="../../../../index.html">
<img class="logo" src="../../../../_static/spark-logo-hd.png" alt="Logo"/>
</a></p>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="../../../../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="nav-item nav-item-0"><a href="../../../../index.html">PySpark 1.5.0 documentation</a> »</li>
<li class="nav-item nav-item-1"><a href="../../../index.html" >Module code</a> »</li>
</ul>
</div>
<div class="footer" role="contentinfo">
© Copyright .
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1.
</div>
</body>
</html>
|