Hi all, in stan exist some way to remove the logs in the terminal? I’m trying take the execution time of hmc and nuts, but hmc have a lot of logs in terminal. regards and thanks :)
X = diabetes_X[:-20]
X_test = diabetes_X[-20:]
# Split the targets into training/testing sets
y = diabetes.target[:-20]
y_test = diabetes.target[-20:]
#Horseshoe-prior stan model
model_code = """
data {
int<lower=0> n;
int<lower=0> p;
matrix[n,p] X;
vector[n] y;
}
parameters {
vector[p] beta;
vector<lower=0>[p] lambda;
real<lower=0> tau;
real<lower=0> sigma;
}
model {
lambda ~ cauchy(0, 1);
tau ~ cauchy(0, 1);
for (i in 1:p)
beta[i] ~ normal(0, lambda[i] * tau);
sigma ~ gamma(0.01,0.01);
y ~ normal(X * beta, sigma);
}
"""
n, p = X.shape
data = dict(n=n, p=p, X=X, y=y)
print "#Horseshoe-prior with No-U-Turn-Sampler"
print "#Parameters:\n"
print "#Dataset: diabetes"
print "#N Itertations:", iterations
print "\n#Train:"
print "#Horseshoe-prior\n"
print "\n#TAKING TIME FOR NUTS..."
for k in range(K):
start_nuts = timeit.default_timer()
fit_nuts = pystan.stan(model_code=model_code, data=data, seed=5, iter=iterations, algorithm="NUTS")
stop_nuts = timeit.default_timer()
time_nuts = (stop_nuts-start_nuts)
nuts_time_array.append(time_nuts)
print "\n#TAKING TIME FOR HMC..."
for k in range(K):
start_hmc = timeit.default_timer()
fit_hmc = pystan.stan(model_code=model_code, data=data, seed=5, iter=iterations, algorithm="HMC")
stop_hmc = timeit.default_timer()
time_hmc = (stop_hmc-start_hmc)
hmc_time_array.append(time_hmc)