Skip to content
Minsing Log
Go back

English Edition

What is random_state?

Programming & CS

Situation

While benchmarking the RAGchain Mr.tydi dataset, I encountered a situation where I needed to shuffle a pandas dataframe, so I had to use the “sample()method. Among the parameters of thesample()` method, there is one called random_state, and I wanted to learn more about it.

Conclusion

It serves to fix the random value. It is used to reproduce the results across executions. If the random seed is set to a constant value, the data will be shuffled identically, so fixing random_state will always shuffle the dataframe in the same way.

Setting random_state=1 fixes the seed value of this random function, so the same records are extracted even when it is executed multiple times. You can think of the seed value of the random function as random_state.

References

공개 여정 구독

글이 올라오면 이메일로 보내드릴게요.

개발, 창업, 배움, 실패와 회고를 짧고 솔직하게 기록합니다. 검색으로 스쳐가는 독자가 아니라 여정을 따라오는 팬을 만들기 위한 뉴스레터입니다.

뉴스레터는 준비 중입니다. 그동안 RSS 로 구독하거나 이메일 로 알림을 요청해 주세요.


Share this post:

Comments

Sign in with GitHub to leave a comment.


Previous Post
What Are Qrels?
Next Post
How to Index DataFrames (loc, iloc, df[whatever])