我使用数据集训练了决策树。现在我想看看哪些样本落在树的哪片叶子下。从这里我想要红色圆圈的样本。我正在使用Python的Sklearn决策树实现。 最佳答案 如果你只想要每个样本的叶子,你可以使用clf.apply(iris.data)array([1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,14,5,
这是我要解决的问题:B:TheFoxen'sTreasureThereareN(1≤N≤4)Foxenguardingacertainvaluabletreasure,whichyou'dlovetogetyourhandson.Theproblemis,theFoxencertainlyaren'tabouttoallowthat-atleast,notwhilethey'reawake.Fortunately,throughcarefulobservation,you'veseenthateachFoxhasaregularsleepcycle.Inparticular,theit