> For the complete documentation index, see [llms.txt](https://jablack-programs.gitbook.io/python-notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jablack-programs.gitbook.io/python-notes/python-bigdata/sklearn/estimator-yu-ce-qi/classification/trees/extratree.md).

# ExtraTree

```python
from sklearn import tree

X = [[0, 0], [1, 1]]
Y = [0, 1]
clf = tree.ExtraTreeClassifier()
clf = clf.fit(X, Y)
>>> clf.predict([[2., 2.]])
array([1])
```

```python
class sklearn.tree.ExtraTreeClassifier(
criterion=’gini’, 
splitter=’random’, 
max_depth=None, 
min_samples_split=2, 
min_samples_leaf=1, 
min_weight_fraction_leaf=0.0, 
max_features=’auto’, 
random_state=None, 
max_leaf_nodes=None, 
min_impurity_decrease=0.0,
min_impurity_split=None, 
class_weight=None
)
#见DecisionTree的
```

## 属性

```python
classes_ : array of shape = [n_classes] or a list of such arrays
                The classes labels (single output problem), or a list of arrays of class labels (multi-output problem).

feature_importances_ : array of shape = [n_features]
                The feature importances. The higher, the more important the feature. The importance of a feature is computed as the (normalized) total reduction of the criterion brought by that feature. It is also known as the Gini importance [R251].

max_features_ : int,
                The inferred value of max_features.

n_classes_ : int or list
                The number of classes (for single output problems), or a list containing the number of classes for each output (for multi-output problems).

n_features_ : int
                The number of features when fit is performed.

n_outputs_ : int
                The number of outputs when fit is performed.

tree_ : Tree object
                The underlying Tree object.
```

## 方法

```python
apply（X，check_input = True ）    #返回每个样本被预测为的叶的索引

decision_path（X，check_input = True ）    #返回树中的决策路径

fit（X，y，sample_weight = None，check_input = True，X_idx_sorted = None ）    #训练

get_params（deep = True ）    #获取此估算器的参数

predict（X，check_input = True ）#预测

predict_log_proba（X ）    #预测输入样本X的类别对数概率

predict_proba（X，check_input = True ）    #预测输入样本X的类概率

score（X，y，sample_weight = None ）[source]    #返回给定测试数据和标签的平均精确度

set_params（** params )     #设置此分类器的参数
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://jablack-programs.gitbook.io/python-notes/python-bigdata/sklearn/estimator-yu-ce-qi/classification/trees/extratree.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
