# How to read and understand Julia documentation

**URL:** https://discourse.julialang.org/t/how-to-read-and-understand-julia-documentation/39122
**Category:** New to Julia
**Tags:** question, package
**Created:** [May 8, 2020, 5:23pm UTC](https://discourse.julialang.org/t/how-to-read-and-understand-julia-documentation/39122 "2020-05-08T17:23:01Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Oto\_Brzobohaty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oto_brzobohaty/32/10370_2.png) [@Oto\_Brzobohaty](https://discourse.julialang.org/u/Oto_Brzobohaty)
#### Post date: [May 8, 2020, 5:23pm UTC](https://discourse.julialang.org/t/how-to-read-and-understand-julia-documentation/39122/1 "2020-05-08T17:23:01Z")

</div>

# 1. Example:

I tried to use Optim package to implement [MATLAB fminsearch](https://www.mathworks.com/help/matlab/ref/fminsearch.html) I have found it in the Optim [documentation](https://julianlsolvers.github.io/Optim.jl/v0.9.3/algo/nelder_mead/) and I tried to follow it:

```julia
using Optim

struct MatlabSimplexer <: Optim.Simplexer
    a::Float64
    b::Float64
end
MatlabSimplexer(;a = 0.00025, b = 0.05) = MatlabSimplexer(a, b)

function Optim.simplexer{T, N}(A::MatlabSimplexer, initial_x::Array{T, N})
    n = length(initial_x)
    initial_simplex = Array{T, N}[initial_x for i = 1:n+1]
    for j = 1:n
        initial_simplex[j+1][j] += initial_simplex[j+1][j] == zero(T) ? S.b * initial_simplex[j+1][j] : S.a
    end
    initial_simplex
end

```

and I got this `ERROR: UndefVarError: T not defined`

How to read and understand this `Optim.simplexer{T, N}`?  
How to do it properly?

# 2. Example:

[LIBSVM.jl](https://github.com/mpastell/LIBSVM.jl) package ask you to follow `?svmtrain` for options, which is:

```julia-auto
svmtrain{T, U<:Real}(X::AbstractMatrix{U}, y::AbstractVector{T}=[];
      svmtype::Type=SVC, kernel::Kernel.KERNEL=Kernel.RadialBasis, degree::Integer=3,
      gamma::Float64=1.0/size(X, 1), coef0::Float64=0.0,
      cost::Float64=1.0, nu::Float64=0.5, epsilon::Float64=0.1,
      tolerance::Float64=0.001, shrinking::Bool=true,
      probability::Bool=false, weights::Union{Dict{T, Float64}, Compat.Nothing}=nothing,
      cachesize::Float64=200.0, verbose::Bool=false)

```

and a lot of listed parameters, e.g.

```
• svmtype::Type=LIBSVM.SVC: Type of SVM to train SVC (for C-SVM), NuSVC OneClassSVM, EpsilonSVR or NuSVR. Defaults to
    OneClassSVM if y is not used.

• kernel::Kernels.KERNEL=Kernel.RadialBasis: Model kernel Linear, polynomial, RadialBasis, Sigmoid or Precomputed.

• degree::Integer=3: Kernel degree. Used for polynomial kernel

• gamma::Float64=1.0/size(X, 1) : γ for kernels

```

Could you please explain to me how to set `svmtype` and `kernel`? And what is `svmtrain{T, U<:Real}`?

---

<div class="post-metadata">

### Author: ![pixel27](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pixel27/32/8902_2.png) [@pixel27](https://discourse.julialang.org/u/pixel27)
#### Post date: [May 8, 2020, 8:19pm UTC](https://discourse.julialang.org/t/how-to-read-and-understand-julia-documentation/39122/2 "2020-05-08T20:19:49Z")

</div>

I don’t know Optim, but for the error change:

```julia
function Optim.simplexer{T, N}(A::MatlabSimplexer, initial_x::Array{T, N})

```

to:

```julia
function Optim.simplexer(A::MatlabSimplexer, initial_x::Array{T, N}) where {T, N}

```

---

<div class="post-metadata">

### Author: ![tim.holy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tim.holy/32/52_2.png) [@tim.holy](https://discourse.julialang.org/u/tim.holy)
#### Post date: [May 8, 2020, 10:53pm UTC](https://discourse.julialang.org/t/how-to-read-and-understand-julia-documentation/39122/3 "2020-05-08T22:53:36Z")

</div>

Those are very old & outdated Optim documentation pages. Recommended procedure is to go to the GitHub page ([https://github.com/JuliaNLSolvers/Optim.jl](https://github.com/JuliaNLSolvers/Optim.jl)) and click on the blue documentation badge.

---

<div class="post-metadata">

### Author: ![Oto\_Brzobohaty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oto_brzobohaty/32/10370_2.png) [@Oto\_Brzobohaty](https://discourse.julialang.org/u/Oto_Brzobohaty)
#### Post date: [May 9, 2020, 5:53am UTC](https://discourse.julialang.org/t/how-to-read-and-understand-julia-documentation/39122/4 "2020-05-09T05:53:01Z")

</div>

Thank you for answer. I will pay more attention to documentation version:-)
