O slideshow foi denunciado.
Seu SlideShare está sendo baixado. ×

The Language for future-julia

Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Próximos SlideShares
Introduction to julia
Introduction to julia
Carregando em…3
×

Confira estes a seguir

1 de 86 Anúncio

Mais Conteúdo rRelacionado

Diapositivos para si (20)

Semelhante a The Language for future-julia (20)

Anúncio

Mais de 岳華 杜 (20)

Mais recentes (20)

Anúncio

The Language for future-julia

  1. 1. 1
  2. 2. 2
  3. 3. 3
  4. 4. python ★ 29.2k golang ★ 68.7k nodejs ★ 67.6k rust ★ 38,548
  5. 5. 5
  6. 6. 6 Rapid development Production Readable & modifiable Performance
  7. 7.       7
  8. 8. a = [1, 2, 3, 4, 5] function square(x) return x^2 end for x in a println(square(x)) end 8
  9. 9. https://julialang.org/benchmarks/ 9
  10. 10. 10
  11. 11. https://juliacomputing.com/case-studies/laketide.html  
  12. 12. https://juliacomputing.com/case-studies/mit-robotics.html  
  13. 13.  https://juliacomputing.com/case-studies/ny-fed.html 13 https://github.com/FRBNY-DSGE/DSGE.jl
  14. 14. https://juliacomputing.com/case-studies/rna.html  
  15. 15. https://juliacomputing.com/case-studies/circuitscape.html    http://maps.tnc.org/migrations-in-motion/
  16. 16.   https://juliacomputing.com/case-studies/intel-astro.html 20
  17. 17. https://www.nature.com/articles/d41586-019-02310-3
  18. 18. https://github.com/JuliaRegistries/General/blob/master/Registry.toml 22
  19. 19. 23
  20. 20. 24 https://docs.juliatw.org/latest/
  21. 21. 25
  22. 22. 26
  23. 23. 27
  24. 24. 28
  25. 25. 29
  26. 26. 30 VimEmacsVscodeSublime IntelliJ
  27. 27. 31
  28. 28.     32 μ = 0 σ = 1 normal = Normal(μ, σ)
  29. 29.        33
  30. 30.   34
  31. 31. for i = 1:100_000 do_something() end Threads.@threads for i = 1:100_000 do_something() end 35
  32. 32. Julia mode: julia> using Pkg julia> Pkg.update() julia> Pkg.add(“Foo”) julia> Pkg.rm(“Foo”) 36 Pkg mode: v(1.3) pkg> update V(1.3) pkg> add Foo v(1.3) pkg> rm Foo
  33. 33. julia> @code_native add(1, 2) .text Filename: REPL[2] pushq %rbp movq %rsp, %rbp Source line: 2 leaq (%rcx,%rdx), %rax popq %rbp retq nopw (%rax,%rax) function add(a, b) return a+b end 37
  34. 34. julia> @code_llvm add(1, 2.0) ; Function Attrs: uwtable define double @julia_add_71636(i64, double) #0 { top: %2 = sitofp i64 %0 to double %3 = fadd double %2, %1 ret double %3 } function add(a, b) return a+b end 38
  35. 35. 48
  36. 36. 49 https://juliastats.org/
  37. 37. 50
  38. 38. 51
  39. 39. 52
  40. 40. 53
  41. 41. 54 Bootstrap CategoricalArrays Clustering CSV DataFrames Distances Distributions GLM HypothesisTests KernelDensity Loess MultivariateStats StatsBase TimeSeries
  42. 42. julia> using DataFrames julia> df = DataFrame(A = 1:4, B = ["M", "F", "F", "M"]) 4× 2 DataFrame │ Row │ A │ B │ ├─────┼───┼───┤ │ 1 │ 1 │ M │ │ 2 │ 2 │ F │ │ 3 │ 3 │ F │ │ 4 │ 4 │ M │ 55
  43. 43. julia> df[:A] 4-element Array{Int64,1}: 1 2 3 4 julia> df[2, :A] 2 56
  44. 44. julia> using CSV julia> df = CSV.read("data.csv") julia> df = DataFrame(A = 1:10); julia> CSV.write("output.csv", df) 57
  45. 45. julia> names = DataFrame(ID = [1, 2], Name = ["John Doe", "Jane Doe"]) julia> jobs = DataFrame(ID = [1, 2], Job = ["Lawyer", "Doctor"]) julia> full = join(names, jobs, on = :ID) 2× 3 DataFrame │ Row │ ID │ Name │ Job │ ├─────┼────┼──────────┼────────┤ │ 1 │ 1 │ John Doe │ Lawyer │ │ 2 │ 2 │ Jane Doe │ Doctor │ 58
  46. 46. julia> q1 = @from i in df begin @where i.age > 40 @select {number_of_children=i.children, i.name} @collect DataFrame end 59
  47. 47. 63 julia> data = DataFrame(X=[1,2,3], Y=[2,4,7]) 3x2 DataFrame |-------|---|---| | Row # | X | Y | | 1 | 1 | 2 | | 2 | 2 | 4 | | 3 | 3 | 7 |
  48. 48. 64 julia> OLS = glm(@formula(Y ~ X), data, Normal(), IdentityLink()) DataFrameRegressionModel{GeneralizedLinearModel,Float64}: Coefficients: Estimate Std.Error z value Pr(>|z|) (Intercept) -0.666667 0.62361 -1.06904 0.2850 X 2.5 0.288675 8.66025 <1e-17
  49. 49. 65 julia> newX = DataFrame(X=[2,3,4]); julia> predict(OLS, newX, :confint) 3× 3 Array{Float64,2}: 4.33333 1.33845 7.32821 6.83333 2.09801 11.5687 9.33333 1.40962 17.257 # The columns of the matrix are prediction, 95% lower and upper confidence bounds
  50. 50. 66
  51. 51. 67 # initialize the attractor n = 1500 dt = 0.02 σ, ρ, β = 10., 28., 8/3 x, y, z = 1., 1., 1. # initialize a 3D plot with 1 empty series plt = plot3d(1, xlim=(-25,25), ylim=(-25,25), zlim=(0,50), xlab = "x", ylab = "y", zlab = "z", title = "Lorenz Attractor", marker = 1) # build an animated gif, saving every 10th frame @gif for i=1:n dx = σ*(y - x) ; x += dt * dx dy = x*(ρ - z) - y ; y += dt * dy dz = x*y - β*z ; z += dt * dz push!(plt, x, y, z) end every 10
  52. 52.   JuliaStats  68
  53. 53. 69
  54. 54. 70 https://julialang.org/blog/2017/12/ml&pl-zh_tw
  55. 55.   71Ref: https://venturebeat.com/2019/02/18/facebooks-chief-ai-scientist-deep-learning-may-need-a-new-programming-language/ Pic: https://xconomy.com/boston/2017/11/01/as-facebook-fights-fake-news-lecun-sees-bigger-role-for-a-i/
  56. 56. 2019.2.20 10 a.m.
  57. 57.    73 https://github.com/FluxML/Zygote.jl
  58. 58. 74 julia> using Zygote julia> f(x) = 3x + 2 f (generic function with 1 method) julia> f(3.) 11.0 julia> f'(3.) 3.0
  59. 59. 75 julia> @code_llvm f'(3.) ; Function Attrs: uwtable define double @"julia_#34_17010"(double) #0 { top: ret double 3.000000e+00 }
  60. 60.      76
  61. 61.       77
  62. 62. 78 Pic: https://blog.algorithmia.com/introduction-to-loss-functions/ Loss function Pic: http://dsdeepdive.blogspot.com/2016/03/optimizations-of-gradient-descent.html Gradient
  63. 63.        79     for-loop, while-loop
  64. 64.      81 @model gdemo(x, y) = begin # Assumptions σ ~ InverseGamma(2,3) μ ~ Normal(0,sqrt(σ)) # Observations x ~ Normal(μ, sqrt(σ)) y ~ Normal(μ, sqrt(σ)) end https://turing.ml/dev/
  65. 65. 82 https://turing.ml/dev/
  66. 66. 83 https://github.com/alan-turing-institute/MLJ.jl Integrate 109 models
  67. 67. 84 https://github.com/alan-turing-institute/MLJ.jl
  68. 68.       85 https://github.com/alan-turing-institute/MLJ.jl
  69. 69.     Next: Machine Learning and Deep Learning on Quantum Computing 86 https://github.com/QuantumBFS/Yao.jl
  70. 70.      87 https://github.com/JuliaGPU/CuArrays.jl
  71. 71. 88
  72. 72.        89
  73. 73.   90 http://www.stochasticlifestyle.com/co mparison-differential-equation-solver- suites-matlab-r-julia-python-c-fortran/
  74. 74.    91 Objective types • Linear • Convex Quadratic • Nonlinear (convex and nonconvex) Constraint types • Linear • Convex Quadratic • Second-order Conic • Semidefinite • Nonlinear (convex and nonconvex) Variable types • Continuous • Integer-valued • Semicontinuous • Semi-integer
  75. 75. 92
  76. 76. 93
  77. 77.   94
  78. 78. 95 https://mobile.twitter.com/KenoFischer/status/1158517084642582529
  79. 79. 96 https://juliacon.org/2020/
  80. 80. https://julialang.org/teaching/
  81. 81.  
  82. 82.     101

×