return vals cargs = cli.CommandLine(cli.optsfile('chgpt')) args = cargs.args oneday = round(constant.day / constant.minute) window = nd.Window(args.window_obs, args.window_pred, args.window_trgt) if args.resume: with open(args.resume, mode='rb') as fp: observations = pickle.load(fp) (measurements, nodes) = data.cleanse(observations) else: db.genop(args.reporting) opts = [window, oneday, args.threshold, np.mean] with Pool() as pool: observations = pool.starmap(f, nd.nodegen(opts)) observations = list(filter(None, observations)) assert (observations) if args.pickle: with open(args.pickle, mode='wb') as fp: pickle.dump(observations, fp) if args.figures: # and args.verbose: aggregate = [] for i in range(oneday): vals = [x[i] for x in observations] aggregate.append(np.mean(vals))
vals.append(nid) # this is important return vals cargs = cli.CommandLine(cli.optsfile('chgpt')) args = cargs.args oneday = round(constant.day / constant.minute) window = nd.Window(args.window_obs, args.window_pred, args.window_trgt) if args.resume: with open(args.resume, mode='rb') as fp: observations = pickle.load(fp) (measurements, nodes) = data.cleanse(observations) else: db.genop(args.reporting) opts = [ window, oneday, args.threshold, np.mean ] with Pool() as pool: observations = pool.starmap(f, nd.nodegen(opts)) observations = list(filter(None, observations)) assert(observations) if args.pickle: with open(args.pickle, mode='wb') as fp: pickle.dump(observations, fp) if args.figures: # and args.verbose: aggregate = [] for i in range(oneday): vals = [ x[i] for x in observations ] aggregate.append(np.mean(vals))
from lib import db from lib import cli from configparser import ConfigParser cargs = cli.CommandLine(cli.optsfile("prediction")) # /etc/opts/prediction args = cargs.args config = ConfigParser() config.read(args.config) # --config dbinfo = config["database"] if "database" in config else None db.EstablishCredentials(**dbinfo) db.genop(int(config["parameters"]["intra-reporting"]))
from lib import db from lib import cli from configparser import ConfigParser cargs = cli.CommandLine(cli.optsfile('prediction')) # /etc/opts/prediction args = cargs.args config = ConfigParser() config.read(args.config) # --config dbinfo = config['database'] if 'database' in config else None db.EstablishCredentials(**dbinfo) db.genop(int(config['parameters']['intra-reporting']))