Main.py 文件源码

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

项目:pythonml 作者: nicholastoddsmith 项目源码 文件源码
def GenerateData(nf = 256, ns = 16384):
    try:    #Try to read data from file
        A = np.loadtxt('bdatA.csv', delimiter = ',')
        Y = np.loadtxt('bdatY.csv', delimiter = ',').reshape(-1, 1)
    except OSError:     #New data needs to be generated
        x = np.linspace(-1, 1, num = ns).reshape(-1, 1)
        A = np.concatenate([x] * nf, axis = 1)
        Y = ((np.sum(A, axis = 1) / nf) ** 2).reshape(-1, 1)
        A = (A + np.random.rand(ns, nf)) / (2.0)
        np.savetxt('bdatA.csv', A, delimiter = ',')
        np.savetxt('bdatY.csv', Y, delimiter = ',')
    return (A, Y)

#R:     Regressor network to use
#A:     The sample data matrix
#Y:     Target data matrix
#nt:    Number of times to divide the sample matrix
#fn:    File name to write results
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号