keras
keras copied to clipboard
Why my code get better f1_score on older versions
System information.
- Have I written custom code (as opposed to using a stock example script provided in Keras): No
- OS Platform and Distribution: Linux Ubuntu 16.04
- TensorFlow installed from binary
- TensorFlow version (use command below): 2.10.0 , 2.7.0,
- Python version: 3.7.10
- GPU model and memory: TITAN V
Describe the problem. Hi, I adopt different Tensorflow and Keras versions with my code. But it returns a better f_1 Score on older versions.
To avoid the effect of random seeds, I try to set the random seed using this approach. https://github.com/keras-team/keras/issues/2743#issuecomment-904169662
import random
random.seed(2022)
np.random.seed(2022)
tf.random.set_seed(2022)
I also added shuffle = False in model.fit()
Describe the current behavior. The reproduction results are as follows:
| Tensorflow | Keras | F1 Score |
|---|---|---|
| 2.10.0 | 2.10.0 | 0.5369807497467073 |
| 2.7.0 | 2.7.0 | 0.29846938775510207 |
| 2.4.0 | 2.4.0 | 0.7376928728875827 |
Describe the expected behavior. Why the new version has worse results? The latest version of the score should be better.
Standalone code to reproduce the issue. I post the code on colad. click me to reproduce
https://github.com/tensorflow/tensorflow/issues/58431
@DSOTM-pf, I tried to execute the mentioned code with the dataset attached and was able to fetch the better f1-score than the older versions. Kindly find the gist of it here and let us know if anything required here.
Hi, I noticed that your execution achieved a 1.0 F1 score. But when I execute this code with tf-nightly, it returns 0.5369807497467073. I only uploaded the dataset on colab and modified the folder to '***.csv'. May I know what version of TensorFlow you are using when running, and whether the lower version also has a 1.0 f1 score?
@DSOTM-pf, I tried to execute the given code again on tf-nightly and I was still able to get the same f1 1.0. The tf-nightly version which I am using is 2.12.0-dev20221110. Kindly find the gist of it here. Thank you!
@tilakrayal I achieve the same @DSOTM-pf f1_score: 0.5369807497467073 on your colab gist with today tf-nightly-2.12.0.dev20221111.