Пример #1
0
output_root = options['output_root']
training_data_path = options['training_data_path']
vocab = (options['wordlist'], options['relalist'])

# --- init RNG --- #
try:
    seed = options['seed']
except KeyError:
    seed = 1337
bf2f.np.random.seed(seed)

# --- save the options --- #
options.save(output_root+'_options.txt')

# --- training data --- #
dstream = bf2f.data_stream(training_data_path)

if options['online']:
    train_data = dstream
else:
    train_data = dstream.acquire_all()

# --- initialise parameters --- #
try:
    # load parameters from file
    initial_params_path = options['initial_params_path']
    initial_params = initial_params_path
except KeyError:
    # create random
    W, R = dstream.get_vocab_sizes()
    d = options['dimension']
Пример #2
0
    dpath = ''
    wordlist = ''
elif not len(sys.argv) > 1:
    sys.exit('ERROR: no data!')
else:
    print 'Expecting dpath in config file.'

# overwrite from the options file
# WARNING: DANGEROUS
if 'dpath' in options:
    dpath = options['dpath']
if 'wordlist' in options:
    wordlist = options['wordlist']

# --- initialise things --- #
dstream = bf2f.data_stream(dpath)
W, R = dstream.get_vocab_sizes()
if W == 5 and d == 3:
    C = bf2f.np.array([[0.01481961, -0.01517603, 0.00596634, 1.],
                       [-0.0080693, 0.00852271, -0.00106983, 1.],
                       [-0.0012176, 0.02482517, 0.01040345, 1.],
                       [0.00962732, 0.0100687, 0.00756443, 1.],
                       [0.00841503, 0.00188252, 0.02689446, 1.]])
    V = bf2f.np.array([[-0.00878185, -0.01871243, -0.01610301, 1.],
                       [-0.02036443, -0.02137387, 0.00874672, 1.],
                       [0.00898955, 0.00722872, -0.00504091, 1.],
                       [0.00324052, 0.02674052, 0.00166536, 1.],
                       [0.01199952, 0.00430334, 0.0040228, 1.]])
#elif W == 5 and d == 2:
#    C = bf2f.np.array([[ 1.0, 0.0, 1.0 ],
#                       [ 0.0, 1.0, 1.0 ],
Пример #3
0
    dpath = ''
    wordlist = ''
elif not len(sys.argv) > 1:
        sys.exit('ERROR: no data!')
else:
    print 'Expecting dpath in config file.'

# overwrite from the options file
# WARNING: DANGEROUS
if 'dpath' in options:
    dpath = options['dpath']
if 'wordlist' in options:
    wordlist = options['wordlist']

# --- initialise things --- #
dstream = bf2f.data_stream(dpath)
W, R = dstream.get_vocab_sizes()
if W == 5 and d == 3:
    C = bf2f.np.array([[ 0.01481961, -0.01517603,  0.00596634,  1.        ],
                       [-0.0080693 ,  0.00852271, -0.00106983,  1.        ],
                       [-0.0012176 ,  0.02482517,  0.01040345,  1.        ],
                       [ 0.00962732,  0.0100687 ,  0.00756443,  1.        ],
                       [ 0.00841503,  0.00188252,  0.02689446,  1.        ]])
    V = bf2f.np.array([[-0.00878185, -0.01871243, -0.01610301,  1.        ],
                       [-0.02036443, -0.02137387,  0.00874672,  1.        ],
                       [ 0.00898955,  0.00722872, -0.00504091,  1.        ],
                       [ 0.00324052,  0.02674052,  0.00166536,  1.        ],
                       [ 0.01199952,  0.00430334,  0.0040228 ,  1.        ]])
#elif W == 5 and d == 2:
#    C = bf2f.np.array([[ 1.0, 0.0, 1.0 ],
#                       [ 0.0, 1.0, 1.0 ],