Esempio n. 1
0
import argparse
from enum import Enum
from ai4good.models.model_registry import get_models, create_params
from ai4good.runner.facade import Facade
from ai4good.models.model import ModelResult
from ai4good.utils.logger_util import get_logger

logger = get_logger(__name__)
facade = Facade.simple()


def cache_info():

    def find_profile(m, c, rid):
        _mdl = get_models()[m](facade.ps)
        for p in facade.ps.get_profiles(m):
            params = create_params(facade.ps, m, p, c)
            res_id = _mdl.result_id(params)
            if res_id == rid:
                return p
        return None

    for m in get_models():
        cached_data = facade.rs.list(m)
        print(f"---- {m} ----")
        for cd in cached_data:
            rid = facade.rs.result_id_from_file_name(cd, m)
            mr: ModelResult = facade.rs.load(m, rid)
            p = mr.get('params')
            profile_info = find_profile(m, p.camp, rid)
            if profile_info is None:
Esempio n. 2
0
#from ai4good.models.cm.initialise_parameters import params, control_data, categories, calculated_categories, change_in_categories

from ai4good.models.cm.initialise_parameters import Parameters
from math import ceil, floor
import numpy as np
from scipy.integrate import ode
import pandas as pd
import statistics
from tqdm import tqdm
import dask
from dask.diagnostics import ProgressBar
from ai4good.utils.logger_util import get_logger

logger = get_logger()


def timing_function(t, time_vector):
    for ii in range(ceil(len(time_vector) / 2)):
        if t >= time_vector[2 * ii] and t < time_vector[2 * ii + 1]:
            return True
    # if wasn't in any of these time interval
    return False


##
# -----------------------------------------------------------------------------------
##


class Simulator:
    def __init__(self, params: Parameters):
Esempio n. 3
0
import ai4good.webapp.input_page_1 as input_page_1
import ai4good.webapp.input_page_2 as input_page_2
import ai4good.webapp.input_page_3 as input_page_3
import ai4good.webapp.input_page_4 as input_page_4
import ai4good.webapp.run_model_page as run_model_page
import ai4good.webapp.cm_model_results_page as cm_model_results_page
import ai4good.webapp.cm_model_report_page as cm_model_report_page
import ai4good.webapp.cm_admin_page as cm_admin_page
import ai4good.webapp.abm_model_results_page as abm_model_results_page
import ai4good.webapp.abm_model_report_page as abm_model_report_page
import ai4good.webapp.nm_model_results_page as nm_model_results_page
import ai4good.webapp.nm_model_report_page as nm_model_report_page
import ai4good.webapp.nm_admin_page as nm_admin_page
from ai4good.webapp.apps import flask_app, dash_app

logger = get_logger(__file__, 'DEBUG')


@flask_app.route("/")
def index():
    return redirect('/sim/landing')


dash_app.layout = html.Div(
    [dcc.Location(id='url', refresh=False),
     html.Div(id='page-content')])


@dash_app.callback(Output('page-content', 'children'),
                   [Input('url', 'pathname'),
                    Input('url', 'search')])