Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why my code get better f1_score on older versions #374

Closed
DSOTM-pf opened this issue Nov 4, 2022 · 8 comments
Closed

Why my code get better f1_score on older versions #374

DSOTM-pf opened this issue Nov 4, 2022 · 8 comments

Comments

@DSOTM-pf
Copy link

DSOTM-pf commented Nov 4, 2022

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.
keras-team/keras#2743 (comment)

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

click me to download dataset

@DSOTM-pf
Copy link
Author

DSOTM-pf commented Nov 4, 2022

@tilakrayal
Copy link
Collaborator

@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.

@DSOTM-pf
Copy link
Author

DSOTM-pf commented Nov 7, 2022

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?

@tilakrayal
Copy link
Collaborator

@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!

@bhack
Copy link
Contributor

bhack commented Nov 12, 2022

@tilakrayal I achieve the same @DSOTM-pf f1_score: 0.5369807497467073 on your colab gist with today tf-nightly-2.12.0.dev20221111.

@google-ml-butler
Copy link

This issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Thank you.

@google-ml-butler
Copy link

Closing as stale. Please reopen if you'd like to work on this further.

@google-ml-butler
Copy link

Are you satisfied with the resolution of your issue?
Yes
No

@fchollet fchollet transferred this issue from keras-team/keras Sep 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants