Beispiel #1
0
def var_coat(alg_kwargs, var_all):
    alg_kwargs = config.dictify(alg_kwargs)
    alg_kwargs['n_epochs'] = n_epochs
    alg_kwargs['var_all'] = var_all
    kwargs_str = config.stringify(alg_kwargs)
    kwargs_file = path.join(curve_dir, 'COAT_%s.p' % kwargs_str)
    alg_kwargs['eval_space'] = eval_space
    alg_kwargs['kwargs_file'] = kwargs_file
    algo = VARREC(**alg_kwargs)
    algo.fit(trainset, testset)
    predictions = algo.test(testset)
    mae = accuracy.mae(predictions, **{'verbose': False})
    mse = pow(accuracy.rmse(predictions, **{'verbose': False}), 2.0)
    print('%.4f %.4f %s' % (mae, mse, kwargs_str))
    stdout.flush()
Beispiel #2
0
from os import path
from sys import stdout

import config

import itertools
import matplotlib.pyplot as plt
import numpy as np
import operator
import time

gsearch_file = tune_coat_file
err_kwargs, kwargs_set = config.read_gsearch(gsearch_file)
lr_all_opt, reg_all_opt = set(), set()
for kwargs_str in kwargs_set:
    alg_kwargs = config.dictify(kwargs_str)
    lr_all_opt.add(alg_kwargs['lr_all'])
    reg_all_opt.add(alg_kwargs['reg_all'])

n_epochs = coat_n_epochs
epochs = np.arange(1, 1 + n_epochs)

lr_all_opt = sorted(list(lr_all_opt))
reg_all_opt = sorted(list(reg_all_opt))
lr_part_opt = [lr_all_opt[i] for i in [
    2,
]]
lr_part_opt = [lr_all_opt[i] for i in [
    0,
    1,
    2,