<!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"> <!-- Mirrored from scikit-learn.org/stable/modules/generated/sklearn.ensemble.GradientBoostingClassifier.html by HTTrack Website Copier/3.x [XR&CO'2013], Thu, 15 May 2014 06:18:14 GMT --> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>3.2.3.3.5. sklearn.ensemble.GradientBoostingClassifier — scikit-learn 0.14 documentation</title> <!-- htmltitle is before nature.css - we use this hack to load bootstrap first --> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <link rel="stylesheet" href="../../_static/css/bootstrap.min.css" media="screen" /> <link rel="stylesheet" href="../../_static/css/bootstrap-responsive.css"/> <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: '0.14', 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="shortcut icon" href="../../_static/favicon.ico"/> <link rel="author" title="About these documents" href="../../about.html" /> <link rel="top" title="scikit-learn 0.14 documentation" href="../../index-2.html" /> <link rel="up" title="Reference" href="../classes.html" /> <link rel="next" title="3.2.3.3.6. sklearn.ensemble.GradientBoostingRegressor" href="sklearn.ensemble.GradientBoostingRegressor.html" /> <link rel="prev" title="sklearn.ensemble.AdaBoostRegressor" href="sklearn.ensemble.AdaBoostRegressor.html" /> <script type="text/javascript" src="../../_static/sidebar.js"></script> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <script src="../../_static/js/bootstrap.min.js" type="text/javascript"></script> <link rel="canonical" href="sklearn.ensemble.GradientBoostingClassifier.html" /> <script type="text/javascript"> $("div.buttonNext, div.buttonPrevious").hover( function () { $(this).css('background-color', '#FF9C34'); }, function () { $(this).css('background-color', '#A7D6E2'); } ); var bodywrapper = $('.bodywrapper'); var sidebarbutton = $('#sidebarbutton'); sidebarbutton.css({'height': '900px'}); </script> </head> <body> <div class="header-wrapper"> <div class="header"> <p class="logo"><a href="../../index-2.html"> <img src="../../_static/scikit-learn-logo-small.png" alt="Logo"/> </a> </p><div class="navbar"> <ul> <li><a href="../../index-2.html">Home</a></li> <li><a href="../../install.html">Installation</a></li> <li class="btn-li"><div class="btn-group"> <a href="../../documentation.html">Documentation</a> <a class="btn dropdown-toggle" data-toggle="dropdown"> <span class="caret"></span> </a> <ul class="dropdown-menu"> <li class="link-title">Scikit-learn 0.14 (stable)</li> <li><a href="../../tutorial/basic/tutorial.html">Quick Start</a></li> <li><a href="../../tutorial/index.html">Tutorials</a></li> <li><a href="../../user_guide.html">User guide</a></li> <li><a href="../classes.html">API</a></li> <li class="divider"></li> <li><a href="http://scikit-learn.org/dev/documentation.html">Development</a></li> <li><a href="http://scikit-learn.org/0.13/">Scikit-learn 0.13</a></li> <li><a href="http://scikit-learn.org/0.12/">Scikit-learn 0.12</a></li> <li><a href="http://scikit-learn.org/0.11/">Scikit-learn 0.11</a></li> <li><a href="../../documentation.html">More versions...</a></li> </ul> </div> </li> <li><a href="../../auto_examples/index.html">Examples</a></li> </ul> <div class="search_form"> <div id="cse" style="width: 100%;"></div> </div> </div> <!-- end navbar --></div> </div> <!-- Github "fork me" ribbon --> <a href="https://github.com/scikit-learn/scikit-learn"> <img class="fork-me" style="position: absolute; top: 0; right: 0; border: 0;" src="../../_static/img/forkme.png" alt="Fork me on GitHub" /> </a> <div class="content-wrapper"> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <div class="rel"> <!-- rellinks[1:] is an ugly hack to avoid link to module index --> <div class="rellink"> <a href="sklearn.ensemble.AdaBoostRegressor.html" accesskey="P">Previous <br/> <span class="smallrellink"> sklearn.ensemble... </span> <span class="hiddenrellink"> sklearn.ensemble.AdaBoostRegressor </span> </a> </div> <div class="spacer"> </div> <div class="rellink"> <a href="sklearn.ensemble.GradientBoostingRegressor.html" accesskey="N">Next <br/> <span class="smallrellink"> 3.2.3.3.6. sklea... </span> <span class="hiddenrellink"> 3.2.3.3.6. sklearn.ensemble.GradientBoostingRegressor </span> </a> </div> <!-- Ad a link to the 'up' page --> <div class="spacer"> </div> <div class="rellink"> <a href="../classes.html"> Up <br/> <span class="smallrellink"> Reference </span> <span class="hiddenrellink"> Reference </span> </a> </div> </div> <p class="doc-version">This documentation is for scikit-learn <strong>version 0.14</strong> — <a href="../../support.html#documentation-resources">Other versions</a></p> <p class="citing">If you use the software, please consider <a href="../../about.html#citing-scikit-learn">citing scikit-learn</a>.</p> <ul> <li><a class="reference internal" href="#">3.2.3.3.5. sklearn.ensemble.GradientBoostingClassifier</a></li> </ul> </div> </div> <div class="content"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="sklearn-ensemble-gradientboostingclassifier"> <h1>3.2.3.3.5. sklearn.ensemble.GradientBoostingClassifier<a class="headerlink" href="#sklearn-ensemble-gradientboostingclassifier" title="Permalink to this headline">¶</a></h1> <dl class="class"> <dt id="sklearn.ensemble.GradientBoostingClassifier"> <em class="property">class </em><tt class="descclassname">sklearn.ensemble.</tt><tt class="descname">GradientBoostingClassifier</tt><big>(</big><em>loss='deviance'</em>, <em>learning_rate=0.1</em>, <em>n_estimators=100</em>, <em>subsample=1.0</em>, <em>min_samples_split=2</em>, <em>min_samples_leaf=1</em>, <em>max_depth=3</em>, <em>init=None</em>, <em>random_state=None</em>, <em>max_features=None</em>, <em>verbose=0</em><big>)</big><a class="headerlink" href="#sklearn.ensemble.GradientBoostingClassifier" title="Permalink to this definition">¶</a></dt> <dd><p>Gradient Boosting for classification.</p> <p>GB builds an additive model in a forward stage-wise fashion; it allows for the optimization of arbitrary differentiable loss functions. In each stage <tt class="docutils literal"><span class="pre">n_classes_</span></tt> regression trees are fit on the negative gradient of the binomial or multinomial deviance loss function. Binary classification is a special case where only a single regression tree is induced.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters :</th><td class="field-body"><p class="first"><strong>loss</strong> : {‘deviance’}, optional (default=’deviance’)</p> <blockquote> <div><p>loss function to be optimized. ‘deviance’ refers to deviance (= logistic regression) for classification with probabilistic outputs.</p> </div></blockquote> <p><strong>learning_rate</strong> : float, optional (default=0.1)</p> <blockquote> <div><p>learning rate shrinks the contribution of each tree by <cite>learning_rate</cite>. There is a trade-off between learning_rate and n_estimators.</p> </div></blockquote> <p><strong>n_estimators</strong> : int (default=100)</p> <blockquote> <div><p>The number of boosting stages to perform. Gradient boosting is fairly robust to over-fitting so a large number usually results in better performance.</p> </div></blockquote> <p><strong>max_depth</strong> : integer, optional (default=3)</p> <blockquote> <div><p>maximum depth of the individual regression estimators. The maximum depth limits the number of nodes in the tree. Tune this parameter for best performance; the best value depends on the interaction of the input variables.</p> </div></blockquote> <p><strong>min_samples_split</strong> : integer, optional (default=2)</p> <blockquote> <div><p>The minimum number of samples required to split an internal node.</p> </div></blockquote> <p><strong>min_samples_leaf</strong> : integer, optional (default=1)</p> <blockquote> <div><p>The minimum number of samples required to be at a leaf node.</p> </div></blockquote> <p><strong>subsample</strong> : float, optional (default=1.0)</p> <blockquote> <div><p>The fraction of samples to be used for fitting the individual base learners. If smaller than 1.0 this results in Stochastic Gradient Boosting. <cite>subsample</cite> interacts with the parameter <cite>n_estimators</cite>. Choosing <cite>subsample < 1.0</cite> leads to a reduction of variance and an increase in bias.</p> </div></blockquote> <p><strong>max_features</strong> : int, float, string or None, optional (default=”auto”)</p> <blockquote> <div><dl class="docutils"> <dt>The number of features to consider when looking for the best split:</dt> <dd><ul class="first last simple"> <li>If int, then consider <cite>max_features</cite> features at each split.</li> <li>If float, then <cite>max_features</cite> is a percentage and <cite>int(max_features * n_features)</cite> features are considered at each split.</li> <li>If “auto”, then <cite>max_features=sqrt(n_features)</cite>.</li> <li>If “sqrt”, then <cite>max_features=sqrt(n_features)</cite>.</li> <li>If “log2”, then <cite>max_features=log2(n_features)</cite>.</li> <li>If None, then <cite>max_features=n_features</cite>.</li> </ul> </dd> </dl> <p>Choosing <cite>max_features < n_features</cite> leads to a reduction of variance and an increase in bias.</p> </div></blockquote> <p><strong>init</strong> : BaseEstimator, None, optional (default=None)</p> <blockquote> <div><p>An estimator object that is used to compute the initial predictions. <tt class="docutils literal"><span class="pre">init</span></tt> has to provide <tt class="docutils literal"><span class="pre">fit</span></tt> and <tt class="docutils literal"><span class="pre">predict</span></tt>. If None it uses <tt class="docutils literal"><span class="pre">loss.init_estimator</span></tt>.</p> </div></blockquote> <p><strong>verbose</strong> : int, default: 0</p> <blockquote class="last"> <div><p>Enable verbose output. If 1 then it prints progress and performance once in a while (the more trees the lower the frequency). If greater than 1 then it prints progress and performance for every tree.</p> </div></blockquote> </td> </tr> </tbody> </table> <div class="admonition seealso"> <p class="first admonition-title">See also</p> <p class="last"><a class="reference internal" href="sklearn.tree.DecisionTreeClassifier.html#sklearn.tree.DecisionTreeClassifier" title="sklearn.tree.DecisionTreeClassifier"><tt class="xref py py-obj docutils literal"><span class="pre">sklearn.tree.DecisionTreeClassifier</span></tt></a>, <a class="reference internal" href="sklearn.ensemble.RandomForestClassifier.html#sklearn.ensemble.RandomForestClassifier" title="sklearn.ensemble.RandomForestClassifier"><tt class="xref py py-obj docutils literal"><span class="pre">RandomForestClassifier</span></tt></a></p> </div> <p class="rubric">References</p> <p>J. Friedman, Greedy Function Approximation: A Gradient Boosting Machine, The Annals of Statistics, Vol. 29, No. 5, 2001.</p> <ol class="upperalpha simple" start="10"> <li>Friedman, Stochastic Gradient Boosting, 1999</li> </ol> <p>T. Hastie, R. Tibshirani and J. Friedman. Elements of Statistical Learning Ed. 2, Springer, 2009.</p> <p class="rubric">Attributes</p> <table border="1" class="docutils"> <colgroup> <col width="31%" /> <col width="20%" /> <col width="49%" /> </colgroup> <tbody valign="top"> <tr class="row-odd"><td><cite>feature_importances_</cite></td> <td>array, shape = [n_features]</td> <td>The feature importances (the higher, the more important the feature).</td> </tr> <tr class="row-even"><td><cite>oob_improvement_</cite></td> <td>array, shape = [n_estimators]</td> <td>The improvement in loss (= deviance) on the out-of-bag samples relative to the previous iteration. <tt class="docutils literal"><span class="pre">oob_improvement_[0]</span></tt> is the improvement in loss of the first stage over the <tt class="docutils literal"><span class="pre">init</span></tt> estimator.</td> </tr> <tr class="row-odd"><td><cite>oob_score_</cite></td> <td>array, shape = [n_estimators]</td> <td>Score of the training dataset obtained using an out-of-bag estimate. The i-th score <tt class="docutils literal"><span class="pre">oob_score_[i]</span></tt> is the deviance (= loss) of the model at iteration <tt class="docutils literal"><span class="pre">i</span></tt> on the out-of-bag sample. Deprecated: use <cite>oob_improvement_</cite> instead.</td> </tr> <tr class="row-even"><td><cite>train_score_</cite></td> <td>array, shape = [n_estimators]</td> <td>The i-th score <tt class="docutils literal"><span class="pre">train_score_[i]</span></tt> is the deviance (= loss) of the model at iteration <tt class="docutils literal"><span class="pre">i</span></tt> on the in-bag sample. If <tt class="docutils literal"><span class="pre">subsample</span> <span class="pre">==</span> <span class="pre">1</span></tt> this is the deviance on the training data.</td> </tr> <tr class="row-odd"><td><cite>loss_</cite></td> <td>LossFunction</td> <td>The concrete <tt class="docutils literal"><span class="pre">LossFunction</span></tt> object.</td> </tr> <tr class="row-even"><td><cite>init</cite></td> <td>BaseEstimator</td> <td>The estimator that provides the initial predictions. Set via the <tt class="docutils literal"><span class="pre">init</span></tt> argument or <tt class="docutils literal"><span class="pre">loss.init_estimator</span></tt>.</td> </tr> <tr class="row-odd"><td><cite>estimators_</cite>: list of DecisionTreeRegressor</td> <td> </td> <td>The collection of fitted sub-estimators.</td> </tr> </tbody> </table> <p class="rubric">Methods</p> <table border="1" class="longtable docutils"> <colgroup> <col width="10%" /> <col width="90%" /> </colgroup> <tbody valign="top"> <tr class="row-odd"><td><a class="reference internal" href="#sklearn.ensemble.GradientBoostingClassifier.decision_function" title="sklearn.ensemble.GradientBoostingClassifier.decision_function"><tt class="xref py py-obj docutils literal"><span class="pre">decision_function</span></tt></a>(X)</td> <td>Compute the decision function of <tt class="docutils literal"><span class="pre">X</span></tt>.</td> </tr> <tr class="row-even"><td><a class="reference internal" href="#sklearn.ensemble.GradientBoostingClassifier.fit" title="sklearn.ensemble.GradientBoostingClassifier.fit"><tt class="xref py py-obj docutils literal"><span class="pre">fit</span></tt></a>(X, y)</td> <td>Fit the gradient boosting model.</td> </tr> <tr class="row-odd"><td><a class="reference internal" href="#sklearn.ensemble.GradientBoostingClassifier.get_params" title="sklearn.ensemble.GradientBoostingClassifier.get_params"><tt class="xref py py-obj docutils literal"><span class="pre">get_params</span></tt></a>([deep])</td> <td>Get parameters for this estimator.</td> </tr> <tr class="row-even"><td><a class="reference internal" href="#sklearn.ensemble.GradientBoostingClassifier.predict" title="sklearn.ensemble.GradientBoostingClassifier.predict"><tt class="xref py py-obj docutils literal"><span class="pre">predict</span></tt></a>(X)</td> <td>Predict class for X.</td> </tr> <tr class="row-odd"><td><a class="reference internal" href="#sklearn.ensemble.GradientBoostingClassifier.predict_proba" title="sklearn.ensemble.GradientBoostingClassifier.predict_proba"><tt class="xref py py-obj docutils literal"><span class="pre">predict_proba</span></tt></a>(X)</td> <td>Predict class probabilities for X.</td> </tr> <tr class="row-even"><td><a class="reference internal" href="#sklearn.ensemble.GradientBoostingClassifier.score" title="sklearn.ensemble.GradientBoostingClassifier.score"><tt class="xref py py-obj docutils literal"><span class="pre">score</span></tt></a>(X, y)</td> <td>Returns the mean accuracy on the given test data and labels.</td> </tr> <tr class="row-odd"><td><a class="reference internal" href="#sklearn.ensemble.GradientBoostingClassifier.set_params" title="sklearn.ensemble.GradientBoostingClassifier.set_params"><tt class="xref py py-obj docutils literal"><span class="pre">set_params</span></tt></a>(**params)</td> <td>Set the parameters of this estimator.</td> </tr> <tr class="row-even"><td><a class="reference internal" href="#sklearn.ensemble.GradientBoostingClassifier.staged_decision_function" title="sklearn.ensemble.GradientBoostingClassifier.staged_decision_function"><tt class="xref py py-obj docutils literal"><span class="pre">staged_decision_function</span></tt></a>(X)</td> <td>Compute decision function of <tt class="docutils literal"><span class="pre">X</span></tt> for each iteration.</td> </tr> <tr class="row-odd"><td><a class="reference internal" href="#sklearn.ensemble.GradientBoostingClassifier.staged_predict" title="sklearn.ensemble.GradientBoostingClassifier.staged_predict"><tt class="xref py py-obj docutils literal"><span class="pre">staged_predict</span></tt></a>(X)</td> <td>Predict class probabilities at each stage for X.</td> </tr> <tr class="row-even"><td><a class="reference internal" href="#sklearn.ensemble.GradientBoostingClassifier.staged_predict_proba" title="sklearn.ensemble.GradientBoostingClassifier.staged_predict_proba"><tt class="xref py py-obj docutils literal"><span class="pre">staged_predict_proba</span></tt></a>(X)</td> <td>Predict class probabilities at each stage for X.</td> </tr> </tbody> </table> <dl class="method"> <dt id="sklearn.ensemble.GradientBoostingClassifier.__init__"> <tt class="descname">__init__</tt><big>(</big><em>loss='deviance'</em>, <em>learning_rate=0.1</em>, <em>n_estimators=100</em>, <em>subsample=1.0</em>, <em>min_samples_split=2</em>, <em>min_samples_leaf=1</em>, <em>max_depth=3</em>, <em>init=None</em>, <em>random_state=None</em>, <em>max_features=None</em>, <em>verbose=0</em><big>)</big><a class="headerlink" href="#sklearn.ensemble.GradientBoostingClassifier.__init__" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="sklearn.ensemble.GradientBoostingClassifier.decision_function"> <tt class="descname">decision_function</tt><big>(</big><em>X</em><big>)</big><a class="headerlink" href="#sklearn.ensemble.GradientBoostingClassifier.decision_function" title="Permalink to this definition">¶</a></dt> <dd><p>Compute the decision function of <tt class="docutils literal"><span class="pre">X</span></tt>.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters :</th><td class="field-body"><p class="first"><strong>X</strong> : array-like of shape = [n_samples, n_features]</p> <blockquote> <div><p>The input samples.</p> </div></blockquote> </td> </tr> <tr class="field-even field"><th class="field-name">Returns :</th><td class="field-body"><p class="first"><strong>score</strong> : array, shape = [n_samples, k]</p> <blockquote class="last"> <div><p>The decision function of the input samples. Classes are ordered by arithmetical order. Regression and binary classification are special cases with <tt class="docutils literal"><span class="pre">k</span> <span class="pre">==</span> <span class="pre">1</span></tt>, otherwise <tt class="docutils literal"><span class="pre">k==n_classes</span></tt>.</p> </div></blockquote> </td> </tr> </tbody> </table> </dd></dl> <dl class="attribute"> <dt id="sklearn.ensemble.GradientBoostingClassifier.feature_importances_"> <tt class="descname">feature_importances_</tt><a class="headerlink" href="#sklearn.ensemble.GradientBoostingClassifier.feature_importances_" title="Permalink to this definition">¶</a></dt> <dd><dl class="docutils"> <dt>Return the feature importances (the higher, the more important the</dt> <dd>feature).</dd> </dl> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Returns :</th><td class="field-body"><strong>feature_importances_</strong> : array, shape = [n_features]</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="sklearn.ensemble.GradientBoostingClassifier.fit"> <tt class="descname">fit</tt><big>(</big><em>X</em>, <em>y</em><big>)</big><a class="headerlink" href="#sklearn.ensemble.GradientBoostingClassifier.fit" title="Permalink to this definition">¶</a></dt> <dd><p>Fit the gradient boosting model.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters :</th><td class="field-body"><p class="first"><strong>X</strong> : array-like, shape = [n_samples, n_features]</p> <blockquote> <div><p>Training vectors, where n_samples is the number of samples and n_features is the number of features.</p> </div></blockquote> <p><strong>y</strong> : array-like, shape = [n_samples]</p> <blockquote> <div><p>Target values (integers in classification, real numbers in regression) For classification, labels must correspond to classes <tt class="docutils literal"><span class="pre">0,</span> <span class="pre">1,</span> <span class="pre">...,</span> <span class="pre">n_classes_-1</span></tt></p> </div></blockquote> </td> </tr> <tr class="field-even field"><th class="field-name">Returns :</th><td class="field-body"><p class="first"><strong>self</strong> : object</p> <blockquote class="last"> <div><p>Returns self.</p> </div></blockquote> </td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="sklearn.ensemble.GradientBoostingClassifier.get_params"> <tt class="descname">get_params</tt><big>(</big><em>deep=True</em><big>)</big><a class="headerlink" href="#sklearn.ensemble.GradientBoostingClassifier.get_params" title="Permalink to this definition">¶</a></dt> <dd><p>Get parameters for this estimator.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters :</th><td class="field-body"><p class="first"><strong>deep: boolean, optional</strong> :</p> <blockquote> <div><p>If True, will return the parameters for this estimator and contained subobjects that are estimators.</p> </div></blockquote> </td> </tr> <tr class="field-even field"><th class="field-name">Returns :</th><td class="field-body"><p class="first"><strong>params</strong> : mapping of string to any</p> <blockquote class="last"> <div><p>Parameter names mapped to their values.</p> </div></blockquote> </td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="sklearn.ensemble.GradientBoostingClassifier.predict"> <tt class="descname">predict</tt><big>(</big><em>X</em><big>)</big><a class="headerlink" href="#sklearn.ensemble.GradientBoostingClassifier.predict" title="Permalink to this definition">¶</a></dt> <dd><p>Predict class for X.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters :</th><td class="field-body"><p class="first"><strong>X</strong> : array-like of shape = [n_samples, n_features]</p> <blockquote> <div><p>The input samples.</p> </div></blockquote> </td> </tr> <tr class="field-even field"><th class="field-name">Returns :</th><td class="field-body"><p class="first"><strong>y</strong> : array of shape = [n_samples]</p> <blockquote class="last"> <div><p>The predicted classes.</p> </div></blockquote> </td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="sklearn.ensemble.GradientBoostingClassifier.predict_proba"> <tt class="descname">predict_proba</tt><big>(</big><em>X</em><big>)</big><a class="headerlink" href="#sklearn.ensemble.GradientBoostingClassifier.predict_proba" title="Permalink to this definition">¶</a></dt> <dd><p>Predict class probabilities for X.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters :</th><td class="field-body"><p class="first"><strong>X</strong> : array-like of shape = [n_samples, n_features]</p> <blockquote> <div><p>The input samples.</p> </div></blockquote> </td> </tr> <tr class="field-even field"><th class="field-name">Returns :</th><td class="field-body"><p class="first"><strong>p</strong> : array of shape = [n_samples]</p> <blockquote class="last"> <div><p>The class probabilities of the input samples. Classes are ordered by arithmetical order.</p> </div></blockquote> </td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="sklearn.ensemble.GradientBoostingClassifier.score"> <tt class="descname">score</tt><big>(</big><em>X</em>, <em>y</em><big>)</big><a class="headerlink" href="#sklearn.ensemble.GradientBoostingClassifier.score" title="Permalink to this definition">¶</a></dt> <dd><p>Returns the mean accuracy on the given test data and labels.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters :</th><td class="field-body"><p class="first"><strong>X</strong> : array-like, shape = [n_samples, n_features]</p> <blockquote> <div><p>Training set.</p> </div></blockquote> <p><strong>y</strong> : array-like, shape = [n_samples]</p> <blockquote> <div><p>Labels for X.</p> </div></blockquote> </td> </tr> <tr class="field-even field"><th class="field-name">Returns :</th><td class="field-body"><p class="first last"><strong>z</strong> : float</p> </td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="sklearn.ensemble.GradientBoostingClassifier.set_params"> <tt class="descname">set_params</tt><big>(</big><em>**params</em><big>)</big><a class="headerlink" href="#sklearn.ensemble.GradientBoostingClassifier.set_params" title="Permalink to this definition">¶</a></dt> <dd><p>Set the parameters of this estimator.</p> <p>The method works on simple estimators as well as on nested objects (such as pipelines). The former have parameters of the form <tt class="docutils literal"><span class="pre"><component>__<parameter></span></tt> so that it’s possible to update each component of a nested object.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Returns :</th><td class="field-body"><strong>self</strong> :</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="sklearn.ensemble.GradientBoostingClassifier.staged_decision_function"> <tt class="descname">staged_decision_function</tt><big>(</big><em>X</em><big>)</big><a class="headerlink" href="#sklearn.ensemble.GradientBoostingClassifier.staged_decision_function" title="Permalink to this definition">¶</a></dt> <dd><p>Compute decision function of <tt class="docutils literal"><span class="pre">X</span></tt> for each iteration.</p> <p>This method allows monitoring (i.e. determine error on testing set) after each stage.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters :</th><td class="field-body"><p class="first"><strong>X</strong> : array-like of shape = [n_samples, n_features]</p> <blockquote> <div><p>The input samples.</p> </div></blockquote> </td> </tr> <tr class="field-even field"><th class="field-name">Returns :</th><td class="field-body"><p class="first"><strong>score</strong> : generator of array, shape = [n_samples, k]</p> <blockquote class="last"> <div><p>The decision function of the input samples. Classes are ordered by arithmetical order. Regression and binary classification are special cases with <tt class="docutils literal"><span class="pre">k</span> <span class="pre">==</span> <span class="pre">1</span></tt>, otherwise <tt class="docutils literal"><span class="pre">k==n_classes</span></tt>.</p> </div></blockquote> </td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="sklearn.ensemble.GradientBoostingClassifier.staged_predict"> <tt class="descname">staged_predict</tt><big>(</big><em>X</em><big>)</big><a class="headerlink" href="#sklearn.ensemble.GradientBoostingClassifier.staged_predict" title="Permalink to this definition">¶</a></dt> <dd><p>Predict class probabilities at each stage for X.</p> <p>This method allows monitoring (i.e. determine error on testing set) after each stage.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters :</th><td class="field-body"><p class="first"><strong>X</strong> : array-like of shape = [n_samples, n_features]</p> <blockquote> <div><p>The input samples.</p> </div></blockquote> </td> </tr> <tr class="field-even field"><th class="field-name">Returns :</th><td class="field-body"><p class="first"><strong>y</strong> : array of shape = [n_samples]</p> <blockquote class="last"> <div><p>The predicted value of the input samples.</p> </div></blockquote> </td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="sklearn.ensemble.GradientBoostingClassifier.staged_predict_proba"> <tt class="descname">staged_predict_proba</tt><big>(</big><em>X</em><big>)</big><a class="headerlink" href="#sklearn.ensemble.GradientBoostingClassifier.staged_predict_proba" title="Permalink to this definition">¶</a></dt> <dd><p>Predict class probabilities at each stage for X.</p> <p>This method allows monitoring (i.e. determine error on testing set) after each stage.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters :</th><td class="field-body"><p class="first"><strong>X</strong> : array-like of shape = [n_samples, n_features]</p> <blockquote> <div><p>The input samples.</p> </div></blockquote> </td> </tr> <tr class="field-even field"><th class="field-name">Returns :</th><td class="field-body"><p class="first"><strong>y</strong> : array of shape = [n_samples]</p> <blockquote class="last"> <div><p>The predicted value of the input samples.</p> </div></blockquote> </td> </tr> </tbody> </table> </dd></dl> </dd></dl> </div> </div> </div> </div> <div class="clearer"></div> </div> </div> <div class="footer"> © 2010 - 2013, scikit-learn developers (BSD License). <a href="../../_sources/modules/generated/sklearn.ensemble.GradientBoostingClassifier.txt" rel="nofollow">Show this page source</a> </div> <div class="rel"> <div class="buttonPrevious"> <a href="sklearn.ensemble.AdaBoostRegressor.html">Previous </a> </div> <div class="buttonNext"> <a href="sklearn.ensemble.GradientBoostingRegressor.html">Next </a> </div> </div> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-22606712-2']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> <script src="http://www.google.com/jsapi" type="text/javascript"></script> <script type="text/javascript"> google.load('search', '1', {language : 'en'}); google.setOnLoadCallback(function() { var customSearchControl = new google.search.CustomSearchControl('016639176250731907682:tjtqbvtvij0'); customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET); var options = new google.search.DrawOptions(); options.setAutoComplete(true); customSearchControl.draw('cse', options); }, true); </script> </body> <!-- Mirrored from scikit-learn.org/stable/modules/generated/sklearn.ensemble.GradientBoostingClassifier.html by HTTrack Website Copier/3.x [XR&CO'2013], Thu, 15 May 2014 06:18:14 GMT --> </html>