@@ -6,7 +6,7 @@ global_logger(TerminalLogger())
66using Distributions
77ndata = 1024
88ndimensions = 1
9- data_dist = Beta (2.0 , 4.0 )
9+ data_dist = Beta (2.0f0 , 4.0f0 )
1010r = rand (data_dist, ndimensions, ndata)
1111
1212# # Parameters
@@ -37,11 +37,11 @@ icnf = ICNF(;
3737 nvariables = nvariables, # number of variables
3838 naugments = naugments, # number of augmented dimensions
3939 nconditions = 0 , # number of conditioning inputs
40- λ₁ = 0.01 , # regulate flow
41- λ₂ = 0.01 , # regulate volume change
42- λ₃ = 0.01 , # regulate augmented dimensions
43- steer_rate = 0.1 , # add random noise to end of the time span
44- tspan = (0.0 , 1.0 ), # time span
40+ λ₁ = 0.01f0 , # regulate flow
41+ λ₂ = 0.01f0 , # regulate volume change
42+ λ₃ = 0.01f0 , # regulate augmented dimensions
43+ steer_rate = 0.1f0 , # add random noise to end of the time span
44+ tspan = (0.0f0 , 1.0f0 ), # time span
4545 device = cpu_device (), # process data by CPU
4646 # device = gpu_device(), # process data by GPU
4747 autonomous = false , # using non-autonomous flow
@@ -51,14 +51,14 @@ icnf = ICNF(;
5151 sol_kwargs = (;
5252 save_everystep = false ,
5353 maxiters = typemax (Int),
54- reltol = 1.0e -4 ,
55- abstol = 1.0e-8 ,
54+ reltol = 1.0f -4 ,
55+ abstol = 1.0f-4 ,
5656 alg = VCABM (),
5757 sensealg = QuadratureAdjoint (;
5858 autodiff = true ,
5959 autojacvec = ZygoteVJP (),
60- reltol = 1.0e -4 ,
61- abstol = 1.0e-8 ,
60+ reltol = 1.0f -4 ,
61+ abstol = 1.0f-4 ,
6262 ),
6363 progress = false ,
6464 verbose = Detailed (),
@@ -86,9 +86,8 @@ if !isfile(icnf_mach_fn)
8686 epochs = 300 ,
8787 callback = opt_callback,
8888 alg = OptimiserChain (
89- WeightDecay (; lambda = 1.0e-4 ),
90- ClipNorm (10.0 , 2.0 ; throw = true ),
91- Adam (; eta = 0.001 , beta = (0.9 , 0.999 ), epsilon = 1.0e-8 ),
89+ WeightDecay (; lambda = 1.0f-4 ),
90+ Adam (; eta = 0.001f0 , beta = (0.9f0 , 0.999f0 ), epsilon = 1.0f-8 ),
9291 ),
9392 progress = true ,
9493 verbose = Detailed (),
@@ -120,8 +119,8 @@ display(res_df)
120119using CairoMakie
121120f = Figure ()
122121ax = Axis (f[1 , 1 ]; title = " Result" )
123- lines! (ax, 0.0 .. 1.0 , x -> pdf (data_dist, x); label = " Actual" )
124- lines! (ax, 0.0 .. 1.0 , x -> pdf (d, vcat (x)); label = " Estimated" )
122+ lines! (ax, 0.0f0 .. 1.0f0 , x -> pdf (data_dist, x); label = " Actual" )
123+ lines! (ax, 0.0f0 .. 1.0f0 , x -> pdf (d, vcat (x)); label = " Estimated" )
125124axislegend (ax)
126125save (" result-figure.svg" , f)
127126save (" result-figure.png" , f)
0 commit comments