コード例 #1
0
 def fit(self, X, y):
     '''X and y are as in sklearn classifier.fit expected arguments
     Creates a decision tree
     '''
     "*** YOUR CODE HERE AS NEEDED***"
     self.clf = self.makeTree(X, y, self.attribute_list, self.attrib_dict, self.default_value)
     mlUtil.raiseNotDefined()
コード例 #2
0
 def fit(self, X, y):
     '''X and y are as in sklearn classifier.fit expected arguments
     Creates a decision tree
     '''
     "*** YOUR CODE HERE AS NEEDED***"
     self.clf = self.makeTree(X, y, self.attribute_list, self.attrib_dict,
                              self.default_value)
     mlUtil.raiseNotDefined()
コード例 #3
0
 def classify(self, x, attributes, default_value):
    '''
    return the value for the given data
    the input will be:
    x - an object to classify - [v1, v2, ..., vn]
     attributes - the names of all the attributes
    '''
    "*** YOUR CODE HERE ***"
    mlUtil.raiseNotDefined()
コード例 #4
0
 def classify(self, x, attributes, default_value):
     '''
    return the value for the given data
    the input will be:
    x - an object to classify - [v1, v2, ..., vn]
     attributes - the names of all the attributes
    '''
     "*** YOUR CODE HERE ***"
     mlUtil.raiseNotDefined()
コード例 #5
0
 def __init__(self, attrib_d=None, attribs=None, default_v=None):
     ''' initialize classifier
     '''
     if not attribs:
         attribs = []
     if attrib_d:
         self.attrib_dict = attrib_d
     else:
         self.attrib_dict = {}
     self.attribute_list = attribs
     self.default_value = default_v
     
     "*** YOUR CODE HERE AS NEEDED ***"
     mlUtil.raiseNotDefined()
コード例 #6
0
    def __init__(self, attrib_d=None, attribs=None, default_v=None):
        ''' initialize classifier
        '''
        if not attribs:
            attribs = []
        if attrib_d:
            self.attrib_dict = attrib_d
        else:
            self.attrib_dict = {}
        self.attribute_list = attribs
        self.default_value = default_v

        "*** YOUR CODE HERE AS NEEDED ***"
        mlUtil.raiseNotDefined()
コード例 #7
0
 def predict(self, X):
     ''' Return a class label using the decision tree created by the fit method
     '''
     "*** YOUR CODE HERE AS NEEDED***"
     #call recursive classify method on the learned tree for each x in X
     mlUtil.raiseNotDefined()
コード例 #8
0
 def makeTree(self, dataset, labels, attributes, attrib_dict, defaultValue):
     ''' Helper recursive function for creating a tree
     '''
     "*** YOUR CODE HERE ***"
     mlUtil.raiseNotDefined()
コード例 #9
0
 def predict(self, X):
     ''' Return a class label using the decision tree created by the fit method
     '''
     "*** YOUR CODE HERE AS NEEDED***"
     #call recursive classify method on the learned tree for each x in X
     mlUtil.raiseNotDefined()
コード例 #10
0
 def makeTree(self, dataset, labels, attributes, attrib_dict, defaultValue):
     ''' Helper recursive function for creating a tree
     '''
     "*** YOUR CODE HERE ***"
     mlUtil.raiseNotDefined()