I wanted to create a decision tree and then prune it in python. However, sklearn does not support pruning by itself. With an internet search, I found this: https://github.com/sgenoud/scikit-learn/blob/4a75a4aaebd45e864e28cfca897121d1199e41d9/sklearn/tree/tree.py
But I don't know how to use the file. I tried:
from sklearn.datasets import load_iris
import tree
clf = tree.DecisionTreeClassifier()
iris = load_iris()
clf = clf.fit(iris.data, iris.target)
But I get the error ValueError: Attempted relative import in non-package. Is that not how I import? Do I need to save the files in a different way? Thank you.