I trying to edit sklearn and I need to add an attribute for one of the class.
I was sure that adding self.attribute
will be the answer but i keep getting an error this attribute isn't available. I try to add this attribute install the new package with my change and everything went fine until I run it
cdef class ClassificationCriterion(Criterion):
"""Abstract criterion for classification."""
def __cinit__(self, SIZE_t n_outputs,
np.ndarray[SIZE_t, ndim=1] n_classes, int test = 1):
"""Initialize attributes for this criterion.
Parameters
----------
n_outputs : SIZE_t
The number of targets, the dimensionality of the prediction
n_classes : numpy.ndarray, dtype=SIZE_t
The number of unique classes in each target
"""
self.test = test
code I ran:
clf = sklearn.tree.DecisionTreeClassifier(criterion='entropy',random_state=0,max_depth=2 )
clf2=clf.fit(x,y)
AttributeError: sklearn.tree._criterion.Entropy object has no attribute test