analysiscenter / cardio

CardIO is a library for data science research of heart signals
https://analysiscenter.github.io/cardio/
Apache License 2.0
248 stars 78 forks source link

different predictions for the same eds.test #14

Closed yevheniia-makarenko closed 6 years ago

yevheniia-makarenko commented 6 years ago

Hi! I set np.random.seed for the same random number in random_split_signals, but I start several times - I get different predictions each time tf_predict_pipeline = (ds.dataset.Pipeline() .init_model("dynamic", TFConvModel, name="conv_model", config=model_config) .init_variable("predictions_list", init_on_each_run=list) .load(fmt="wfdb", components=["signal", "meta"]) .flip_signals() .random_split_signals(2048,1) .apply_transform(func=np.transpose, src='signal', dst='signal', axes=[0, 2, 1]) .predict_model('conv_model', make_data=tf_make_data, fetches='output', save_to=V("predictions_list"), mode="e"))

dpodvyaznikov commented 6 years ago

Hi! In the code provided you initialize dynamic model each time you run the pipeline. At this moment tensorflow initializes weights in the model with it's own pseudorandom number generator, which is not affected by numpy's seed. So, while random_split is the same at each run due to fixed numpy.seed, you make predictions with different models and it is normal that you get different predictions.

yevheniia-makarenko commented 6 years ago

Thank you for your reply!