<commit_before>#!/usr/bin/env python

# Test of "new style" network inference
# <NAME>, 5/16/2012

import numpy as np

from Network import Network
from Models import StationaryLogistic, NonstationaryLogistic
from Models import alpha_zero, alpha_norm, alpha_unif, alpha_gamma
from Experiment import RandomSubnetworks, Seed, \
     Results, add_array_stats, rel_mse
from Utility import logit

# Parameters
params = { 'N': 130,
           'B': 1,
           'theta_sd': 1.0,
           'theta_fixed': { 'x_0': 2.0, 'x_1': -1.0 },           
           'alpha_unif_sd': 0.0,
           'alpha_norm_sd': 1.0,
           'alpha_gamma_sd': 0.0,
           'cov_unif_sd': 0.0,
           'cov_norm_sd': 1.0,
           'cov_disc_sd': 0.0,
           'kappa_target': ('row_sum', 2),
           'pre_offset': False,
           'post_fit': True,
           'fisher_information': False,
           'baseline': False,
           'fit_nonstationary': True,
           'fit_method': 'conditional',
           'num_reps': 3,
           'sampling': 'new',
           'sub_sizes_r': np.floor(np.log(np.floor(np.logspace(1.0, 2.1, 30)))),
           'sub_sizes_c': np.floor(np.logspace(1.0, 2.1, 30)),
           'find_good': 0.0,
           'find_bad': 0.0,
           'verbose': True,
           'plot_xaxis': 'c',
           'plot_mse': True,
           'plot_network': True,
           'plot_fit_info': True,
           'random_seed': 137 }


# Set random seed for reproducible output
seed = Seed(params['random_seed'])

# Initialize full network
net = Network(params['N'])
<commit_msg>Read modified parameter from JSON file<commit_after>#!/usr/bin/env python

# Test of "new style" network inference
# <NAME>, 5/16/2012

import sys

import numpy as np

from Network import Network
from Models import StationaryLogistic, NonstationaryLogistic
from Models import alpha_zero, alpha_norm, alpha_unif, alpha_gamma
from Experiment import RandomSubnetworks, Seed, \
     Results, add_array_stats, rel_mse
from Utility import logit

# Parameters
params = { 'N': 130,
           'B': 1,
           'theta_sd': 1.0,
           'theta_fixed': { 'x_0': 2.0, 'x_1': -1.0 },           
           'alpha_unif_sd': 0.0,
           'alpha_norm_sd': 1.0,
           'alpha_gamma_sd': 0.0,
           'cov_unif_sd': 0.0,
           'cov_norm_sd': 1.0,
           'cov_disc_sd': 0.0,
           'kappa_target': ('row_sum', 2),
           'pre_offset': False,
           'post_fit': True,
           'fisher_information': False,
           'baseline': False,
           'fit_nonstationary': True,
           'fit_method': 'conditional',
           'num_reps': 3,
           'sampling': 'new',
           'sub_sizes_r': np.floor(np.log(np.floor(np.logspace(1.0, 2.1, 30)))),
           'sub_sizes_c': np.floor(np.logspace(1.0, 2.1, 30)),
           'find_good': 0.0,
           'find_bad': 0.0,
           'verbose': True,
           'plot_xaxis': 'c',
           'plot_mse': True,
           'plot_network': True,
           'plot_fit_info': True,
           'random_seed': 137 }

if len(sys.argv) == 2:
    import json
    with open(sys.argv[1], 'r') as params_file:
        new_params = json.load(params_file)
    for k in new_params:
        print k
        print 'old:', params[k]
        print 'new:', new_params[k]
        print
        params[k] = new_params[k]

# Set random seed for reproducible output
seed = Seed(params['random_seed'])

# Initialize full network
net = Network(params['N'])

{'fraction_non_alphanumeric': 0.13700605710989328, 'fraction_numerical': 0.030573983270839343, 'mean_word_length': 2.1758241758241756, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3324018', 'n_tokens_mistral': 1252, 'n_tokens_neox': 1163, 'n_words': 280}