Comments (6)
Thanks for the response. But if I could not reproduce the rand with specified random seed operation by seed!(123)
, what's the point to use the my_seed
?
julia> my_seed = seed!(123)
Random.TaskLocalRNG()
julia> rand(my_seed, 3)
3-element Vector{Float64}:
0.521213795535383
0.5868067574533484
0.8908786980927811
julia> rand(my_seed, 3)
3-element Vector{Float64}:
0.19090669902576285
0.5256623915420473
0.3905882754313441
from juliadatascience.
@ShixiangWang have you seen the new note?
NOTE:
Note that these numbers might differ for different Julia versions.
To have stable streams across Julia versions use theStableRNGs.jl
package.
from juliadatascience.
what's the point to use the
my_seed
?
Also the most important thing about using a seed is usually to have a reproducible workflow when developing. When developing, it is common to run one part of the code for dozens of times. Debugging is much easier when the output is the same for each run.
from juliadatascience.
Due to HTTP issues in the automated workflow, the book isn't updated yet. Azure has some outages (https://news.ycombinator.com/item?id=29574027), so that is probably related.
I'll click retry a few times, so the book should be updated somewhere today.
from juliadatascience.
Hi guys, I think you mistake my point above. I do agree the random seed is very important.
We can reproduce the sequence generation with command below.
julia> using Random: rand, randn, seed!
julia> seed!(123)
Random.TaskLocalRNG()
julia> rand(3)
3-element Vector{Float64}:
0.521213795535383
0.5868067574533484
0.8908786980927811
julia> seed!(123)
Random.TaskLocalRNG()
julia> rand(3)
3-element Vector{Float64}:
0.521213795535383
0.5868067574533484
0.8908786980927811
However, in the book, as the code below cannot reproduce the same sequence, why the book still describe it. I think current text is misguiding readers. my_seed = seed!(123)
is still useless, right? as the rand(my_seed, 3)
can't reproduce same result when we type it again.
julia> my_seed = seed!(123)
Random.TaskLocalRNG()
julia> rand(my_seed, 3)
3-element Vector{Float64}:
0.521213795535383
0.5868067574533484
0.8908786980927811
julia> rand(my_seed, 3)
3-element Vector{Float64}:
0.19090669902576285
0.5256623915420473
0.3905882754313441
This is not a bug in Julia, as I get similar result (put my_seed
in rand
does not help reproduce the sequence) when I use v1.3.1 from https://cn.julialang.org/learning/tryjulia/
julia version 1.3.1
using Random: rand, randn, seed!
my_seed = seed!(123)
Random.MersenneTwister(UInt32[0x0000007b], Random.DSFMT.DSFMT_state(Int32[1464307935, 1073116007, 222134151, 1073120226, -290652630, 1072956456, -580276323, 1073476387, 1332671753, 1073438661 … 138346874, 1073030449, 1049893279, 1073166535, -1999907543, 1597138926, -775229811, 32947490, 382, 0]), [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], UInt128[0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000 … 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000], 1002, 0)
rand(my_seed, 3)
3-element Array{Float64,1}:
0.7684476751965699
0.940515000715187
0.6739586945680673
rand(my_seed, 3)
3-element Array{Float64,1}:
0.3954531123351086
0.3132439558075186
0.6625548164736534
from juliadatascience.
As I said. The book is still in the process of being updated.
my_seed = seed!(123) is still useless, right?
No it is not. See the discussion above.
from juliadatascience.
Related Issues (20)
- Why Julia, `@code_llvm` output mistake HOT 2
- Float32 on x_32 keeps it float type HOT 3
- Outdated informaiton on Makie HOT 2
- Content of the book: static or dynamic? HOT 2
- The inset plot can only take `:top`, `:center`, `:right` instead of numbers
- Connect `DataFrames.jl` to `Makie.jl`?
- Discuss `Makie.jl` vs `Plots.jl`
- Make a Modules and Environment Management [small] section
- Missing Data section in `DataFrames.jl` Chapter
- Add a more visible donate link HOT 7
- new book format HOT 3
- Highlight the guidelines of `DataFrames.jl`
- Section/Chapter on `DataFramesMeta.jl`
- Section/Chapter on `AlgebraOfGraphics.jl`
- Subsection on `dataframes_load_save` about `Arrow.jl` HOT 4
- 4.1.2 Excel - failure
- 2 suggestions for enhancement HOT 5
- Makie 0.20 warnings
- CI: Upload PDF as the CI Artifact
- Please add correlation heatmaps + correlation plots HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from juliadatascience.