def save_rbm_weights(weight_matrices,hidden_biases,visible_biases):
    """
    Save the weight matrices from the rbm pretraining.

    @param weight_matrices: the weight matrices of the rbm pretraining.
    """
    s.dump([w.tolist() for w in weight_matrices] , open( env_paths.get_rbm_weights_path(), "wb" ) )
    s.dump([b.tolist() for b in hidden_biases] , open( env_paths.get_rbm_hidden_biases_path(), "wb" ) )
    s.dump([b.tolist() for b in visible_biases] , open( env_paths.get_rbm_visible_biases_path(), "wb" ) )
def load_rbm_weights():
    """
    Load the weight matrices from the rbm pretraining.

    @param weight_matrices: the weight matrices of the rbm pretraining.
    """
    weights = [array(w) for w in s.load( open( env_paths.get_rbm_weights_path(), "rb" ) )]
    hid_bias = [array(b) for b in s.load( open( env_paths.get_rbm_hidden_biases_path(), "rb" ) )]
    vis_bias = [array(b) for b in s.load( open( env_paths.get_rbm_visible_biases_path(), "rb" ) )]
    return weights,hid_bias,vis_bias
Example #3
0
def save_rbm_weights(weight_matrices, hidden_biases, visible_biases):
    """
    Save the weight matrices from the rbm pretraining.

    @param weight_matrices: the weight matrices of the rbm pretraining.
    """
    s.dump([w.tolist() for w in weight_matrices],
           open(env_paths.get_rbm_weights_path(), "wb"))
    s.dump([b.tolist() for b in hidden_biases],
           open(env_paths.get_rbm_hidden_biases_path(), "wb"))
    s.dump([b.tolist() for b in visible_biases],
           open(env_paths.get_rbm_visible_biases_path(), "wb"))
Example #4
0
def load_rbm_weights():
    """
    Load the weight matrices from the rbm pretraining.

    @param weight_matrices: the weight matrices of the rbm pretraining.
    """
    weights = [
        array(w) for w in s.load(open(env_paths.get_rbm_weights_path(), "rb"))
    ]
    hid_bias = [
        array(b)
        for b in s.load(open(env_paths.get_rbm_hidden_biases_path(), "rb"))
    ]
    vis_bias = [
        array(b)
        for b in s.load(open(env_paths.get_rbm_visible_biases_path(), "rb"))
    ]
    return weights, hid_bias, vis_bias