예제 #1
0
def get_args(parser):
    args = parser.parse_args()

    args.power_spectrum_beta_str = args.power_spectrum_beta
    args.power_spectrum_f_str = args.power_spectrum_f
    if args.config is not None:
        with open("./model_configurations.txt") as f:
            configs = eval(f.read())
        cparameters = configs[config]
        args.n_bins = parameters.get("n_bins", args.n_bins)
        args.noise_variance = parameters.get("noise_variance", args.noise_variance)
        args.power_spectrum_beta_str = parameters.get(
            "power_spectrum_beta", power_spectrum_beta_str
        )
        args.power_spectrum_f_str = parameters.get(
            "power_spectrum_f", power_spectrum_f_str
        )
    if args.last_id is None:
        args.last_id = get_benchmark_default_length(args.benchmark)

    return args
from sklearn.preprocessing import MinMaxScaler
import matlab.engine

CAUSALITY_ROOT = '/afs/mpa/home/maxk/bayesian_causal_inference/'
sys.path.append(CAUSALITY_ROOT)
from benchmark_utils import get_benchmark_default_length, get_pair, BCMParser

parser = BCMParser()
args = parser.parse_args()
NAME = args.name
BENCHMARK = args.benchmark
FIRST_ID = args.first_id
LAST_ID = args.last_id

if LAST_ID is None:
    LAST_ID = get_benchmark_default_length(BENCHMARK)

eng = matlab.engine.start_matlab()
eng.addpath(CAUSALITY_ROOT + 'comparison_methods/Mooij16/cep')
eng.startup(nargout=0)
eng.local_config(nargout=0)

methodpars = eng.struct()
methodpars['FITC'] = 0
methodpars['minimize'] = 'minimize_lbfgsb'
methodpars['evaluation'] = 'pHSIC'

accuracy = 0
correct_decisions = 0
undecided = 0