TFPlot.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:pythonml 作者: nicholastoddsmith 项目源码 文件源码
def IntToBinVec(x, v = None):
    #If no vector is passed create a new one
    if(v is None):
        dim = int(np.log2(x)) + 1
        v = np.zeros([dim], dtype = np.int)
    #v will contain the binary vector
    c = 0
    while(x > 0):
        #If the vector has been filled; return truncating the rest
        if c >= len(v):
            break
        #Test if the LSB is set
        if(x & 1 == 1):
            #Set the bits in right-to-left order
            v[c] = 1
        #Onto the next column and bit
        c += 1
        x >>= 1
    return v

#Plot the model R learning the data set A, Y
#R: A regression model
#A: The data samples
#Y: The target vectors
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号