(self , data , *argv , **kw )
return min([ ( (yt -label) ** 2 , label)  for label in self.labels])[1]
线性模型进行预测
        param:data/预测数据:list/tuple/dict
        return:predict value:int:model predict label 
        raise:None
        test:
            >>> model = Ann(2,0.1)
            >>> datas = [[[3, 3], 1], [[4, 3], 1], [[1, 1], -1], [[2, 2], -1] , [[7,3] , 1 ] , [ [-1 , -1] , -1 ] ] 
            >>> datas = [ data[0] for data in datas]
            >>> labels = [ data[1] for data in datas]
            >>> model.train(datas , labels)
            >>> model.predict(datas[-1]) == -1
            True
线性模型进行预测
        param:data/预测数据:list/tuple/dict
        return:predict value:int:model predict label 
        raise:None
        test:
            >>> model = Ann(2,0.1)
            >>> datas = [[[3, 3], 1], [[4, 3], 1], [[1, 1], -1], [[2, 2], -1] , [[7,3] , 1 ] , [ [-1 , -1] , -1 ] ] 
            >>> datas = [ data[0] for data in datas]
            >>> labels = [ data[1] for data in datas]
            >>> model.train(datas , labels)
            >>> model.predict(datas[-1]) == -1
            True
线性模型进行预测 param : data / 预测数据 : list / tuple / dict return : predict value : int : model predict label raise : None test : >>> model = Ann ( 2 0 . 1 ) >>> datas = [[[ 3 3 ] 1 ] [[ 4 3 ] 1 ] [[ 1 1 ] - 1 ] [[ 2 2 ] - 1 ] [[ 7 3 ] 1 ] [ [ - 1 - 1 ] - 1 ] ] >>> datas = [ data [ 0 ] for data in datas ] >>> labels = [ data [ 1 ] for data in datas ] >>> model . train ( datas labels ) >>> model . predict ( datas [ - 1 ] ) == - 1 True
def predict(self , data , *argv , **kw ):
        """线性模型进行预测
        param:data/预测数据:list/tuple/dict
        return:predict value:int:model predict label 
        raise:None
        test:
            >>> model = Ann(2,0.1)
            >>> datas = [[[3, 3], 1], [[4, 3], 1], [[1, 1], -1], [[2, 2], -1] , [[7,3] , 1 ] , [ [-1 , -1] , -1 ] ] 
            >>> datas = [ data[0] for data in datas]
            >>> labels = [ data[1] for data in datas]
            >>> model.train(datas , labels)
            >>> model.predict(datas[-1]) == -1
            True 
        """
        yt = sum( self.ratios[i] * data[i] for i in self.data_range ) + self.b  
        return min([ ( (yt -label) ** 2 , label)  for label in self.labels])[1]
def predict ( self , data , * argv , * * kw ) : yt = sum ( self . ratios [ i ] * data [ i ] for i in self . data_range ) + self . b return min ( [ ( ( yt - label ) ** 2 , label ) for label in self . labels ] ) [ 1 ]