def makeTree(self, Mat, Tag):
        miniumn     = + numpy.inf
        opt_feature = 0
        opt_val     = 0

        Tag = numpy.array(Tag)

        #return the type of data, if there is no different type of data
        if numpy.unique(Tag).size == 1:
            t = Tree()
            t.isLeaf  = True
            t.nodeVal = Tag[0]
            
            for label in self.labels:
                if label != Tag[0]:
                    t.counter[label] = 0.0
                else:
                    t.counter[label] = 1.0
            return t

        minium = + numpy.inf
        for f in range(self.SamplesDem):
            for i in range(len(Tag)):
                v = Mat[f, i]
                p = self.Gini(Mat[f], Tag, v, f)
                p /= self.W[toHashableVal(Mat[:, i])]
                if p < miniumn:
                    miniumn     = p
                    opt_feature = f
                    opt_val     = v

        t = Tree()
        t.nodeVal    = opt_val
        t.selFeature = opt_feature

        if self.currentDepth == self.limitedDepth:
            t.isLeaf = True

            for label in self.labels:
                t.counter[label] = 0

            summer = 0.0
            for i in range(len(Tag)):
                label = Tag[i]
                t.counter[label] += self.W[toHashableVal(Mat[:, i])]
                summer += self.W[toHashableVal(Mat[:, i])]

            for label in numpy.unique(Tag):
                t.counter[label] /= summer
            
            return t

        if miniumn == 1:
            return Tag[0]

        self.currentDepth += 1

        if self.Discrete[opt_feature] == True:
            t.left  = self.makeTree(
                    Mat[:, Mat[opt_feature, :] == opt_val], 
                    Tag[   Mat[opt_feature, :] == opt_val])

            t.right = self.makeTree(
                    Mat[:, Mat[opt_feature, :] != opt_val], 
                    Tag[   Mat[opt_feature, :] != opt_val])
        else:
            t.left  = self.makeTree(
                    Mat[:, Mat[opt_feature, :] <  opt_val], 
                    Tag[   Mat[opt_feature, :] <  opt_val])

            t.right = self.makeTree(
                    Mat[:, Mat[opt_feature, :] >= opt_val], 
                    Tag[   Mat[opt_feature, :] >= opt_val])

        return t