Skip to content

Commit

Permalink
set seed
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander-Barth committed Dec 11, 2019
1 parent 097b4ae commit 051e381
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion DINCAE.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@ def reconstruct(lon,lat,mask,meandata,
nvar = 10,
enc_ksize_internal = [16,24,36,54],
clip_grad = 5.0,
regularization_L2_beta = 0
regularization_L2_beta = 0,
iseed = None
):
"""
Train a neural network to reconstruct missing data using the training data set
Expand Down Expand Up @@ -281,6 +282,11 @@ def reconstruct(lon,lat,mask,meandata,
* `regularization_L2_beta`: scalar to enforce L2 regularization on the weight
"""

if iseed != None:
np.random.seed(iseed)
tf.set_random_seed(np.random.randint(0,2**32-1))
random.seed(np.random.randint(0,2**32-1))

print("regularization_L2_beta ",regularization_L2_beta)
print("enc_ksize_internal ",enc_ksize_internal)
enc_ksize = [nvar] + enc_ksize_internal
Expand Down Expand Up @@ -566,6 +572,7 @@ def reconstruct_gridded_nc(filename,varname,outdir,
`DINCAE.load_gridded_nc` for the NetCDF format.
"""

lon,lat,time,data,missing,mask = load_gridded_nc(filename,varname)
train_datagen,train_len,meandata = data_generator(
lon,lat,time,data,missing,
Expand Down

0 comments on commit 051e381

Please sign in to comment.