decisiontreeclassifier

decisiontreeclassifier

本文介绍了as_formula在sklearn.tree.decisiontreeclassifier中的说明符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很好奇Python是否为sklearn.tree.decisiontreeclassifier提供了as_formula说明符(例如statsmodels中的说明符),或者采用某种方式侵入其中.目前,我必须使用

I was curious if there is an as_formula specifier (like in statsmodels) for sklearn.tree.decisiontreeclassifier in Python, or some way to hack one in. Currently, I must use

clf = tree.DecisionTreeClassifier()
clf = clf.fit(X, Y)

但是我更喜欢

clf = clf.fit(formula='Y ~ X', data=df)

原因是我想指定一个以上的X,而不必进行大量的数组整形.谢谢.

The reason is that I would like to specify more than one X without having to do a lot of array shaping. Thanks.

推荐答案

目前尚不可能,但是为scikit-learn提供一个patsy接口将是很棒的.不过,我认为目前没有人对此进行研究.

It's currently not possible, but it would be great to have a patsy interface for scikit-learn. I don't think anyone is working on it at the moment, though.

这篇关于as_formula在sklearn.tree.decisiontreeclassifier中的说明符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 15:09