csv.pre_one_job

View page source

Calculate the predictions for One Fit

Prototype

# at_cascade.csv.pre_one_job
def pre_one_job(
    predict_job_name      ,
    fit_dir               ,
    sim_dir               ,
    pre_database          ,
    predict_node_id       ,
    predict_sex_id        ,
    all_node_database     ,
    all_covariate_table   ,
    float_precision       ,
    fit_same_as_predict   ,
    option_predict        ,
) :
    assert type(predict_job_name) == str
    assert type(fit_dir) == str
    assert sim_dir == None or type(sim_dir) == str
    assert type(pre_database) == str
    assert type(predict_node_id) == int
    assert type(all_node_database) == str
    assert type(all_covariate_table) == list
    assert type( all_covariate_table[0] ) == dict
    assert type( float_precision ) == int
    assert type( fit_same_as_predict ) == bool
    assert type( option_predict ) == dict

predict_job_name

This string specifies the node and sex corresponding to this prediction.

fit_dir

This string is the directory name where the input and output csv files are located.

sim_dir

is the directory name where the csv simulation files are located.

pre_database

The directory where pre_database is located identifies the node and sex for this prediction. The file pre_database is a copy of the fit database used for this prediction. The node and sex for the fit is either the same as for the prediction, or an ancestor of the node and ex for the prediction.

predict_node_id

This int is the node_id in the node we are predicting for.

all_node_database

This string is the all node database for this fit.

all_covariate_table

The list of dict is the in memory representation of the covariate.csv file

float_precision

This is the number of decimal digits of precision to include for float values in fit_predict.csv, sam_predict.csv, and tru_predict.csv; see below.

fit_same_as_predict

If true, the node and sex for this prediction is the same as the node and sex for the fit. Otherwise it is a fit for the closest ancestor that has a successful cascade fit. To be specific, sample: OK is in its log.

option_predict

This is an in memory representation of option_predict.csv .

Csv Output Files

  1. The csv output files are located in the prediction directory; i.e., the directory corresponding to the predictions for this location, sex.

  2. The predictions are on the same age, time grid as the covariate file.

  3. If fit_same_as_predict is true, the following files are created (the tru_posterior.csv file is not created when sim_dir is None):

    fit_posterior.csv

    uses optimal posterior variable values

    sam_posterior.csv

    uses samples from the posterior

    tru_posterior.csv

    uses simulation variable values for this location

    sex

  4. If fit_same_as_predict is false, the following files are created (the tru_prior.csv file is not created when sim_dir is None):

    fit_prior.csv

    uses optimal prior variable values

    sam_prior.csv

    uses samples from the prior

    tru_prior.csv

    uses simulation variable values for an ancestor

  5. The following columns are included in these files (the sample_index column is only included in the sample files):

    Column

    Meaning

    avgint_id

    This index the value we are predicting

    sample_index

    This index the random samples for each value

    avg_integrand

    This is the model value for the prediction

    age_lower

    Lower age limit for averaging this integrand

    age_upper

    Upper age limit for averaging (must equal lower).

    time_lower

    Lower time limit for averaging this integrand

    time_upper

    Upper time limit for averaging (must equal lower).

    node_id

    Identifies the node for this prediction.

    x_j

    Value of the j-th covariate