http://git-wip-us.apache.org/repos/asf/spark-website/blob/6bbac496/site/docs/2.1.2/api/python/_modules/pyspark/mllib/regression.html ---------------------------------------------------------------------- diff --git a/site/docs/2.1.2/api/python/_modules/pyspark/mllib/regression.html b/site/docs/2.1.2/api/python/_modules/pyspark/mllib/regression.html index 3c5041f..7aca653 100644 --- a/site/docs/2.1.2/api/python/_modules/pyspark/mllib/regression.html +++ b/site/docs/2.1.2/api/python/_modules/pyspark/mllib/regression.html @@ -238,7 +238,7 @@ <span class="nd">@classmethod</span> <span class="nd">@since</span><span class="p">(</span><span class="s2">"1.4.0"</span><span class="p">)</span> -<div class="viewcode-block" id="LinearRegressionModel.load"><a class="viewcode-back" href="../../../pyspark.mllib.html#pyspark.mllib.classification.LinearRegressionModel.load">[docs]</a> <span class="k">def</span> <span class="nf">load</span><span class="p">(</span><span class="n">cls</span><span class="p">,</span> <span class="n">sc</span><span class="p">,</span> <span class="n">path</span><span class="p">):</span> +<div class="viewcode-block" id="LinearRegressionModel.load"><a class="viewcode-back" href="../../../pyspark.mllib.html#pyspark.mllib.classification.LinearRegressionModel.load">[docs]</a> <span class="k">def</span> <span class="nf">load</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">sc</span><span class="p">,</span> <span class="n">path</span><span class="p">):</span> <span class="sd">"""Load a LinearRegressionModel."""</span> <span class="n">java_model</span> <span class="o">=</span> <span class="n">sc</span><span class="o">.</span><span class="n">_jvm</span><span class="o">.</span><span class="n">org</span><span class="o">.</span><span class="n">apache</span><span class="o">.</span><span class="n">spark</span><span class="o">.</span><span class="n">mllib</span><span class="o">.</span><span class="n">regression</span><span class="o">.</span><span class="n">LinearRegressionModel</span><span class="o">.</span><span class="n">load</span><span class="p">(</span> <span class="n">sc</span><span class="o">.</span><span class="n">_jsc</span><span class="o">.</span><span class="n">sc</span><span class="p">(),</span> <span class="n">path</span><span class="p">)</span> @@ -274,7 +274,7 @@ <span class="sd"> """</span> <span class="nd">@classmethod</span> <span class="nd">@since</span><span class="p">(</span><span class="s2">"0.9.0"</span><span class="p">)</span> -<div class="viewcode-block" id="LinearRegressionWithSGD.train"><a class="viewcode-back" href="../../../pyspark.mllib.html#pyspark.mllib.classification.LinearRegressionWithSGD.train">[docs]</a> <span class="k">def</span> <span class="nf">train</span><span class="p">(</span><span class="n">cls</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">iterations</span><span class="o">=</span><span class="mi">100</span><span class="p">,</span> <span class="n">step</span><span class="o">=</span><span class="mf">1.0</span><span class="p">,</span> <span class="n">miniBatchFraction</span><span class="o">=</span><span class="mf">1.0</span><span class="p">,</span> +<div class="viewcode-block" id="LinearRegressionWithSGD.train"><a class="viewcode-back" href="../../../pyspark.mllib.html#pyspark.mllib.classification.LinearRegressionWithSGD.train">[docs]</a> <span class="k">def</span> <span class="nf">train</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">iterations</span><span class="o">=</span><span class="mi">100</span><span class="p">,</span> <span class="n">step</span><span class="o">=</span><span class="mf">1.0</span><span class="p">,</span> <span class="n">miniBatchFraction</span><span class="o">=</span><span class="mf">1.0</span><span class="p">,</span> <span class="n">initialWeights</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">regParam</span><span class="o">=</span><span class="mf">0.0</span><span class="p">,</span> <span class="n">regType</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">intercept</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">validateData</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">convergenceTol</span><span class="o">=</span><span class="mf">0.001</span><span class="p">):</span> <span class="sd">"""</span> @@ -405,7 +405,7 @@ <span class="nd">@classmethod</span> <span class="nd">@since</span><span class="p">(</span><span class="s2">"1.4.0"</span><span class="p">)</span> -<div class="viewcode-block" id="LassoModel.load"><a class="viewcode-back" href="../../../pyspark.mllib.html#pyspark.mllib.classification.LassoModel.load">[docs]</a> <span class="k">def</span> <span class="nf">load</span><span class="p">(</span><span class="n">cls</span><span class="p">,</span> <span class="n">sc</span><span class="p">,</span> <span class="n">path</span><span class="p">):</span> +<div class="viewcode-block" id="LassoModel.load"><a class="viewcode-back" href="../../../pyspark.mllib.html#pyspark.mllib.classification.LassoModel.load">[docs]</a> <span class="k">def</span> <span class="nf">load</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">sc</span><span class="p">,</span> <span class="n">path</span><span class="p">):</span> <span class="sd">"""Load a LassoModel."""</span> <span class="n">java_model</span> <span class="o">=</span> <span class="n">sc</span><span class="o">.</span><span class="n">_jvm</span><span class="o">.</span><span class="n">org</span><span class="o">.</span><span class="n">apache</span><span class="o">.</span><span class="n">spark</span><span class="o">.</span><span class="n">mllib</span><span class="o">.</span><span class="n">regression</span><span class="o">.</span><span class="n">LassoModel</span><span class="o">.</span><span class="n">load</span><span class="p">(</span> <span class="n">sc</span><span class="o">.</span><span class="n">_jsc</span><span class="o">.</span><span class="n">sc</span><span class="p">(),</span> <span class="n">path</span><span class="p">)</span> @@ -423,7 +423,7 @@ <span class="sd"> """</span> <span class="nd">@classmethod</span> <span class="nd">@since</span><span class="p">(</span><span class="s2">"0.9.0"</span><span class="p">)</span> -<div class="viewcode-block" id="LassoWithSGD.train"><a class="viewcode-back" href="../../../pyspark.mllib.html#pyspark.mllib.classification.LassoWithSGD.train">[docs]</a> <span class="k">def</span> <span class="nf">train</span><span class="p">(</span><span class="n">cls</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">iterations</span><span class="o">=</span><span class="mi">100</span><span class="p">,</span> <span class="n">step</span><span class="o">=</span><span class="mf">1.0</span><span class="p">,</span> <span class="n">regParam</span><span class="o">=</span><span class="mf">0.01</span><span class="p">,</span> +<div class="viewcode-block" id="LassoWithSGD.train"><a class="viewcode-back" href="../../../pyspark.mllib.html#pyspark.mllib.classification.LassoWithSGD.train">[docs]</a> <span class="k">def</span> <span class="nf">train</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">iterations</span><span class="o">=</span><span class="mi">100</span><span class="p">,</span> <span class="n">step</span><span class="o">=</span><span class="mf">1.0</span><span class="p">,</span> <span class="n">regParam</span><span class="o">=</span><span class="mf">0.01</span><span class="p">,</span> <span class="n">miniBatchFraction</span><span class="o">=</span><span class="mf">1.0</span><span class="p">,</span> <span class="n">initialWeights</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">intercept</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">validateData</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">convergenceTol</span><span class="o">=</span><span class="mf">0.001</span><span class="p">):</span> <span class="sd">"""</span> @@ -548,7 +548,7 @@ <span class="nd">@classmethod</span> <span class="nd">@since</span><span class="p">(</span><span class="s2">"1.4.0"</span><span class="p">)</span> -<div class="viewcode-block" id="RidgeRegressionModel.load"><a class="viewcode-back" href="../../../pyspark.mllib.html#pyspark.mllib.classification.RidgeRegressionModel.load">[docs]</a> <span class="k">def</span> <span class="nf">load</span><span class="p">(</span><span class="n">cls</span><span class="p">,</span> <span class="n">sc</span><span class="p">,</span> <span class="n">path</span><span class="p">):</span> +<div class="viewcode-block" id="RidgeRegressionModel.load"><a class="viewcode-back" href="../../../pyspark.mllib.html#pyspark.mllib.classification.RidgeRegressionModel.load">[docs]</a> <span class="k">def</span> <span class="nf">load</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">sc</span><span class="p">,</span> <span class="n">path</span><span class="p">):</span> <span class="sd">"""Load a RidgeRegressionMode."""</span> <span class="n">java_model</span> <span class="o">=</span> <span class="n">sc</span><span class="o">.</span><span class="n">_jvm</span><span class="o">.</span><span class="n">org</span><span class="o">.</span><span class="n">apache</span><span class="o">.</span><span class="n">spark</span><span class="o">.</span><span class="n">mllib</span><span class="o">.</span><span class="n">regression</span><span class="o">.</span><span class="n">RidgeRegressionModel</span><span class="o">.</span><span class="n">load</span><span class="p">(</span> <span class="n">sc</span><span class="o">.</span><span class="n">_jsc</span><span class="o">.</span><span class="n">sc</span><span class="p">(),</span> <span class="n">path</span><span class="p">)</span> @@ -567,7 +567,7 @@ <span class="sd"> """</span> <span class="nd">@classmethod</span> <span class="nd">@since</span><span class="p">(</span><span class="s2">"0.9.0"</span><span class="p">)</span> -<div class="viewcode-block" id="RidgeRegressionWithSGD.train"><a class="viewcode-back" href="../../../pyspark.mllib.html#pyspark.mllib.classification.RidgeRegressionWithSGD.train">[docs]</a> <span class="k">def</span> <span class="nf">train</span><span class="p">(</span><span class="n">cls</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">iterations</span><span class="o">=</span><span class="mi">100</span><span class="p">,</span> <span class="n">step</span><span class="o">=</span><span class="mf">1.0</span><span class="p">,</span> <span class="n">regParam</span><span class="o">=</span><span class="mf">0.01</span><span class="p">,</span> +<div class="viewcode-block" id="RidgeRegressionWithSGD.train"><a class="viewcode-back" href="../../../pyspark.mllib.html#pyspark.mllib.classification.RidgeRegressionWithSGD.train">[docs]</a> <span class="k">def</span> <span class="nf">train</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">iterations</span><span class="o">=</span><span class="mi">100</span><span class="p">,</span> <span class="n">step</span><span class="o">=</span><span class="mf">1.0</span><span class="p">,</span> <span class="n">regParam</span><span class="o">=</span><span class="mf">0.01</span><span class="p">,</span> <span class="n">miniBatchFraction</span><span class="o">=</span><span class="mf">1.0</span><span class="p">,</span> <span class="n">initialWeights</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">intercept</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">validateData</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">convergenceTol</span><span class="o">=</span><span class="mf">0.001</span><span class="p">):</span> <span class="sd">"""</span> @@ -705,7 +705,7 @@ <span class="nd">@classmethod</span> <span class="nd">@since</span><span class="p">(</span><span class="s2">"1.4.0"</span><span class="p">)</span> -<div class="viewcode-block" id="IsotonicRegressionModel.load"><a class="viewcode-back" href="../../../pyspark.mllib.html#pyspark.mllib.classification.IsotonicRegressionModel.load">[docs]</a> <span class="k">def</span> <span class="nf">load</span><span class="p">(</span><span class="n">cls</span><span class="p">,</span> <span class="n">sc</span><span class="p">,</span> <span class="n">path</span><span class="p">):</span> +<div class="viewcode-block" id="IsotonicRegressionModel.load"><a class="viewcode-back" href="../../../pyspark.mllib.html#pyspark.mllib.classification.IsotonicRegressionModel.load">[docs]</a> <span class="k">def</span> <span class="nf">load</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">sc</span><span class="p">,</span> <span class="n">path</span><span class="p">):</span> <span class="sd">"""Load an IsotonicRegressionModel."""</span> <span class="n">java_model</span> <span class="o">=</span> <span class="n">sc</span><span class="o">.</span><span class="n">_jvm</span><span class="o">.</span><span class="n">org</span><span class="o">.</span><span class="n">apache</span><span class="o">.</span><span class="n">spark</span><span class="o">.</span><span class="n">mllib</span><span class="o">.</span><span class="n">regression</span><span class="o">.</span><span class="n">IsotonicRegressionModel</span><span class="o">.</span><span class="n">load</span><span class="p">(</span> <span class="n">sc</span><span class="o">.</span><span class="n">_jsc</span><span class="o">.</span><span class="n">sc</span><span class="p">(),</span> <span class="n">path</span><span class="p">)</span> @@ -740,7 +740,7 @@ <span class="nd">@classmethod</span> <span class="nd">@since</span><span class="p">(</span><span class="s2">"1.4.0"</span><span class="p">)</span> -<div class="viewcode-block" id="IsotonicRegression.train"><a class="viewcode-back" href="../../../pyspark.mllib.html#pyspark.mllib.classification.IsotonicRegression.train">[docs]</a> <span class="k">def</span> <span class="nf">train</span><span class="p">(</span><span class="n">cls</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">isotonic</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span> +<div class="viewcode-block" id="IsotonicRegression.train"><a class="viewcode-back" href="../../../pyspark.mllib.html#pyspark.mllib.classification.IsotonicRegression.train">[docs]</a> <span class="k">def</span> <span class="nf">train</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">isotonic</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span> <span class="sd">"""</span> <span class="sd"> Train an isotonic regression model on the given data.</span> @@ -840,7 +840,7 @@ <span class="bp">self</span><span class="o">.</span><span class="n">miniBatchFraction</span> <span class="o">=</span> <span class="n">miniBatchFraction</span> <span class="bp">self</span><span class="o">.</span><span class="n">convergenceTol</span> <span class="o">=</span> <span class="n">convergenceTol</span> <span class="bp">self</span><span class="o">.</span><span class="n">_model</span> <span class="o">=</span> <span class="kc">None</span> - <span class="nb">super</span><span class="p">(</span><span class="n">StreamingLinearRegressionWithSGD</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span> + <span class="nb">super</span><span class="p">(</span><span class="n">StreamingLinearRegressionWithSGD</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span> <span class="n">model</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_model</span><span class="p">)</span> <span class="nd">@since</span><span class="p">(</span><span class="s2">"1.5.0"</span><span class="p">)</span> @@ -874,7 +874,7 @@ <span class="kn">import</span> <span class="nn">doctest</span> <span class="kn">from</span> <span class="nn">pyspark.sql</span> <span class="k">import</span> <span class="n">SparkSession</span> <span class="kn">import</span> <span class="nn">pyspark.mllib.regression</span> - <span class="n">globs</span> <span class="o">=</span> <span class="n">pyspark</span><span class="o">.</span><span class="n">mllib</span><span class="o">.</span><span class="n">regression</span><span class="o">.</span><span class="n">__dict__</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> + <span class="n">globs</span> <span class="o">=</span> <span class="n">pyspark</span><span class="o">.</span><span class="n">mllib</span><span class="o">.</span><span class="n">regression</span><span class="o">.</span><span class="vm">__dict__</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> <span class="n">spark</span> <span class="o">=</span> <span class="n">SparkSession</span><span class="o">.</span><span class="n">builder</span>\ <span class="o">.</span><span class="n">master</span><span class="p">(</span><span class="s2">"local[2]"</span><span class="p">)</span>\ <span class="o">.</span><span class="n">appName</span><span class="p">(</span><span class="s2">"mllib.regression tests"</span><span class="p">)</span>\ @@ -885,7 +885,7 @@ <span class="k">if</span> <span class="n">failure_count</span><span class="p">:</span> <span class="n">exit</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span> -<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s2">"__main__"</span><span class="p">:</span> +<span class="k">if</span> <span class="vm">__name__</span> <span class="o">==</span> <span class="s2">"__main__"</span><span class="p">:</span> <span class="n">_test</span><span class="p">()</span> </pre></div>
http://git-wip-us.apache.org/repos/asf/spark-website/blob/6bbac496/site/docs/2.1.2/api/python/_modules/pyspark/mllib/tree.html ---------------------------------------------------------------------- diff --git a/site/docs/2.1.2/api/python/_modules/pyspark/mllib/tree.html b/site/docs/2.1.2/api/python/_modules/pyspark/mllib/tree.html index e060769..ed86923 100644 --- a/site/docs/2.1.2/api/python/_modules/pyspark/mllib/tree.html +++ b/site/docs/2.1.2/api/python/_modules/pyspark/mllib/tree.html @@ -170,7 +170,7 @@ <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">toDebugString</span><span class="p">()</span></div> <span class="nd">@classmethod</span> - <span class="k">def</span> <span class="nf">_java_loader_class</span><span class="p">(</span><span class="n">cls</span><span class="p">):</span> + <span class="k">def</span> <span class="nf">_java_loader_class</span><span class="p">(</span><span class="bp">cls</span><span class="p">):</span> <span class="k">return</span> <span class="s2">"org.apache.spark.mllib.tree.model.DecisionTreeModel"</span></div> @@ -183,7 +183,7 @@ <span class="sd"> """</span> <span class="nd">@classmethod</span> - <span class="k">def</span> <span class="nf">_train</span><span class="p">(</span><span class="n">cls</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="nb">type</span><span class="p">,</span> <span class="n">numClasses</span><span class="p">,</span> <span class="n">features</span><span class="p">,</span> <span class="n">impurity</span><span class="o">=</span><span class="s2">"gini"</span><span class="p">,</span> <span class="n">maxDepth</span><span class="o">=</span><span class="mi">5</span><span class="p">,</span> <span class="n">maxBins</span><span class="o">=</span><span class="mi">32</span><span class="p">,</span> + <span class="k">def</span> <span class="nf">_train</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="nb">type</span><span class="p">,</span> <span class="n">numClasses</span><span class="p">,</span> <span class="n">features</span><span class="p">,</span> <span class="n">impurity</span><span class="o">=</span><span class="s2">"gini"</span><span class="p">,</span> <span class="n">maxDepth</span><span class="o">=</span><span class="mi">5</span><span class="p">,</span> <span class="n">maxBins</span><span class="o">=</span><span class="mi">32</span><span class="p">,</span> <span class="n">minInstancesPerNode</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">minInfoGain</span><span class="o">=</span><span class="mf">0.0</span><span class="p">):</span> <span class="n">first</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">first</span><span class="p">()</span> <span class="k">assert</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">first</span><span class="p">,</span> <span class="n">LabeledPoint</span><span class="p">),</span> <span class="s2">"the data should be RDD of LabeledPoint"</span> @@ -193,7 +193,7 @@ <span class="nd">@classmethod</span> <span class="nd">@since</span><span class="p">(</span><span class="s2">"1.1.0"</span><span class="p">)</span> -<div class="viewcode-block" id="DecisionTree.trainClassifier"><a class="viewcode-back" href="../../../pyspark.mllib.html#pyspark.mllib.tree.DecisionTree.trainClassifier">[docs]</a> <span class="k">def</span> <span class="nf">trainClassifier</span><span class="p">(</span><span class="n">cls</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">numClasses</span><span class="p">,</span> <span class="n">categoricalFeaturesInfo</span><span class="p">,</span> +<div class="viewcode-block" id="DecisionTree.trainClassifier"><a class="viewcode-back" href="../../../pyspark.mllib.html#pyspark.mllib.tree.DecisionTree.trainClassifier">[docs]</a> <span class="k">def</span> <span class="nf">trainClassifier</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">numClasses</span><span class="p">,</span> <span class="n">categoricalFeaturesInfo</span><span class="p">,</span> <span class="n">impurity</span><span class="o">=</span><span class="s2">"gini"</span><span class="p">,</span> <span class="n">maxDepth</span><span class="o">=</span><span class="mi">5</span><span class="p">,</span> <span class="n">maxBins</span><span class="o">=</span><span class="mi">32</span><span class="p">,</span> <span class="n">minInstancesPerNode</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">minInfoGain</span><span class="o">=</span><span class="mf">0.0</span><span class="p">):</span> <span class="sd">"""</span> @@ -260,12 +260,12 @@ <span class="sd"> >>> model.predict(rdd).collect()</span> <span class="sd"> [1.0, 0.0]</span> <span class="sd"> """</span> - <span class="k">return</span> <span class="n">cls</span><span class="o">.</span><span class="n">_train</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="s2">"classification"</span><span class="p">,</span> <span class="n">numClasses</span><span class="p">,</span> <span class="n">categoricalFeaturesInfo</span><span class="p">,</span> + <span class="k">return</span> <span class="bp">cls</span><span class="o">.</span><span class="n">_train</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="s2">"classification"</span><span class="p">,</span> <span class="n">numClasses</span><span class="p">,</span> <span class="n">categoricalFeaturesInfo</span><span class="p">,</span> <span class="n">impurity</span><span class="p">,</span> <span class="n">maxDepth</span><span class="p">,</span> <span class="n">maxBins</span><span class="p">,</span> <span class="n">minInstancesPerNode</span><span class="p">,</span> <span class="n">minInfoGain</span><span class="p">)</span></div> <span class="nd">@classmethod</span> <span class="nd">@since</span><span class="p">(</span><span class="s2">"1.1.0"</span><span class="p">)</span> -<div class="viewcode-block" id="DecisionTree.trainRegressor"><a class="viewcode-back" href="../../../pyspark.mllib.html#pyspark.mllib.tree.DecisionTree.trainRegressor">[docs]</a> <span class="k">def</span> <span class="nf">trainRegressor</span><span class="p">(</span><span class="n">cls</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">categoricalFeaturesInfo</span><span class="p">,</span> +<div class="viewcode-block" id="DecisionTree.trainRegressor"><a class="viewcode-back" href="../../../pyspark.mllib.html#pyspark.mllib.tree.DecisionTree.trainRegressor">[docs]</a> <span class="k">def</span> <span class="nf">trainRegressor</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">categoricalFeaturesInfo</span><span class="p">,</span> <span class="n">impurity</span><span class="o">=</span><span class="s2">"variance"</span><span class="p">,</span> <span class="n">maxDepth</span><span class="o">=</span><span class="mi">5</span><span class="p">,</span> <span class="n">maxBins</span><span class="o">=</span><span class="mi">32</span><span class="p">,</span> <span class="n">minInstancesPerNode</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">minInfoGain</span><span class="o">=</span><span class="mf">0.0</span><span class="p">):</span> <span class="sd">"""</span> @@ -320,7 +320,7 @@ <span class="sd"> >>> model.predict(rdd).collect()</span> <span class="sd"> [1.0, 0.0]</span> <span class="sd"> """</span> - <span class="k">return</span> <span class="n">cls</span><span class="o">.</span><span class="n">_train</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="s2">"regression"</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">categoricalFeaturesInfo</span><span class="p">,</span> + <span class="k">return</span> <span class="bp">cls</span><span class="o">.</span><span class="n">_train</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="s2">"regression"</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">categoricalFeaturesInfo</span><span class="p">,</span> <span class="n">impurity</span><span class="p">,</span> <span class="n">maxDepth</span><span class="p">,</span> <span class="n">maxBins</span><span class="p">,</span> <span class="n">minInstancesPerNode</span><span class="p">,</span> <span class="n">minInfoGain</span><span class="p">)</span></div></div> @@ -333,7 +333,7 @@ <span class="sd"> """</span> <span class="nd">@classmethod</span> - <span class="k">def</span> <span class="nf">_java_loader_class</span><span class="p">(</span><span class="n">cls</span><span class="p">):</span> + <span class="k">def</span> <span class="nf">_java_loader_class</span><span class="p">(</span><span class="bp">cls</span><span class="p">):</span> <span class="k">return</span> <span class="s2">"org.apache.spark.mllib.tree.model.RandomForestModel"</span></div> @@ -348,11 +348,11 @@ <span class="n">supportedFeatureSubsetStrategies</span> <span class="o">=</span> <span class="p">(</span><span class="s2">"auto"</span><span class="p">,</span> <span class="s2">"all"</span><span class="p">,</span> <span class="s2">"sqrt"</span><span class="p">,</span> <span class="s2">"log2"</span><span class="p">,</span> <span class="s2">"onethird"</span><span class="p">)</span> <span class="nd">@classmethod</span> - <span class="k">def</span> <span class="nf">_train</span><span class="p">(</span><span class="n">cls</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">algo</span><span class="p">,</span> <span class="n">numClasses</span><span class="p">,</span> <span class="n">categoricalFeaturesInfo</span><span class="p">,</span> <span class="n">numTrees</span><span class="p">,</span> + <span class="k">def</span> <span class="nf">_train</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">algo</span><span class="p">,</span> <span class="n">numClasses</span><span class="p">,</span> <span class="n">categoricalFeaturesInfo</span><span class="p">,</span> <span class="n">numTrees</span><span class="p">,</span> <span class="n">featureSubsetStrategy</span><span class="p">,</span> <span class="n">impurity</span><span class="p">,</span> <span class="n">maxDepth</span><span class="p">,</span> <span class="n">maxBins</span><span class="p">,</span> <span class="n">seed</span><span class="p">):</span> <span class="n">first</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">first</span><span class="p">()</span> <span class="k">assert</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">first</span><span class="p">,</span> <span class="n">LabeledPoint</span><span class="p">),</span> <span class="s2">"the data should be RDD of LabeledPoint"</span> - <span class="k">if</span> <span class="n">featureSubsetStrategy</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">cls</span><span class="o">.</span><span class="n">supportedFeatureSubsetStrategies</span><span class="p">:</span> + <span class="k">if</span> <span class="n">featureSubsetStrategy</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">cls</span><span class="o">.</span><span class="n">supportedFeatureSubsetStrategies</span><span class="p">:</span> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">"unsupported featureSubsetStrategy: </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="n">featureSubsetStrategy</span><span class="p">)</span> <span class="k">if</span> <span class="n">seed</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> <span class="n">seed</span> <span class="o">=</span> <span class="n">random</span><span class="o">.</span><span class="n">randint</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span> <span class="o"><<</span> <span class="mi">30</span><span class="p">)</span> @@ -363,7 +363,7 @@ <span class="nd">@classmethod</span> <span class="nd">@since</span><span class="p">(</span><span class="s2">"1.2.0"</span><span class="p">)</span> -<div class="viewcode-block" id="RandomForest.trainClassifier"><a class="viewcode-back" href="../../../pyspark.mllib.html#pyspark.mllib.tree.RandomForest.trainClassifier">[docs]</a> <span class="k">def</span> <span class="nf">trainClassifier</span><span class="p">(</span><span class="n">cls</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">numClasses</span><span class="p">,</span> <span class="n">categoricalFeaturesInfo</span><span class="p">,</span> <span class="n">numTrees</span><span class="p">,</span> +<div class="viewcode-block" id="RandomForest.trainClassifier"><a class="viewcode-back" href="../../../pyspark.mllib.html#pyspark.mllib.tree.RandomForest.trainClassifier">[docs]</a> <span class="k">def</span> <span class="nf">trainClassifier</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">numClasses</span><span class="p">,</span> <span class="n">categoricalFeaturesInfo</span><span class="p">,</span> <span class="n">numTrees</span><span class="p">,</span> <span class="n">featureSubsetStrategy</span><span class="o">=</span><span class="s2">"auto"</span><span class="p">,</span> <span class="n">impurity</span><span class="o">=</span><span class="s2">"gini"</span><span class="p">,</span> <span class="n">maxDepth</span><span class="o">=</span><span class="mi">4</span><span class="p">,</span> <span class="n">maxBins</span><span class="o">=</span><span class="mi">32</span><span class="p">,</span> <span class="n">seed</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> <span class="sd">"""</span> @@ -449,13 +449,13 @@ <span class="sd"> >>> model.predict(rdd).collect()</span> <span class="sd"> [1.0, 0.0]</span> <span class="sd"> """</span> - <span class="k">return</span> <span class="n">cls</span><span class="o">.</span><span class="n">_train</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="s2">"classification"</span><span class="p">,</span> <span class="n">numClasses</span><span class="p">,</span> + <span class="k">return</span> <span class="bp">cls</span><span class="o">.</span><span class="n">_train</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="s2">"classification"</span><span class="p">,</span> <span class="n">numClasses</span><span class="p">,</span> <span class="n">categoricalFeaturesInfo</span><span class="p">,</span> <span class="n">numTrees</span><span class="p">,</span> <span class="n">featureSubsetStrategy</span><span class="p">,</span> <span class="n">impurity</span><span class="p">,</span> <span class="n">maxDepth</span><span class="p">,</span> <span class="n">maxBins</span><span class="p">,</span> <span class="n">seed</span><span class="p">)</span></div> <span class="nd">@classmethod</span> <span class="nd">@since</span><span class="p">(</span><span class="s2">"1.2.0"</span><span class="p">)</span> -<div class="viewcode-block" id="RandomForest.trainRegressor"><a class="viewcode-back" href="../../../pyspark.mllib.html#pyspark.mllib.tree.RandomForest.trainRegressor">[docs]</a> <span class="k">def</span> <span class="nf">trainRegressor</span><span class="p">(</span><span class="n">cls</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">categoricalFeaturesInfo</span><span class="p">,</span> <span class="n">numTrees</span><span class="p">,</span> <span class="n">featureSubsetStrategy</span><span class="o">=</span><span class="s2">"auto"</span><span class="p">,</span> +<div class="viewcode-block" id="RandomForest.trainRegressor"><a class="viewcode-back" href="../../../pyspark.mllib.html#pyspark.mllib.tree.RandomForest.trainRegressor">[docs]</a> <span class="k">def</span> <span class="nf">trainRegressor</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">categoricalFeaturesInfo</span><span class="p">,</span> <span class="n">numTrees</span><span class="p">,</span> <span class="n">featureSubsetStrategy</span><span class="o">=</span><span class="s2">"auto"</span><span class="p">,</span> <span class="n">impurity</span><span class="o">=</span><span class="s2">"variance"</span><span class="p">,</span> <span class="n">maxDepth</span><span class="o">=</span><span class="mi">4</span><span class="p">,</span> <span class="n">maxBins</span><span class="o">=</span><span class="mi">32</span><span class="p">,</span> <span class="n">seed</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> <span class="sd">"""</span> <span class="sd"> Train a random forest model for regression.</span> @@ -519,7 +519,7 @@ <span class="sd"> >>> model.predict(rdd).collect()</span> <span class="sd"> [1.0, 0.5]</span> <span class="sd"> """</span> - <span class="k">return</span> <span class="n">cls</span><span class="o">.</span><span class="n">_train</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="s2">"regression"</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">categoricalFeaturesInfo</span><span class="p">,</span> <span class="n">numTrees</span><span class="p">,</span> + <span class="k">return</span> <span class="bp">cls</span><span class="o">.</span><span class="n">_train</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="s2">"regression"</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">categoricalFeaturesInfo</span><span class="p">,</span> <span class="n">numTrees</span><span class="p">,</span> <span class="n">featureSubsetStrategy</span><span class="p">,</span> <span class="n">impurity</span><span class="p">,</span> <span class="n">maxDepth</span><span class="p">,</span> <span class="n">maxBins</span><span class="p">,</span> <span class="n">seed</span><span class="p">)</span></div></div> @@ -532,7 +532,7 @@ <span class="sd"> """</span> <span class="nd">@classmethod</span> - <span class="k">def</span> <span class="nf">_java_loader_class</span><span class="p">(</span><span class="n">cls</span><span class="p">):</span> + <span class="k">def</span> <span class="nf">_java_loader_class</span><span class="p">(</span><span class="bp">cls</span><span class="p">):</span> <span class="k">return</span> <span class="s2">"org.apache.spark.mllib.tree.model.GradientBoostedTreesModel"</span></div> @@ -545,7 +545,7 @@ <span class="sd"> """</span> <span class="nd">@classmethod</span> - <span class="k">def</span> <span class="nf">_train</span><span class="p">(</span><span class="n">cls</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">algo</span><span class="p">,</span> <span class="n">categoricalFeaturesInfo</span><span class="p">,</span> + <span class="k">def</span> <span class="nf">_train</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">algo</span><span class="p">,</span> <span class="n">categoricalFeaturesInfo</span><span class="p">,</span> <span class="n">loss</span><span class="p">,</span> <span class="n">numIterations</span><span class="p">,</span> <span class="n">learningRate</span><span class="p">,</span> <span class="n">maxDepth</span><span class="p">,</span> <span class="n">maxBins</span><span class="p">):</span> <span class="n">first</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">first</span><span class="p">()</span> <span class="k">assert</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">first</span><span class="p">,</span> <span class="n">LabeledPoint</span><span class="p">),</span> <span class="s2">"the data should be RDD of LabeledPoint"</span> @@ -555,7 +555,7 @@ <span class="nd">@classmethod</span> <span class="nd">@since</span><span class="p">(</span><span class="s2">"1.3.0"</span><span class="p">)</span> -<div class="viewcode-block" id="GradientBoostedTrees.trainClassifier"><a class="viewcode-back" href="../../../pyspark.mllib.html#pyspark.mllib.tree.GradientBoostedTrees.trainClassifier">[docs]</a> <span class="k">def</span> <span class="nf">trainClassifier</span><span class="p">(</span><span class="n">cls</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">categoricalFeaturesInfo</span><span class="p">,</span> +<div class="viewcode-block" id="GradientBoostedTrees.trainClassifier"><a class="viewcode-back" href="../../../pyspark.mllib.html#pyspark.mllib.tree.GradientBoostedTrees.trainClassifier">[docs]</a> <span class="k">def</span> <span class="nf">trainClassifier</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">categoricalFeaturesInfo</span><span class="p">,</span> <span class="n">loss</span><span class="o">=</span><span class="s2">"logLoss"</span><span class="p">,</span> <span class="n">numIterations</span><span class="o">=</span><span class="mi">100</span><span class="p">,</span> <span class="n">learningRate</span><span class="o">=</span><span class="mf">0.1</span><span class="p">,</span> <span class="n">maxDepth</span><span class="o">=</span><span class="mi">3</span><span class="p">,</span> <span class="n">maxBins</span><span class="o">=</span><span class="mi">32</span><span class="p">):</span> <span class="sd">"""</span> @@ -619,12 +619,12 @@ <span class="sd"> >>> model.predict(rdd).collect()</span> <span class="sd"> [1.0, 0.0]</span> <span class="sd"> """</span> - <span class="k">return</span> <span class="n">cls</span><span class="o">.</span><span class="n">_train</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="s2">"classification"</span><span class="p">,</span> <span class="n">categoricalFeaturesInfo</span><span class="p">,</span> + <span class="k">return</span> <span class="bp">cls</span><span class="o">.</span><span class="n">_train</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="s2">"classification"</span><span class="p">,</span> <span class="n">categoricalFeaturesInfo</span><span class="p">,</span> <span class="n">loss</span><span class="p">,</span> <span class="n">numIterations</span><span class="p">,</span> <span class="n">learningRate</span><span class="p">,</span> <span class="n">maxDepth</span><span class="p">,</span> <span class="n">maxBins</span><span class="p">)</span></div> <span class="nd">@classmethod</span> <span class="nd">@since</span><span class="p">(</span><span class="s2">"1.3.0"</span><span class="p">)</span> -<div class="viewcode-block" id="GradientBoostedTrees.trainRegressor"><a class="viewcode-back" href="../../../pyspark.mllib.html#pyspark.mllib.tree.GradientBoostedTrees.trainRegressor">[docs]</a> <span class="k">def</span> <span class="nf">trainRegressor</span><span class="p">(</span><span class="n">cls</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">categoricalFeaturesInfo</span><span class="p">,</span> +<div class="viewcode-block" id="GradientBoostedTrees.trainRegressor"><a class="viewcode-back" href="../../../pyspark.mllib.html#pyspark.mllib.tree.GradientBoostedTrees.trainRegressor">[docs]</a> <span class="k">def</span> <span class="nf">trainRegressor</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">categoricalFeaturesInfo</span><span class="p">,</span> <span class="n">loss</span><span class="o">=</span><span class="s2">"leastSquaresError"</span><span class="p">,</span> <span class="n">numIterations</span><span class="o">=</span><span class="mi">100</span><span class="p">,</span> <span class="n">learningRate</span><span class="o">=</span><span class="mf">0.1</span><span class="p">,</span> <span class="n">maxDepth</span><span class="o">=</span><span class="mi">3</span><span class="p">,</span> <span class="n">maxBins</span><span class="o">=</span><span class="mi">32</span><span class="p">):</span> <span class="sd">"""</span> @@ -686,7 +686,7 @@ <span class="sd"> >>> model.predict(rdd).collect()</span> <span class="sd"> [1.0, 0.0]</span> <span class="sd"> """</span> - <span class="k">return</span> <span class="n">cls</span><span class="o">.</span><span class="n">_train</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="s2">"regression"</span><span class="p">,</span> <span class="n">categoricalFeaturesInfo</span><span class="p">,</span> + <span class="k">return</span> <span class="bp">cls</span><span class="o">.</span><span class="n">_train</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="s2">"regression"</span><span class="p">,</span> <span class="n">categoricalFeaturesInfo</span><span class="p">,</span> <span class="n">loss</span><span class="p">,</span> <span class="n">numIterations</span><span class="p">,</span> <span class="n">learningRate</span><span class="p">,</span> <span class="n">maxDepth</span><span class="p">,</span> <span class="n">maxBins</span><span class="p">)</span></div></div> @@ -704,7 +704,7 @@ <span class="k">if</span> <span class="n">failure_count</span><span class="p">:</span> <span class="n">exit</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span> -<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s2">"__main__"</span><span class="p">:</span> +<span class="k">if</span> <span class="vm">__name__</span> <span class="o">==</span> <span class="s2">"__main__"</span><span class="p">:</span> <span class="n">_test</span><span class="p">()</span> </pre></div> http://git-wip-us.apache.org/repos/asf/spark-website/blob/6bbac496/site/docs/2.1.2/api/python/_modules/pyspark/mllib/util.html ---------------------------------------------------------------------- diff --git a/site/docs/2.1.2/api/python/_modules/pyspark/mllib/util.html b/site/docs/2.1.2/api/python/_modules/pyspark/mllib/util.html index 9d1af9a..5d0be6d 100644 --- a/site/docs/2.1.2/api/python/_modules/pyspark/mllib/util.html +++ b/site/docs/2.1.2/api/python/_modules/pyspark/mllib/util.html @@ -462,7 +462,7 @@ <span class="sd"> """</span> <span class="nd">@classmethod</span> -<div class="viewcode-block" id="Loader.load"><a class="viewcode-back" href="../../../pyspark.mllib.html#pyspark.mllib.tree.Loader.load">[docs]</a> <span class="k">def</span> <span class="nf">load</span><span class="p">(</span><span class="n">cls</span><span class="p">,</span> <span class="n">sc</span><span class="p">,</span> <span class="n">path</span><span class="p">):</span> +<div class="viewcode-block" id="Loader.load"><a class="viewcode-back" href="../../../pyspark.mllib.html#pyspark.mllib.tree.Loader.load">[docs]</a> <span class="k">def</span> <span class="nf">load</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">sc</span><span class="p">,</span> <span class="n">path</span><span class="p">):</span> <span class="sd">"""</span> <span class="sd"> Load a model from the given path. The model should have been</span> <span class="sd"> saved using py:meth:`Saveable.save`.</span> @@ -485,21 +485,21 @@ <span class="sd"> """</span> <span class="nd">@classmethod</span> - <span class="k">def</span> <span class="nf">_java_loader_class</span><span class="p">(</span><span class="n">cls</span><span class="p">):</span> + <span class="k">def</span> <span class="nf">_java_loader_class</span><span class="p">(</span><span class="bp">cls</span><span class="p">):</span> <span class="sd">"""</span> <span class="sd"> Returns the full class name of the Java loader. The default</span> <span class="sd"> implementation replaces "pyspark" by "org.apache.spark" in</span> <span class="sd"> the Python full class name.</span> <span class="sd"> """</span> - <span class="n">java_package</span> <span class="o">=</span> <span class="n">cls</span><span class="o">.</span><span class="n">__module__</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s2">"pyspark"</span><span class="p">,</span> <span class="s2">"org.apache.spark"</span><span class="p">)</span> - <span class="k">return</span> <span class="s2">"."</span><span class="o">.</span><span class="n">join</span><span class="p">([</span><span class="n">java_package</span><span class="p">,</span> <span class="n">cls</span><span class="o">.</span><span class="n">__name__</span><span class="p">])</span> + <span class="n">java_package</span> <span class="o">=</span> <span class="bp">cls</span><span class="o">.</span><span class="vm">__module__</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s2">"pyspark"</span><span class="p">,</span> <span class="s2">"org.apache.spark"</span><span class="p">)</span> + <span class="k">return</span> <span class="s2">"."</span><span class="o">.</span><span class="n">join</span><span class="p">([</span><span class="n">java_package</span><span class="p">,</span> <span class="bp">cls</span><span class="o">.</span><span class="vm">__name__</span><span class="p">])</span> <span class="nd">@classmethod</span> - <span class="k">def</span> <span class="nf">_load_java</span><span class="p">(</span><span class="n">cls</span><span class="p">,</span> <span class="n">sc</span><span class="p">,</span> <span class="n">path</span><span class="p">):</span> + <span class="k">def</span> <span class="nf">_load_java</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">sc</span><span class="p">,</span> <span class="n">path</span><span class="p">):</span> <span class="sd">"""</span> <span class="sd"> Load a Java model from the given path.</span> <span class="sd"> """</span> - <span class="n">java_class</span> <span class="o">=</span> <span class="n">cls</span><span class="o">.</span><span class="n">_java_loader_class</span><span class="p">()</span> + <span class="n">java_class</span> <span class="o">=</span> <span class="bp">cls</span><span class="o">.</span><span class="n">_java_loader_class</span><span class="p">()</span> <span class="n">java_obj</span> <span class="o">=</span> <span class="n">sc</span><span class="o">.</span><span class="n">_jvm</span> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">java_class</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">"."</span><span class="p">):</span> <span class="n">java_obj</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="n">java_obj</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span> @@ -507,10 +507,10 @@ <span class="nd">@classmethod</span> <span class="nd">@since</span><span class="p">(</span><span class="s2">"1.3.0"</span><span class="p">)</span> -<div class="viewcode-block" id="JavaLoader.load"><a class="viewcode-back" href="../../../pyspark.mllib.html#pyspark.mllib.tree.JavaLoader.load">[docs]</a> <span class="k">def</span> <span class="nf">load</span><span class="p">(</span><span class="n">cls</span><span class="p">,</span> <span class="n">sc</span><span class="p">,</span> <span class="n">path</span><span class="p">):</span> +<div class="viewcode-block" id="JavaLoader.load"><a class="viewcode-back" href="../../../pyspark.mllib.html#pyspark.mllib.tree.JavaLoader.load">[docs]</a> <span class="k">def</span> <span class="nf">load</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">sc</span><span class="p">,</span> <span class="n">path</span><span class="p">):</span> <span class="sd">"""Load a model from the given path."""</span> - <span class="n">java_model</span> <span class="o">=</span> <span class="n">cls</span><span class="o">.</span><span class="n">_load_java</span><span class="p">(</span><span class="n">sc</span><span class="p">,</span> <span class="n">path</span><span class="p">)</span> - <span class="k">return</span> <span class="n">cls</span><span class="p">(</span><span class="n">java_model</span><span class="p">)</span></div></div> + <span class="n">java_model</span> <span class="o">=</span> <span class="bp">cls</span><span class="o">.</span><span class="n">_load_java</span><span class="p">(</span><span class="n">sc</span><span class="p">,</span> <span class="n">path</span><span class="p">)</span> + <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">java_model</span><span class="p">)</span></div></div> <div class="viewcode-block" id="LinearDataGenerator"><a class="viewcode-back" href="../../../pyspark.mllib.html#pyspark.mllib.tree.LinearDataGenerator">[docs]</a><span class="k">class</span> <span class="nc">LinearDataGenerator</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span> @@ -572,7 +572,7 @@ <span class="n">exit</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span> -<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s2">"__main__"</span><span class="p">:</span> +<span class="k">if</span> <span class="vm">__name__</span> <span class="o">==</span> <span class="s2">"__main__"</span><span class="p">:</span> <span class="n">_test</span><span class="p">()</span> </pre></div> http://git-wip-us.apache.org/repos/asf/spark-website/blob/6bbac496/site/docs/2.1.2/api/python/_modules/pyspark/profiler.html ---------------------------------------------------------------------- diff --git a/site/docs/2.1.2/api/python/_modules/pyspark/profiler.html b/site/docs/2.1.2/api/python/_modules/pyspark/profiler.html index ed21d4c..94f20d9 100644 --- a/site/docs/2.1.2/api/python/_modules/pyspark/profiler.html +++ b/site/docs/2.1.2/api/python/_modules/pyspark/profiler.html @@ -197,7 +197,7 @@ <span class="sd"> cProfile and Accumulator</span> <span class="sd"> """</span> <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">ctx</span><span class="p">):</span> - <span class="n">Profiler</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">ctx</span><span class="p">)</span> + <span class="n">Profiler</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">ctx</span><span class="p">)</span> <span class="c1"># Creates a new accumulator for combining the profiles of different</span> <span class="c1"># partitions of a stage</span> <span class="bp">self</span><span class="o">.</span><span class="n">_accumulator</span> <span class="o">=</span> <span class="n">ctx</span><span class="o">.</span><span class="n">accumulator</span><span class="p">(</span><span class="kc">None</span><span class="p">,</span> <span class="n">PStatsParam</span><span class="p">)</span> @@ -217,7 +217,7 @@ <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_accumulator</span><span class="o">.</span><span class="n">value</span></div></div> -<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s2">"__main__"</span><span class="p">:</span> +<span class="k">if</span> <span class="vm">__name__</span> <span class="o">==</span> <span class="s2">"__main__"</span><span class="p">:</span> <span class="kn">import</span> <span class="nn">doctest</span> <span class="p">(</span><span class="n">failure_count</span><span class="p">,</span> <span class="n">test_count</span><span class="p">)</span> <span class="o">=</span> <span class="n">doctest</span><span class="o">.</span><span class="n">testmod</span><span class="p">()</span> <span class="k">if</span> <span class="n">failure_count</span><span class="p">:</span> http://git-wip-us.apache.org/repos/asf/spark-website/blob/6bbac496/site/docs/2.1.2/api/python/_modules/pyspark/rdd.html ---------------------------------------------------------------------- diff --git a/site/docs/2.1.2/api/python/_modules/pyspark/rdd.html b/site/docs/2.1.2/api/python/_modules/pyspark/rdd.html index 8bac5eb..60eac5a 100644 --- a/site/docs/2.1.2/api/python/_modules/pyspark/rdd.html +++ b/site/docs/2.1.2/api/python/_modules/pyspark/rdd.html @@ -142,8 +142,8 @@ <span class="sd"> >>> BoundedFloat(100.0, 0.95, 95.0, 105.0)</span> <span class="sd"> 100.0</span> <span class="sd"> """</span> - <span class="k">def</span> <span class="nf">__new__</span><span class="p">(</span><span class="n">cls</span><span class="p">,</span> <span class="n">mean</span><span class="p">,</span> <span class="n">confidence</span><span class="p">,</span> <span class="n">low</span><span class="p">,</span> <span class="n">high</span><span class="p">):</span> - <span class="n">obj</span> <span class="o">=</span> <span class="nb">float</span><span class="o">.</span><span class="n">__new__</span><span class="p">(</span><span class="n">cls</span><span class="p">,</span> <span class="n">mean</span><span class="p">)</span> + <span class="k">def</span> <span class="nf">__new__</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">mean</span><span class="p">,</span> <span class="n">confidence</span><span class="p">,</span> <span class="n">low</span><span class="p">,</span> <span class="n">high</span><span class="p">):</span> + <span class="n">obj</span> <span class="o">=</span> <span class="nb">float</span><span class="o">.</span><span class="fm">__new__</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">mean</span><span class="p">)</span> <span class="n">obj</span><span class="o">.</span><span class="n">confidence</span> <span class="o">=</span> <span class="n">confidence</span> <span class="n">obj</span><span class="o">.</span><span class="n">low</span> <span class="o">=</span> <span class="n">low</span> <span class="n">obj</span><span class="o">.</span><span class="n">high</span> <span class="o">=</span> <span class="n">high</span> @@ -198,8 +198,8 @@ <span class="k">if</span> <span class="n">sys</span><span class="o">.</span><span class="n">version</span> <span class="o">>=</span> <span class="s1">'3'</span><span class="p">:</span> <span class="c1"># the representation of unicode string in Python 3 does not have prefix 'u',</span> <span class="c1"># so remove the prefix 'u' for doc tests</span> - <span class="n">literal_re</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">compile</span><span class="p">(</span><span class="s2">r"(\W|^)[uU](['])"</span><span class="p">,</span> <span class="n">re</span><span class="o">.</span><span class="n">UNICODE</span><span class="p">)</span> - <span class="n">f</span><span class="o">.</span><span class="n">__doc__</span> <span class="o">=</span> <span class="n">literal_re</span><span class="o">.</span><span class="n">sub</span><span class="p">(</span><span class="s1">r'\1\2'</span><span class="p">,</span> <span class="n">f</span><span class="o">.</span><span class="n">__doc__</span><span class="p">)</span> + <span class="n">literal_re</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">compile</span><span class="p">(</span><span class="sa">r</span><span class="s2">"(\W|^)[uU](['])"</span><span class="p">,</span> <span class="n">re</span><span class="o">.</span><span class="n">UNICODE</span><span class="p">)</span> + <span class="n">f</span><span class="o">.</span><span class="vm">__doc__</span> <span class="o">=</span> <span class="n">literal_re</span><span class="o">.</span><span class="n">sub</span><span class="p">(</span><span class="sa">r</span><span class="s1">'\1\2'</span><span class="p">,</span> <span class="n">f</span><span class="o">.</span><span class="vm">__doc__</span><span class="p">)</span> <span class="k">return</span> <span class="n">f</span> @@ -811,8 +811,8 @@ <span class="k">else</span><span class="p">:</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">):</span> <span class="k">yield</span> <span class="n">i</span> - <span class="k">return</span> <span class="p">(</span><span class="n">x</span><span class="o">.</span><span class="n">rstrip</span><span class="p">(</span><span class="n">b</span><span class="s1">'</span><span class="se">\n</span><span class="s1">'</span><span class="p">)</span><span class="o">.</span><span class="n">decode</span><span class="p">(</span><span class="s1">'utf-8'</span><span class="p">)</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> - <span class="n">chain</span><span class="p">(</span><span class="nb">iter</span><span class="p">(</span><span class="n">pipe</span><span class="o">.</span><span class="n">stdout</span><span class="o">.</span><span class="n">readline</span><span class="p">,</span> <span class="n">b</span><span class="s1">''</span><span class="p">),</span> <span class="n">check_return_code</span><span class="p">()))</span> + <span class="k">return</span> <span class="p">(</span><span class="n">x</span><span class="o">.</span><span class="n">rstrip</span><span class="p">(</span><span class="sa">b</span><span class="s1">'</span><span class="se">\n</span><span class="s1">'</span><span class="p">)</span><span class="o">.</span><span class="n">decode</span><span class="p">(</span><span class="s1">'utf-8'</span><span class="p">)</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> + <span class="n">chain</span><span class="p">(</span><span class="nb">iter</span><span class="p">(</span><span class="n">pipe</span><span class="o">.</span><span class="n">stdout</span><span class="o">.</span><span class="n">readline</span><span class="p">,</span> <span class="sa">b</span><span class="s1">''</span><span class="p">),</span> <span class="n">check_return_code</span><span class="p">()))</span> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">mapPartitions</span><span class="p">(</span><span class="n">func</span><span class="p">)</span></div> <div class="viewcode-block" id="RDD.foreach"><a class="viewcode-back" href="../../pyspark.html#pyspark.RDD.foreach">[docs]</a> <span class="k">def</span> <span class="nf">foreach</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">f</span><span class="p">):</span> @@ -1200,7 +1200,7 @@ <span class="k">except</span> <span class="ne">TypeError</span><span class="p">:</span> <span class="k">pass</span> <span class="c1"># objects in buckets do not support '-'</span> <span class="k">else</span><span class="p">:</span> - <span class="k">if</span> <span class="nb">max</span><span class="p">(</span><span class="n">steps</span><span class="p">)</span> <span class="o">-</span> <span class="nb">min</span><span class="p">(</span><span class="n">steps</span><span class="p">)</span> <span class="o"><</span> <span class="mi">1</span><span class="n">e</span><span class="o">-</span><span class="mi">10</span><span class="p">:</span> <span class="c1"># handle precision errors</span> + <span class="k">if</span> <span class="nb">max</span><span class="p">(</span><span class="n">steps</span><span class="p">)</span> <span class="o">-</span> <span class="nb">min</span><span class="p">(</span><span class="n">steps</span><span class="p">)</span> <span class="o"><</span> <span class="mf">1e-10</span><span class="p">:</span> <span class="c1"># handle precision errors</span> <span class="n">even</span> <span class="o">=</span> <span class="kc">True</span> <span class="n">inc</span> <span class="o">=</span> <span class="p">(</span><span class="n">maxv</span> <span class="o">-</span> <span class="n">minv</span><span class="p">)</span> <span class="o">/</span> <span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">buckets</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> @@ -2518,7 +2518,7 @@ <span class="n">exit</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span> -<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s2">"__main__"</span><span class="p">:</span> +<span class="k">if</span> <span class="vm">__name__</span> <span class="o">==</span> <span class="s2">"__main__"</span><span class="p">:</span> <span class="n">_test</span><span class="p">()</span> </pre></div> --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org