num_data_sets = 1
num_trials = 10
sigma = 1.0
n_vals = round.(Int, exp10.(range(2.0,stop=4.0,length=7)))
k = 5
d = 10
mses = Dict{String, Array{Float64, 2}}()
times = Dict{String, Array{Float64, 2}}()
for algo_name in keys(algos)
mses[algo_name] =Array(Float64, length(n_vals), num_trials num_data_sets)
times[algo_name] = Array(Float64, length(n_vals), num_trials num_data_sets)
end
Warm-up for pre-compilation
n_warmup = 100
y, ystar, X = generate_equal_size_random_regression_data(k, n_warmup, d, sigma);
@printf("Warm-up with n = %d\n", n_warmup)
for (algo_name, algo_fun) in algos
yhat_partition = algo_fun(X, y, k)
end
for (nii, n) in enumerate(n_vals)
@printf("n = %d ", n)
tic()
for iidata = 1:num_data_sets
@printf("*")
for ii = 1:num_trials
@printf(".")
#@printf(" trial %d\n", ii)
y, ystar, X = generate_equal_size_random_regression_data(k, n, d, sigma);
for (algo_name, algo_fun) in algos
#@printf(" algorithm %s\n", algo_name)
start_time = time_ns()
yhat_partition = algo_fun(X, y, k)
end_time = time_ns()
yhat = partition_to_vector(X, yhat_partition)
mses[algo_name][nii, (iidata - 1) * num_trials + ii] = mse(yhat, ystar)
times[algo_name][nii, (iidata - 1) * num_trials + ii] = 1e-9 * (end_time - start_time)
end
end
end
elapsed = toq()
@printf(" %f seconds\n", elapsed)
num_data_sets = 1 num_trials = 10 sigma = 1.0 n_vals = round.(Int, exp10.(range(2.0,stop=4.0,length=7))) k = 5 d = 10 mses = Dict{String, Array{Float64, 2}}() times = Dict{String, Array{Float64, 2}}() for algo_name in keys(algos) mses[algo_name] =Array(Float64, length(n_vals), num_trials num_data_sets) times[algo_name] = Array(Float64, length(n_vals), num_trials num_data_sets) end
Warm-up for pre-compilation
n_warmup = 100 y, ystar, X = generate_equal_size_random_regression_data(k, n_warmup, d, sigma); @printf("Warm-up with n = %d\n", n_warmup) for (algo_name, algo_fun) in algos yhat_partition = algo_fun(X, y, k) end
for (nii, n) in enumerate(n_vals) @printf("n = %d ", n)
end
mses_mean = Dict{AbstractString, Array{Float64, 1}}() mses_std = Dict{AbstractString, Array{Float64, 1}}() times_mean = Dict{AbstractString, Array{Float64, 1}}() times_std = Dict{AbstractString, Array{Float64, 1}}() for algo_name in keys(mses) mses_mean[algo_name] = vec(mean(mses[algo_name], 2)) mses_std[algo_name] = vec(std(mses[algo_name], 2)) times_mean[algo_name] = vec(mean(times[algo_name], 2)) times_std[algo_name] = vec(std(times[algo_name], 2)) end
MethodError: no method matching Array(::Type{Float64}, ::Int32, ::Int32) Closest candidates are: Array(!Matched::LinearAlgebra.UniformScaling, ::Integer, ::Integer) at C:\cygwin\home\Administrator\buildbot\worker\package_win32\build\usr\share\julia\stdlib\v1.1\LinearAlgebra\src\uniformscaling.jl:345
Stacktrace: