コード例 #1
0
def main():
    epochs = 10
    batches = 4096
    z_k = 1024
    iters = 5
    outputpath = "output/skipgram_flat-l1"
    cooccurrence = np.load('output/cooccurrence.npy').astype(np.float32)
    weights = [1e-4, 1e-5, 1e-6, 1e-7, 5e-8, 1e-8, 5e-9, 1e-9]
    regularizers = [l1(w) for w in weights]
    labels = ["l1-{:.01e}".format(w) for w in weights]
    train_flat_regularizer_battery(outputpath=outputpath,
                                   cooccurrence=cooccurrence,
                                   epochs=epochs,
                                   batches=batches,
                                   iters=iters,
                                   z_k=z_k,
                                   labels=labels,
                                   regularizers=regularizers,
                                   is_weight_regularizer=True,
                                   kwdata={'weights': np.array(weights)})
コード例 #2
0
def main():
    epochs = 10
    batches = 4096
    z_k = 256
    iters = 1
    outputpath = "output/skipgram_256-el"
    cooccurrence = np.load('output/cooccurrence.npy').astype(np.float32)
    weights = [1e-7, 1e-8, 1e-9, 1e-10, 1e-11, 1e-12, 1e-13]
    regularizers = [ExclusiveLasso(w) for w in weights]
    labels = ["el-{:.01e}".format(w) for w in weights]
    train_flat_regularizer_battery(outputpath=outputpath,
                                   cooccurrence=cooccurrence,
                                   epochs=epochs,
                                   batches=batches,
                                   iters=iters,
                                   z_k=z_k,
                                   labels=labels,
                                   regularizers=regularizers,
                                   is_weight_regularizer=True,
                                   kwdata={'weights': np.array(weights)})
コード例 #3
0
def main():
    epochs = 10
    batches = 4096
    z_k = 1024
    iters = 3
    outputpath = "output/skipgram_1024_h"
    cooccurrence = np.load('output/cooccurrence.npy').astype(np.float32)
    weights = [1e-1, 1e-2, 1e-3, 1e-4, 1e-5, 1e-6, 1e-7]
    regularizers = [EntropyRegularizer(w) for w in weights]
    labels = ["h-{:.01e}".format(w) for w in weights]
    train_flat_regularizer_battery(outputpath=outputpath,
                                   cooccurrence=cooccurrence,
                                   epochs=epochs,
                                   batches=batches,
                                   iters=iters,
                                   z_k=z_k,
                                   labels=labels,
                                   regularizers=regularizers,
                                   is_weight_regularizer=False,
                                   kwdata={'weights': np.array(weights)})