apply
(
X,
check_input=True
)
[source]
Returns the index of the leaf that each sample is predicted as.
返回预测样本所在叶子节点的索引。
Parameters: | X : array_like or sparse matrix, shape = [n_samples, n_features]
check_input : boolean, (default=True)
|
---|---|
Returns: | X_leaves : array_like, shape = [n_samples,]
|
decision_path
(
X,
check_input=True
)
[source]
Return the decision path in the tree
返回在决策树中的决策路径。
New in version 0.18.
Parameters: | X : array_like or sparse matrix, shape = [n_samples, n_features]
check_input : boolean, (default=True)
|
---|---|
Returns: | indicator : sparse csr array, shape = [n_samples, n_nodes]
|
feature_importances_
Return the feature importances.
返回特征的重要性
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.(并不是很懂)
Returns: | feature_importances_ : array, shape = [n_features] |
---|
fit
(
X,
y,
sample_weight=None,
check_input=True,
X_idx_sorted=None
)
[source]
Build a decision tree classifier from the training set (X, y).
使用训练集来构建决策树分类器。
Parameters: | X : array-like or sparse matrix, shape = [n_samples, n_features]
y : array-like, shape = [n_samples] or [n_samples, n_outputs]
sample_weight : array-like, shape = [n_samples] or None
check_input : boolean, (default=True)
X_idx_sorted : array-like, shape = [n_samples, n_features], optional
|
---|---|
Returns: | self : object
|
fit_transform
(
X,
y=None,
**fit_params
)
[source]
Fit to data, then transform it.
并不是很懂,而且好像要不能用了?
Fits transformer to X and y with optional parameters fit_params and returns a transformed version of X.
Parameters: | X : numpy array of shape [n_samples, n_features]
y : numpy array of shape [n_samples]
|
---|---|
Returns: | X_new : numpy array of shape [n_samples, n_features_new]
|
get_params
(
deep=True
)
[source]
Get parameters for this estimator.
获得分类器的参数。
Parameters: | deep : boolean, optional
|
---|---|
Returns: | params : mapping of string to any
|
predict
(
X,
check_input=True
)
[source]
Predict class or regression value for X.
预测X的类别。
For a classification model, the predicted class for each sample in X is returned. For a regression model, the predicted value based on X is returned.
Parameters: | X : array-like or sparse matrix of shape = [n_samples, n_features]
check_input : boolean, (default=True)
|
---|---|
Returns: | y : array of shape = [n_samples] or [n_samples, n_outputs]
|
predict_log_proba
(
X
)
[source]
Predict class log-probabilities of the input samples X.
(并不是很懂)
Parameters: | X : array-like or sparse matrix of shape = [n_samples, n_features]
|
---|---|
Returns: | p : array of shape = [n_samples, n_classes], or a list of n_outputs
|
predict_proba
(
X,
check_input=True
)
[source]
Predict class probabilities of the input samples X.
预测输入样本X的类别概率。
The predicted class probability is the fraction of samples of the same class in a leaf.
-
check_input
:
boolean, (default=True)
- Allow to bypass several input checking. Don’t use this parameter unless you know what you do.
Parameters: | X : array-like or sparse matrix of shape = [n_samples, n_features]
|
---|---|
Returns: | p : array of shape = [n_samples, n_classes], or a list of n_outputs
|
score
(
X,
y,
sample_weight=None
)
[source]
Returns the mean accuracy on the given test data and labels.
In multi-label classification, this is the subset accuracy which is a harsh metric since you require for each sample that each label set be correctly predicted.
Parameters: | X : array-like, shape = (n_samples, n_features)
y : array-like, shape = (n_samples) or (n_samples, n_outputs)
sample_weight : array-like, shape = [n_samples], optional
|
---|---|
Returns: | score : float
|
set_params
(
**params
)
[source]
Set the parameters of this estimator.
设置分类器的参数。
The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form <component>__<parameter>
so that it’s possible to update each component of a nested object.
Returns: | self : |
---|