# Path: mimic3models/parse_utils.py
# def parse_task(log):
# def get_loss(log, loss_name):
# def parse_metrics(log, metric):
# def parse_network(log):
# def parse_load_state(log):
# def parse_prefix(log):
# def parse_dim(log):
# def parse_size_coef(log):
# def parse_depth(log):
# def parse_ihm_C(log):
# def parse_decomp_C(log):
# def parse_los_C(log):
# def parse_pheno_C(log):
# def parse_dropout(log):
# def parse_timestep(log):
# def parse_partition(log):
# def parse_deep_supervision(log):
# def parse_target_repl_coef(log):
# def parse_epoch(state):
# def parse_batch_size(log):
# def parse_state(log, epoch):
# def parse_last_state(log):


import argparse
import json
import numpy as np
from mimic3models import parse_utils
from __future__ import absolute_import
from __future__ import print_function



def check_decreasing(a, k, eps):
    if k >= len(a):
        return False
    pos = len(a) - 1
    for i in range(k):
        if a[pos] > a[pos - 1] + eps:
            return False
        pos -= 1
    return True


def process_single(filename, verbose, select):
    if verbose:
        print("Processing log file: {}".format(filename))

    with open(filename, 'r') as fin:
        log = fin.read()

# Path: mimic3models/parse_utils.py
# def parse_task(log):
# def get_loss(log, loss_name):
# def parse_metrics(log, metric):
# def parse_network(log):
# def parse_load_state(log):
# def parse_prefix(log):
# def parse_dim(log):
# def parse_size_coef(log):
# def parse_depth(log):
# def parse_ihm_C(log):
# def parse_decomp_C(log):
# def parse_los_C(log):
# def parse_pheno_C(log):
# def parse_dropout(log):
# def parse_timestep(log):
# def parse_partition(log):
# def parse_deep_supervision(log):
# def parse_target_repl_coef(log):
# def parse_epoch(state):
# def parse_batch_size(log):
# def parse_state(log, epoch):
# def parse_last_state(log):


# Path: mimic3models/rerun.py
import argparse
import json
import numpy as np
from mimic3models import parse_utils

from __future__ import absolute_import
from __future__ import print_function



def check_decreasing(a, k, eps):
    if k >= len(a):
        return False
    pos = len(a) - 1
    for i in range(k):
        if a[pos] > a[pos - 1] + eps:
            return False
        pos -= 1
    return True


def process_single(filename, verbose, select):
    if verbose:
        print("Processing log file: {}".format(filename))

    with open(filename, 'r') as fin:
        log = fin.read()

    task = parse_utils.parse_task(log)