JuliaPro v0.6.4.1 Package API Manual
JuliaPro v0.6.4.1 Package API Manual
1 API Manual
1 Distributions 1
2 StatsBase 46
3 PyPlot 84
4 IndexedTables 112
5 Images 146
6 DataFrames 165
7 Knet 183
8 BinaryProvider 199
9 DataStructures 213
10 JDBC 226
11 ImageCore 237
12 Reactive 246
13 Combinatorics 254
14 JuliaDB 262
15 HypothesisTests 269
16 PyCall 275
17 CategoricalArrays 282
18 GLM 288
19 Roots 295
I
II CONTENTS
20 Documenter 302
21 ColorTypes 307
22 FileIO 312
23 DataArrays 317
24 Primes 324
25 ImageTransformations 330
26 StatsFuns 334
27 Gadfly 339
28 IterTools 344
29 Polynomials 352
30 Colors 356
31 Interact 360
32 FFTW 364
33 WebSockets 368
34 AxisArrays 371
35 BusinessDays 375
36 QuadGK 378
37 Dagger 381
38 NNlib 384
39 ShowItLikeYouBuildIt 387
40 CoordinateTransformations 390
41 Graphics 392
42 MacroTools 395
43 ImageMorphology 398
44 NLSolversBase 400
CONTENTS III
45 Contour 402
46 Compose 404
47 CoupledFields 407
48 AxisAlgorithms 409
49 Libz 411
50 ImageMetadata 414
51 LegacyStrings 416
52 BufferedStreams 418
53 MbedTLS 420
54 DataValues 422
55 NearestNeighbors 424
56 IJulia 425
57 HDF5 427
58 CUDAapi 429
59 AutoGrad 431
60 ComputationalResources 433
61 MicroLogging 435
62 Clustering 437
63 JuliaWebAPI 439
64 DecisionTree 441
65 Parameters 443
66 Blosc 445
67 Missings 447
68 ProgressMeter 449
69 HttpServer 451
IV CONTENTS
70 MappedArrays 453
71 TextParse 454
72 LossFunctions 456
73 LearnBase 457
74 Juno 459
75 StatsModels 461
76 InternedStrings 462
77 HttpParser 463
78 ImageAxes 464
79 Flux 465
80 OnlineStats 466
81 IntervalSets 467
82 Media 468
83 Rotations 469
84 Mustache 470
85 TiledIteration 471
86 Distances 472
87 VersionParsing 473
88 HttpCommon 474
89 StaticArrays 475
90 SweepOperator 476
91 PaddedViews 477
92 Pidfile 478
93 SpecialFunctions 479
94 NamedTuples 480
CONTENTS V
95 OnlineStatsBase 481
96 Loess 482
97 WoodburyMatrices 483
98 Lazy 484
99 Requests 485
Distributions
1.1 Base.LinAlg.scale!
Base.LinAlg.scale! — Method.
scale!{D<:AbstractMvLogNormal}(::Type{D},s::Symbol,m::AbstractVector,S::AbstractMatrix,::Abstract
Calculate the scale parameter, as defined for the location parameter above
and store the result in .
source
1.2 Base.mean
Base.mean — Method.
mean(d::Union{UnivariateMixture, MultivariateMixture})
1.3 Base.mean
Base.mean — Method.
mean(d::MatrixDistribution)
1
2 CHAPTER 1. DISTRIBUTIONS
1.4 Base.mean
Base.mean — Method.
mean(d::MultivariateDistribution)
1.5 Base.mean
Base.mean — Method.
mean(d::UnivariateDistribution)
1.6 Base.median
Base.median — Method.
median(d::UnivariateDistribution)
1.7 Base.median
Base.median — Method.
median(d::MvLogNormal)
1.8 Base.quantile
Base.quantile — Method.
quantile(d::UnivariateDistribution, q::Real)
1.9 Base.std
Base.std — Method.
std(d::UnivariateDistribution)
Return the standard deviation of distribution d, i.e. sqrt(var(d)).
source
1.10 Base.var
Base.var — Method.
var(d::UnivariateMixture)
Compute the overall variance (only for U nivariateM ixture).
source
1.11 Base.var
Base.var — Method.
var(d::MultivariateDistribution)
Compute the vector of element-wise variances for distribution d.
source
1.12 Base.var
Base.var — Method.
var(d::UnivariateDistribution)
Compute the variance. (A generic std is provided as std(d) = sqrt(var(d)))
source
1.13 Distributions.TruncatedNormal
Distributions.TruncatedNormal — Method.
TruncatedNormal(mu, sigma, l, u)
The truncated normal distribution is a particularly important one in the fam-
ily of truncated distributions. We provide additional support for this type with
TruncatedNormal which calls Truncated(Normal(mu, sigma), l, u). Unlike
the general case, truncated normal distributions support mean, mode, modes,
var, std, and entropy.
source
4 CHAPTER 1. DISTRIBUTIONS
1.14 Distributions.ccdf
Distributions.ccdf — Method.
ccdf(d::UnivariateDistribution, x::Real)
1.15 Distributions.cdf
Distributions.cdf — Method.
cdf(d::UnivariateDistribution, x::Real)
1.16 Distributions.cf
Distributions.cf — Method.
cf(d::UnivariateDistribution, t)
1.17 Distributions.components
Distributions.components — Method.
components(d::AbstractMixtureModel)
1.18 Distributions.cquantile
Distributions.cquantile — Method.
cquantile(d::UnivariateDistribution, q::Real)
1.19 Distributions.failprob
Distributions.failprob — Method.
failprob(d::UnivariateDistribution)
fit_mle(D, x, w)
fit_mle(D, x)
source
1.22 Distributions.insupport
Distributions.insupport — Method.
insupport(d::MultivariateMixture, x)
1.23 Distributions.insupport
Distributions.insupport — Method.
insupport(d::MultivariateDistribution, x::AbstractArray)
1.24 Distributions.insupport
Distributions.insupport — Method.
insupport(d::UnivariateDistribution, x::Any)
1.25 Distributions.invcov
Distributions.invcov — Method.
invcov(d::AbstractMvNormal)
1.26 Distributions.invlogccdf
Distributions.invlogccdf — Method.
invlogcdf(d::UnivariateDistribution, lp::Real)
1.27 Distributions.invlogcdf
Distributions.invlogcdf — Method.
invlogcdf(d::UnivariateDistribution, lp::Real)
1.28 Distributions.isleptokurtic
Distributions.isleptokurtic — Method.
isleptokurtic(d)
1.29 Distributions.ismesokurtic
Distributions.ismesokurtic — Method.
ismesokurtic(d)
1.30 Distributions.isplatykurtic
Distributions.isplatykurtic — Method.
isplatykurtic(d)
1.31 Distributions.location!
Distributions.location! — Method.
location!{D<:AbstractMvLogNormal}(::Type{D},s::Symbol,m::AbstractVector,S::AbstractMatrix,::Abstr
Calculate the location vector (as above) and store the result in
source
8 CHAPTER 1. DISTRIBUTIONS
1.32 Distributions.location
Distributions.location — Method.
location(d::UnivariateDistribution)
1.33 Distributions.location
Distributions.location — Method.
location(d::MvLogNormal)
Return the location vector of the distribution (the mean of the underlying
normal distribution).
source
1.34 Distributions.location
Distributions.location — Method.
location{D<:AbstractMvLogNormal}(::Type{D},s::Symbol,m::AbstractVector,S::AbstractMatri
Calculate the location vector (the mean of the underlying normal distribu-
tion).
It is not possible to analytically calculate the location vector from e.g., me-
dian + covariance, or from mode + covariance.
source
1.35 Distributions.logccdf
Distributions.logccdf — Method.
logccdf(d::UnivariateDistribution, x::Real)
1.36 Distributions.logcdf
Distributions.logcdf — Method.
logcdf(d::UnivariateDistribution, x::Real)
1.37 Distributions.logdetcov
Distributions.logdetcov — Method.
logdetcov(d::AbstractMvNormal)
1.38 Distributions.logpdf
Distributions.logpdf — Method.
logpdf(d::Union{UnivariateMixture, MultivariateMixture}, x)
1.39 Distributions.logpdf
Distributions.logpdf — Method.
logpdf(d::MultivariateDistribution, x::AbstractArray)
1.40 Distributions.logpdf
Distributions.logpdf — Method.
logpdf(d::UnivariateDistribution, x::Real)
1.41 Distributions.logpdf
Distributions.logpdf — Method.
logpdf(d::MatrixDistribution, AbstractMatrix)
1.42 Distributions.mgf
Distributions.mgf — Method.
mgf(d::UnivariateDistribution, t)
1.43 Distributions.ncategories
Distributions.ncategories — Method.
ncategories(d::UnivariateDistribution)
1.44 Distributions.nsamples
Distributions.nsamples — Method.
nsamples(s::Sampleable)
1.45 Distributions.ntrials
Distributions.ntrials — Method.
ntrials(d::UnivariateDistribution)
1.46 Distributions.pdf
Distributions.pdf — Method.
pdf(d::Union{UnivariateMixture, MultivariateMixture}, x)
1.47 Distributions.pdf
Distributions.pdf — Method.
pdf(d::MultivariateDistribution, x::AbstractArray)
1.48 Distributions.pdf
Distributions.pdf — Method.
pdf(d::UnivariateDistribution, x::Real)
1.49 Distributions.pdf
Distributions.pdf — Method.
pdf(d::MatrixDistribution, x::AbstractArray)
1.50 Distributions.probs
Distributions.probs — Method.
probs(d::AbstractMixtureModel)
1.51 Distributions.rate
Distributions.rate — Method.
rate(d::UnivariateDistribution)
1.52 Distributions.sampler
Distributions.sampler — Method.
Samplers can often rely on pre-computed quantities (that are not parameters
themselves) to improve efficiency. If such a sampler exists, it can be provide
with this sampler method, which would be used for batch sampling. The general
fallback is sampler(d::Distribution) = d.
source
1.53 Distributions.scale
Distributions.scale — Method.
scale(d::UnivariateDistribution)
1.54 Distributions.scale
Distributions.scale — Method.
scale(d::MvLogNormal)
Return the scale matrix of the distribution (the covariance matrix of the
underlying normal distribution).
source
1.55 Distributions.scale
Distributions.scale — Method.
scale{D<:AbstractMvLogNormal}(::Type{D},s::Symbol,m::AbstractVector,S::AbstractMatrix)
Calculate the scale parameter, as defined for the location parameter above.
source
1.56 Distributions.shape
Distributions.shape — Method.
shape(d::UnivariateDistribution)
Get the shape parameter.
source
1.57 Distributions.sqmahal
Distributions.sqmahal — Method.
sqmahal(d, x)
Return the squared Mahalanobis distance from x to the center of d, w.r.t.
the covariance. When x is a vector, it returns a scalar value. When x is a
matrix, it returns a vector of length size(x,2).
sqmahal!(r, d, x) with write the results to a pre-allocated array r.
source
1.58 Distributions.succprob
Distributions.succprob — Method.
succprob(d::UnivariateDistribution)
Get the probability of success.
source
14 CHAPTER 1. DISTRIBUTIONS
1.59 StatsBase.dof
StatsBase.dof — Method.
dof(d::UnivariateDistribution)
1.60 StatsBase.entropy
StatsBase.entropy — Method.
entropy(d::MultivariateDistribution, b::Real)
1.61 StatsBase.entropy
StatsBase.entropy — Method.
entropy(d::MultivariateDistribution)
1.62 StatsBase.entropy
StatsBase.entropy — Method.
entropy(d::UnivariateDistribution, b::Real)
1.63 StatsBase.entropy
StatsBase.entropy — Method.
entropy(d::UnivariateDistribution)
1.64 StatsBase.kurtosis
StatsBase.kurtosis — Method.
kurtosis(d::Distribution, correction::Bool)
1.65 StatsBase.kurtosis
StatsBase.kurtosis — Method.
kurtosis(d::UnivariateDistribution)
1.66 StatsBase.loglikelihood
StatsBase.loglikelihood — Method.
loglikelihood(d::MultivariateDistribution, x::AbstractMatrix)
1.67 StatsBase.loglikelihood
StatsBase.loglikelihood — Method.
loglikelihood(d::UnivariateDistribution, X::AbstractArray)
1.68 StatsBase.mode
StatsBase.mode — Method.
mode(d::UnivariateDistribution)
1.69 StatsBase.mode
StatsBase.mode — Method.
mode(d::MvLogNormal)
1.70 StatsBase.modes
StatsBase.modes — Method.
modes(d::UnivariateDistribution)
1.71 StatsBase.params!
StatsBase.params! — Method.
params!{D<:AbstractMvLogNormal}(::Type{D},m::AbstractVector,S::AbstractMatrix,::Abstrac
Calculate (scale,location) for a given mean and covariance, and store the
results in and
source
1.72 StatsBase.params
StatsBase.params — Method.
params(d::UnivariateDistribution)
1.73 StatsBase.params
StatsBase.params — Method.
params{D<:AbstractMvLogNormal}(::Type{D},m::AbstractVector,S::AbstractMatrix)
1.74 StatsBase.skewness
StatsBase.skewness — Method.
skewness(d::UnivariateDistribution)
1.75 Distributions.AbstractMvNormal
Distributions.AbstractMvNormal — Type.
The Multivariate normal distribution is a multidimensional generalization
of the normal distribution. The probability density function of a d-dimensional
multivariate normal distribution with mean vector µ and covariance matrix Σ
is:
1 1
f (x; µ, Σ) = exp − (x − µ)T Σ−1 (x − µ)
(2π)d/2 |Σ|1/2 2
We realize that the mean vector and the covariance often have special forms
in practice, which can be exploited to simplify the computation. For example,
the mean vector is sometimes just a zero vector, while the covariance matrix
can be a diagonal matrix or even in the form of σI. To take advantage of such
special cases, we introduce a parametric type MvNormal, defined as below, which
allows users to specify the special structure of the mean and covariance.
[] immutable MvNormal{Cov¡:AbstractPDMat,Mean¡:Union{Vector,ZeroVector}}
¡: AbstractMvNormal ::Mean ::Cov end
Here, the mean vector can be an instance of either Vector or ZeroVector,
where the latter is simply an empty type indicating a vector filled with zeros.
The covariance can be of any subtype of AbstractPDMat. Particularly, one can
use PDMat for full covariance, PDiagMat for diagonal covariance, and ScalMat
for the isotropic covariance – those in the form of σI. (See the Julia package
PDMats for details).
We also define a set of alias for the types using different combinations of
mean vectors and covariance:
[] const IsoNormal = MvNormal{ScalMat, Vector{Float64}} const DiagNor-
mal = MvNormal{PDiagMat, Vector{Float64}} const FullNormal = MvNor-
mal{PDMat, Vector{Float64}}
const ZeroMeanIsoNormal = MvNormal{ScalMat, ZeroVector{Float64}} const
ZeroMeanDiagNormal = MvNormal{PDiagMat, ZeroVector{Float64}} const
ZeroMeanFullNormal = MvNormal{PDMat, ZeroVector{Float64}}
source
18 CHAPTER 1. DISTRIBUTIONS
1.76 Distributions.Arcsine
Distributions.Arcsine — Type.
Arcsine(a,b)
1
f (x) = p , x ∈ [a, b]
π (x − a)(b − x)
source
1.77 Distributions.Bernoulli
Distributions.Bernoulli — Type.
Bernoulli(p)
source
1.78. DISTRIBUTIONS.BETA 19
1.78 Distributions.Beta
Distributions.Beta — Type.
Beta(,)
1
f (x; α, β) = xα−1 (1 − x)β−1 , x ∈ [0, 1]
B(α, β)
The Beta distribution is related to the Gamma distribution via the property
that if X ∼ Gamma(α) and Y ∼ Gamma(β) independently, then X/(X + Y ) ∼
Beta(α, β).
[] Beta() equivalent to Beta(1, 1) Beta(a) equivalent to Beta(a, a) Beta(a,
b) Beta distribution with shape parameters a and b
params(d) Get the parameters, i.e. (a, b)
External links
source
1.79 Distributions.BetaBinomial
Distributions.BetaBinomial — Type.
BetaBinomial(n,,)
n
P (X = k) = B(k + α, n − k + β)/B(α, β), for k = 0, 1, 2, . . . , n.
k
source
20 CHAPTER 1. DISTRIBUTIONS
1.80 Distributions.BetaPrime
Distributions.BetaPrime — Type.
BetaPrime(,)
1
f (x; α, β) = xα−1 (1 + x)−(α+β) , x>0
B(α, β)
The Beta prime distribution is related to the Beta distribution via the rela-
X
tion ship that if X ∼ Beta(α, β) then 1−X ∼ BetaPrime(α, β)
[] BetaPrime() equivalent to BetaPrime(1, 1) BetaPrime(a) equivalent to
BetaPrime(a, a) BetaPrime(a, b) Beta prime distribution with shape parame-
ters a and b
params(d) Get the parameters, i.e. (a, b)
External links
source
1.81 Distributions.Binomial
Distributions.Binomial — Type.
Binomial(n,p)
source
1.82. DISTRIBUTIONS.BIWEIGHT 21
1.82 Distributions.Biweight
Distributions.Biweight — Type.
Biweight(, )
source
1.83 Distributions.Categorical
Distributions.Categorical — Type.
Categorical(p)
A Categorical distribution is parameterized by a probability vector p (of
length K).
P (X = k) = p[k] for k = 1, 2, . . . , K.
[] Categorical(p) Categorical distribution with probability vector p params(d)
Get the parameters, i.e. (p,) probs(d) Get the probability vector, i.e. p ncate-
gories(d) Get the number of categories, i.e. K
Here, p must be a real vector, of which all components are nonnegative
and sum to one. Note: The input vector p is directly used as a field of the
constructed distribution, without being copied. External links:
• Categorical distribution on Wikipedia
source
1.84 Distributions.Cauchy
Distributions.Cauchy — Type.
Cauchy(, )
The Cauchy distribution with location and scale has probability density
function
1
f (x; µ, σ) =
x−µ 2
πσ 1 + σ
1.85 Distributions.Chi
Distributions.Chi — Type.
Chi()
1 2
f (x; k) = 21−k/2 xk−1 e−x /2 , x>0
Γ(k/2)
source
1.86 Distributions.Chisq
Distributions.Chisq — Type.
Chisq()
xk/2−1 e−x/2
f (x; k) = , x > 0.
2k/2 Γ(k/2)
source
1.87. DISTRIBUTIONS.COSINE 23
1.87 Distributions.Cosine
Distributions.Cosine — Type.
Cosine(, )
A raised Cosine distribution.
External link:
• Cosine distribution on wikipedia
source
1.88 Distributions.Dirichlet
Distributions.Dirichlet — Type.
Dirichlet
The Dirichlet distribution is often used the conjugate prior for Categorical
or Multinomial distributions. The probability density function of a Dirichlet
distribution with parameter α = (α1 , . . . , αk ) is:
k Qk
1 Y αi −1 Γ(αi )
f (x; α) = x , with B(α) = i=1 , x1 + · · · + xk = 1
B(α) i=1 i Γ
Pk
α
i=1 i
1.89 Distributions.DiscreteUniform
Distributions.DiscreteUniform — Type.
DiscreteUniform(a,b)
A Discrete uniform distribution is a uniform distribution over a consecutive
sequence of integers between a and b, inclusive.
P (X = k) = 1/(b − a + 1) for k = a, a + 1, . . . , b.
[] DiscreteUniform(a, b) a uniform distribution over {a, a+1, ..., b}
params(d) Get the parameters, i.e. (a, b) span(d) Get the span of the
support, i.e. (b - a + 1) probval(d) Get the probability value, i.e. 1 / (b - a +
1) minimum(d) Return a maximum(d) Return b
External links
24 CHAPTER 1. DISTRIBUTIONS
1.90 Distributions.Epanechnikov
Distributions.Epanechnikov — Type.
Epanechnikov(, )
source
1.91 Distributions.Erlang
Distributions.Erlang — Type.
Erlang(,)
The Erlang distribution is a special case of a Gamma distribution with integer
shape parameter.
[] Erlang() Erlang distribution with unit shape and unit scale, i.e. Erlang(1,
1) Erlang(a) Erlang distribution with shape parameter a and unit scale, i.e.
Erlang(a, 1) Erlang(a, s) Erlang distribution with shape parameter a and scale
b
External links
• Erlang distribution on Wikipedia
source
1.92 Distributions.Exponential
Distributions.Exponential — Type.
Exponential()
The Exponential distribution with scale parameter has probability density
function
1 −x
f (x; θ) = e θ, x > 0
θ
[] Exponential() Exponential distribution with unit scale, i.e. Exponen-
tial(1) Exponential(b) Exponential distribution with scale b
params(d) Get the parameters, i.e. (b,) scale(d) Get the scale parameter,
i.e. b rate(d) Get the rate parameter, i.e. 1 / b
External links
• Exponential distribution on Wikipedia
source
1.93. DISTRIBUTIONS.FDIST 25
1.93 Distributions.FDist
Distributions.FDist — Type.
FDist(1, 2)
• F distribution on Wikipedia
source
1.94 Distributions.Frechet
Distributions.Frechet — Type.
Frechet(,)
The Frchet distribution with shape and scale has probability density func-
tion
α x −α−1 −(x/θ)−α
f (x; α, θ) = e , x>0
θ θ
[] Frechet() Frchet distribution with unit shape and unit scale, i.e. Frechet(1,
1) Frechet(a) Frchet distribution with shape a and unit scale, i.e. Frechet(a, 1)
Frechet(a, b) Frchet distribution with shape a and scale b
params(d) Get the parameters, i.e. (a, b) shape(d) Get the shape param-
eter, i.e. a scale(d) Get the scale parameter, i.e. b
External links
source
26 CHAPTER 1. DISTRIBUTIONS
1.95 Distributions.Gamma
Distributions.Gamma — Type.
Gamma(,)
The Gamma distribution with shape parameter and scale has probability
density function
xα−1 e−x/θ
f (x; α, θ) = , x>0
Γ(α)θα
[] Gamma() Gamma distribution with unit shape and unit scale, i.e. Gamma(1,
1) Gamma() Gamma distribution with shape and unit scale, i.e. Gamma(, 1)
Gamma(, ) Gamma distribution with shape and scale
params(d) Get the parameters, i.e. (, ) shape(d) Get the shape parameter,
i.e. scale(d) Get the scale parameter, i.e.
External links
source
1.96 Distributions.GeneralizedExtremeValue
Distributions.GeneralizedExtremeValue — Type.
GeneralizedExtremeValue(, , )
The Generalized extreme value distribution with shape parameter , scale and
location has probability density function
−1/ξ−1 −1/ξ o
( n
x−µ
1
exp − 1 + x−µ
σ 1+ σ ξ σ ξ for ξ 6= 0
f (x; ξ, σ, µ) = x−µ
x−µ
1
σ exp − σ exp − exp − σ for ξ = 0
for
h
σ
µ − ξ , +∞ for ξ > 0
x ∈ (−∞, +∞)
i for ξ = 0
−∞, µ − σ
for ξ < 0
ξ
1.97 Distributions.GeneralizedPareto
Distributions.GeneralizedPareto — Type.
GeneralizedPareto(, , )
The Generalized Pareto distribution with shape parameter , scale and loca-
tion has probability density function
x−µ − ξ1 −1
( (
1
σ (1 + ξ σ ) for ξ 6= 0 [µ, ∞] for ξ ≥ 0
f (x; µ, σ, ξ) = 1 − (x−µ)
, x∈
σe
σ for ξ = 0 [µ, µ − σ/ξ] for ξ < 0
[] GeneralizedPareto() Generalized Pareto distribution with unit shape and
unit scale, i.e. GeneralizedPareto(0, 1, 1) GeneralizedPareto(k, s) Generalized
Pareto distribution with shape k and scale s, i.e. GeneralizedPareto(0, k, s)
GeneralizedPareto(m, k, s) Generalized Pareto distribution with shape k, scale
s and location m.
params(d) Get the parameters, i.e. (m, s, k) location(d) Get the location
parameter, i.e. m scale(d) Get the scale parameter, i.e. s shape(d) Get the
shape parameter, i.e. k
External links
• Generalized Pareto distribution on Wikipedia
source
1.98 Distributions.Geometric
Distributions.Geometric — Type.
Geometric(p)
A Geometric distribution characterizes the number of failures before the first
success in a sequence of independent Bernoulli trials with success rate p.
1.99 Distributions.Gumbel
Distributions.Gumbel — Type.
Gumbel(, )
The Gumbel distribution with location and scale has probability density
function
1 −(z+ez ) x−µ
f (x; µ, θ) = e , with z =
θ θ
[] Gumbel() Gumbel distribution with zero location and unit scale, i.e.
Gumbel(0, 1) Gumbel(u) Gumbel distribution with location u and unit scale,
i.e. Gumbel(u, 1) Gumbel(u, b) Gumbel distribution with location u and scale
b
params(d) Get the parameters, i.e. (u, b) location(d) Get the location
parameter, i.e. u scale(d) Get the scale parameter, i.e. b
External links
source
1.100 Distributions.Hypergeometric
Distributions.Hypergeometric — Type.
Hypergeometric(s, f, n)
s f
k n−k
P (X = k) = s+f
, for k = max(0, n − f ), . . . , min(n, s).
n
source
1.101. DISTRIBUTIONS.INVERSEGAMMA 29
1.101 Distributions.InverseGamma
Distributions.InverseGamma — Type.
InverseGamma(, )
The inverse gamma distribution with shape parameter and scale has prob-
ability density function
θα x−(α+1) − θ
f (x; α, θ) = e x, x>0
Γ(α)
It is related to the Gamma distribution: if X ∼ Gamma(α, β), then ‘1 / X
∼ InverseGamma(α, βˆ{−1})“.
[] InverseGamma() Inverse Gamma distribution with unit shape and unit
scale, i.e. InverseGamma(1, 1) InverseGamma(a) Inverse Gamma distribution
with shape a and unit scale, i.e. InverseGamma(a, 1) InverseGamma(a, b)
Inverse Gamma distribution with shape a and scale b
params(d) Get the parameters, i.e. (a, b) shape(d) Get the shape param-
eter, i.e. a scale(d) Get the scale parameter, i.e. b
External links
• Inverse gamma distribution on Wikipedia
source
1.102 Distributions.InverseGaussian
Distributions.InverseGaussian — Type.
InverseGaussian(,)
The inverse Gaussian distribution with mean and shape has probability
density function
r
−λ(x − µ)2
λ
f (x; µ, λ) = exp , x>0
2πx3 2µ2 x
[] InverseGaussian() Inverse Gaussian distribution with unit mean and unit
shape, i.e. InverseGaussian(1, 1) InverseGaussian(mu), Inverse Gaussian distri-
bution with mean mu and unit shape, i.e. InverseGaussian(u, 1) InverseGaus-
sian(mu, lambda) Inverse Gaussian distribution with mean mu and shape
lambda
params(d) Get the parameters, i.e. (mu, lambda) mean(d) Get the mean
parameter, i.e. mu shape(d) Get the shape parameter, i.e. lambda
External links
• Inverse Gaussian distribution on Wikipedia
source
30 CHAPTER 1. DISTRIBUTIONS
1.103 Distributions.InverseWishart
Distributions.InverseWishart — Type.
InverseWishart(nu, P)
The [Inverse Wishart distribution](http://en.wikipedia.org/wiki/Inverse-Wishart distribution
is usually used a the conjugate prior for the covariance matrix of a multivariate
normal distribution, which is characterized by a degree of freedom , and a base
matrix .
source
1.104 Distributions.KSDist
Distributions.KSDist — Type.
KSDist(n)
Distribution of the (two-sided) Kolmogorov-Smirnoff statistic
p
Dn = sup |F̂n (x) − F (x)| (n)
x
Dn converges a.s. to the Kolmogorov distribution.
source
1.105 Distributions.KSOneSided
Distributions.KSOneSided — Type.
KSOneSided(n)
Distribution of the one-sided Kolmogorov-Smirnov test statistic:
1.106 Distributions.Kolmogorov
Distributions.Kolmogorov — Type.
Kolmogorov()
Kolmogorov distribution defined as
sup |B(t)|
t∈[0,1]
1.107 Distributions.Laplace
Distributions.Laplace — Type.
Laplace(,)
The Laplace distribution with location and scale has probability density
function
1 |x − µ|
f (x; µ, β) = exp −
2β β
[] Laplace() Laplace distribution with zero location and unit scale, i.e.
Laplace(0, 1) Laplace(u) Laplace distribution with location u and unit scale,
i.e. Laplace(u, 1) Laplace(u, b) Laplace distribution with location u ans scale
b
params(d) Get the parameters, i.e. (u, b) location(d) Get the location
parameter, i.e. u scale(d) Get the scale parameter, i.e. b
External links
source
1.108 Distributions.Levy
Distributions.Levy — Type.
Levy(, )
The Lvy distribution with location and scale has probability density func-
tion
r
σ σ
f (x; µ, σ) = exp − , x>µ
2π(x − µ)3 2(x − µ)
[] Levy() Levy distribution with zero location and unit scale, i.e. Levy(0,
1) Levy(u) Levy distribution with location u and unit scale, i.e. Levy(u, 1)
Levy(u, c) Levy distribution with location u ans scale c
params(d) Get the parameters, i.e. (u, c) location(d) Get the location
parameter, i.e. u
External links
source
32 CHAPTER 1. DISTRIBUTIONS
1.109 Distributions.LocationScale
Distributions.LocationScale — Type.
LocationScale(,,)
1.110 Distributions.LogNormal
Distributions.LogNormal — Type.
LogNormal(,)
(log(x) − µ)2
1
f (x; µ, σ) = √ exp − , x>0
x 2πσ 2 2σ 2
External links
source
1.111. DISTRIBUTIONS.LOGISTIC 33
1.111 Distributions.Logistic
Distributions.Logistic — Type.
Logistic(,)
The Logistic distribution with location and scale has probability density
function
1 2 x−µ
f (x; µ, θ) = sech
4θ 2θ
[] Logistic() Logistic distribution with zero location and unit scale, i.e.
Logistic(0, 1) Logistic(u) Logistic distribution with location u and unit scale,
i.e. Logistic(u, 1) Logistic(u, b) Logistic distribution with location u ans scale
b
params(d) Get the parameters, i.e. (u, b) location(d) Get the location
parameter, i.e. u scale(d) Get the scale parameter, i.e. b
External links
source
1.112 Distributions.MixtureModel
Distributions.MixtureModel — Method.
MixtureModel(components, [prior])
1.113 Distributions.MixtureModel
Distributions.MixtureModel — Method.
1.114 Distributions.Multinomial
Distributions.Multinomial — Type.
The Multinomial distribution generalizes the binomial distribution. Consider
n independent draws from a Categorical distribution over a finite set of size k,
and let X = (X1 , ..., Xk ) where Xi represents the number of times the element
i occurs, then the distribution of X is a multinomial distribution. Each sample
of a multinomial distribution is a k-dimensional integer vector that sums to n.
The probability mass function is given by
k
n! Y
f (x; n, p) = pxi , x1 + · · · + xk = n
x1 ! · · · xk ! i=1 i
[] Multinomial(n, p) Multinomial distribution for n trials with probability
vector p Multinomial(n, k) Multinomial distribution for n trials with equal
probabilities over 1:k
source
1.115 Distributions.MvLogNormal
Distributions.MvLogNormal — Type.
MvLogNormal(d::MvNormal)
1.116 Distributions.MvNormal
Distributions.MvNormal — Type.
MvNormal
Generally, users don’t have to worry about these internal details. We pro-
vide a common constructor MvNormal, which will construct a distribution of
appropriate type depending on the input arguments.
MvNormal(sig)
MvNormal(mu, sig)
MvNormal(d, sig)
1. subtype of AbstractPDMat
2. symmetric matrix of type Matrix{T}
3. vector of type Vector{T}: indicating a diagonal covariance as diagm(abs2(sig)).
4. real-valued number: indicating an isotropic covariance as abs2(sig)
* eye(d).
1.117 Distributions.MvNormalCanon
Distributions.MvNormalCanon — Type.
MvNormalCanon
MvNormalCanon(h, J)
MvNormalCanon(J)
Construct a multivariate normal distribution with zero mean (thus zero po-
tential vector) and precision matrix represented by J.
MvNormalCanon(d, J)
1.118 Distributions.NegativeBinomial
Distributions.NegativeBinomial — Type.
NegativeBinomial(r,p)
Γ(k + r) r
P (X = k) = p (1 − p)k , for k = 0, 1, 2, . . . .
k!Γ(r)
[] NegativeBinomial() Negative binomial distribution with r = 1 and p =
0.5 NegativeBinomial(r, p) Negative binomial distribution with r successes and
success rate p
params(d) Get the parameters, i.e. (r, p) succprob(d) Get the success rate,
i.e. p failprob(d) Get the failure rate, i.e. 1 - p
External links:
source
1.119 Distributions.NoncentralBeta
Distributions.NoncentralBeta — Type.
NoncentralBeta(, , )
source
1.120 Distributions.NoncentralChisq
Distributions.NoncentralChisq — Type.
NoncentralChisq(, )
1 −(x+λ)/2 x ν/4−1/2 √
f (x; ν, λ) = e Iν/2−1 ( λx), x>0
2 λ
38 CHAPTER 1. DISTRIBUTIONS
1.121 Distributions.NoncentralF
Distributions.NoncentralF — Type.
NoncentralF(1, 2, )
source
1.122 Distributions.NoncentralT
Distributions.NoncentralT — Type.
NoncentralT(, )
source
1.123 Distributions.Normal
Distributions.Normal — Type.
Normal(,)
The Normal distribution with mean and standard deviation has probability
density function
(x − µ)2
1
f (x; µ, σ) = √ exp −
2πσ 2 2σ 2
[] Normal() standard Normal distribution with zero mean and unit variance
Normal(mu) Normal distribution with mean mu and unit variance Normal(mu,
sig) Normal distribution with mean mu and variance sig2
params(d) Get the parameters, i.e. (mu, sig) mean(d) Get the mean, i.e.
mu std(d) Get the standard deviation, i.e. sig
External links
1.124. DISTRIBUTIONS.NORMALCANON 39
1.124 Distributions.NormalCanon
Distributions.NormalCanon — Type.
NormalCanon(, )
Canonical Form of Normal distribution
source
1.125 Distributions.NormalInverseGaussian
Distributions.NormalInverseGaussian — Type.
NormalInverseGaussian(,,,)
The Normal-inverse Gaussian distribution with location , tail heaviness ,
asymmetry parameter and scale has probability density function
p
αδK1 α δ 2 + (x − µ)2
f (x; µ, α, β, δ) = p eδγ+β(x−µ)
π δ 2 + (x − µ)2
where Kj denotes a modified Bessel function of the third kind.
External links
• Normal-inverse Gaussian distribution on Wikipedia
source
1.126 Distributions.Pareto
Distributions.Pareto — Type.
Pareto(,)
The Pareto distribution with shape and scale has probability density func-
tion
αθα
f (x; α, θ) = , x≥θ
xα+1
[] Pareto() Pareto distribution with unit shape and unit scale, i.e. Pareto(1,
1) Pareto(a) Pareto distribution with shape a and unit scale, i.e. Pareto(a, 1)
Pareto(a, b) Pareto distribution with shape a and scale b
params(d) Get the parameters, i.e. (a, b) shape(d) Get the shape param-
eter, i.e. a scale(d) Get the scale parameter, i.e. b
External links
40 CHAPTER 1. DISTRIBUTIONS
1.127 Distributions.Poisson
Distributions.Poisson — Type.
Poisson()
A Poisson distribution descibes the number of independent events occurring
within a unit time interval, given the average rate of occurrence .
λk −λ
P (X = k) = e , for k = 0, 1, 2, . . . .
k!
[] Poisson() Poisson distribution with rate parameter 1 Poisson(lambda)
Poisson distribution with rate parameter lambda
params(d) Get the parameters, i.e. (,) mean(d) Get the mean arrival rate,
i.e.
External links:
• Poisson distribution on Wikipedia
source
1.128 Distributions.PoissonBinomial
Distributions.PoissonBinomial — Type.
PoissonBinomial(p)
A Poisson-binomial distribution describes the number of successes in a se-
quence of independent trials, wherein each trial has a different success rate. It
is parameterized by a vector p (of length K), where K is the total number of
trials and p[i] corresponds to the probability of success of the ith trial.
X Y Y
P (X = k) = p[i] (1 − p[j]), for k = 0, 1, 2, . . . , K,
A∈Fk i∈A j∈Ac
where Fk is the set of all subsets of k integers that can be selected from
{1, 2, 3, ..., K}.
[] PoissonBinomial(p) Poisson Binomial distribution with success rate vector
p
params(d) Get the parameters, i.e. (p,) succprob(d) Get the vector of
success rates, i.e. p failprob(d) Get the vector of failure rates, i.e. 1-p
External links:
• Poisson-binomial distribution on Wikipedia
source
1.129. DISTRIBUTIONS.RAYLEIGH 41
1.129 Distributions.Rayleigh
Distributions.Rayleigh — Type.
Rayleigh()
x − x22
f (x; σ) = e 2σ , x>0
σ2
It is related to the Normal distribution
√ via the property that if X, Y ∼
Normal(0, σ), independently, then X 2 + Y 2 ∼ Rayleigh(σ).
[] Rayleigh() Rayleigh distribution with unit scale, i.e. Rayleigh(1) Rayleigh(s)
Rayleigh distribution with scale s
params(d) Get the parameters, i.e. (s,) scale(d) Get the scale parameter,
i.e. s
External links
source
1.130 Distributions.Semicircle
Distributions.Semicircle — Type.
Semicircle(r)
2 p 2
f (x; r) = r − x2 , x ∈ [−r, r].
πr2
[] Semicircle(r) Wigner semicircle distribution with radius r
params(d) Get the radius parameter, i.e. (r,)
External links
source
42 CHAPTER 1. DISTRIBUTIONS
1.131 Distributions.Skellam
Distributions.Skellam — Type.
Skellam(1, 2)
source
1.132 Distributions.SymTriangularDist
Distributions.SymTriangularDist — Type.
SymTriangularDist(,)
The Symmetric triangular distribution with location and scale has proba-
bility density function
1 x − µ
f (x; µ, σ) = 1−
, µ−σ ≤x≤µ+σ
σ σ
[] SymTriangularDist() Symmetric triangular distribution with zero loca-
tion and unit scale SymTriangularDist(u) Symmetric triangular distribution
with location u and unit scale SymTriangularDist(u, s) Symmetric triangular
distribution with location u and scale s
params(d) Get the parameters, i.e. (u, s) location(d) Get the location
parameter, i.e. u scale(d) Get the scale parameter, i.e. s
source
1.133 Distributions.TDist
Distributions.TDist — Type.
TDist()
1.134. DISTRIBUTIONS.TRIANGULARDIST 43
f (x; d) = √ 1+
dB(1/2, d/2) d
[] TDist(d) t-distribution with d degrees of freedom
params(d) Get the parameters, i.e. (d,) dof(d) Get the degrees of freedom,
i.e. d
External links
Student’s T distribution on Wikipedia
source
1.134 Distributions.TriangularDist
Distributions.TriangularDist — Type.
TriangularDist(a,b,c)
The triangular distribution with lower limit a, upper limit b and mode c has
probability density function
0 for x < a,
2(x−a)
for a ≤ x ≤ c,
(b−a)(c−a)
f (x; a, b, c) = 2(b−x)
(b−a)(b−c) for c < x ≤ b,
0 for b < x,
[] TriangularDist(a, b) Triangular distribution with lower limit a, upper
limit b, and mode (a+b)/2 TriangularDist(a, b, c) Triangular distribution with
lower limit a, upper limit b, and mode c
params(d) Get the parameters, i.e. (a, b, c) minimum(d) Get the lower
bound, i.e. a maximum(d) Get the upper bound, i.e. b mode(d) Get the mode,
i.e. c
External links
source
1.135 Distributions.Triweight
Distributions.Triweight — Type.
Triweight(, )
source
44 CHAPTER 1. DISTRIBUTIONS
1.136 Distributions.Truncated
Distributions.Truncated — Type.
Truncated(d, l, u):
• l::Real: The lower bound of the truncation, which can be a finite value
or -Inf.
• u::Real: The upper bound of the truncation, which can be a finite value
of Inf.
source
1.137 Distributions.Uniform
Distributions.Uniform — Type.
Uniform(a,b)
1
f (x; a, b) = , a≤x≤b
b−a
[] Uniform() Uniform distribution over [0, 1] Uniform(a, b) Uniform distri-
bution over [a, b]
params(d) Get the parameters, i.e. (a, b) minimum(d) Get the lower
bound, i.e. a maximum(d) Get the upper bound, i.e. b location(d) Get the
location parameter, i.e. a scale(d) Get the scale parameter, i.e. b - a
External links
source
1.138 Distributions.VonMises
Distributions.VonMises — Type.
VonMises(, )
1.139. DISTRIBUTIONS.WEIBULL 45
The von Mises distribution with mean and concentration has probability
density function
1
f (x; µ, κ) = exp (κ cos(x − µ))
2πI0 (κ)
[] VonMises() von Mises distribution with zero mean and unit concentration
VonMises() von Mises distribution with zero mean and concentration Von-
Mises(, ) von Mises distribution with mean and concentration
External links
source
1.139 Distributions.Weibull
Distributions.Weibull — Type.
Weibull(,)
The Weibull distribution with shape and scale has probability density
function
α x α−1 −(x/θ)α
f (x; α, θ) = e , x≥0
θ θ
[] Weibull() Weibull distribution with unit shape and unit scale, i.e. Weibull(1,
1) Weibull(a) Weibull distribution with shape a and unit scale, i.e. Weibull(a,
1) Weibull(a, b) Weibull distribution with shape a and scale b
params(d) Get the parameters, i.e. (a, b) shape(d) Get the shape param-
eter, i.e. a scale(d) Get the scale parameter, i.e. b
External links
source
1.140 Distributions.Wishart
Distributions.Wishart — Type.
Wishart(nu, S)
StatsBase
2.1 Base.stdm
Base.stdm — Method.
where n is the length of the input. The unbiased estimate (when corrected=true)
of the population standard deviation is computed by replacing P1w with a factor
dependent on the type of weights used:
• AnalyticWeights: P P1 2 P
w− w / w
• FrequencyWeights: P1
w−1
nP
• ProbabilityWeights: (n−1) w where n equals count(!iszero, w)
source
46
2.2. BASE.VARM 47
2.2 Base.varm
Base.varm — Method.
where n is the length of the input. The unbiased estimate (when corrected=true)
of the population variance is computed by replacing P1w with a factor dependent
on the type of weights used:
• AnalyticWeights: P P1 2 P
w− w / w
• FrequencyWeights: P1
w−1
nP
• ProbabilityWeights: (n−1) w where n equals count(!iszero, w)
source
2.3 StatsBase.L1dist
StatsBase.L1dist — Method.
L1dist(a, b)
Pn
Compute the L1 distance between two arrays: i=1 |ai −bi |. Efficient equiv-
alent of sum(abs, a - b).
source
2.4 StatsBase.L2dist
StatsBase.L2dist — Method.
L2dist(a, b)
pPn
Compute the L2 distance between two arrays: i=1 |ai − bi |2 . Efficient
equivalent of sqrt(sumabs2(a - b)).
source
48 CHAPTER 2. STATSBASE
2.5 StatsBase.Linfdist
StatsBase.Linfdist — Method.
Linfdist(a, b)
Compute the L distance, also called the Chebyshev distance, between two
arrays: maxi∈1:n |ai − bi |. Efficient equivalent of maxabs(a - b).
source
2.6 StatsBase.addcounts!
StatsBase.addcounts! — Method.
2.7 StatsBase.addcounts!
StatsBase.addcounts! — Method.
Add counts based on x to a count map. New entries will be added if new
values come up. If a weighting vector wv is specified, the sum of the weights is
used rather than the raw counts.
alg can be one of:
• :dict: use Dict-based method which is generally slower but uses less
RAM and is safe for any data type.
source
2.8. STATSBASE.ADJR2 49
2.8 StatsBase.adjr2
StatsBase.adjr2 — Method.
adjr2(obj::StatisticalModel, variant::Symbol)
adjr(obj::StatisticalModel, variant::Symbol)
2.9 StatsBase.adjr2
StatsBase.adjr2 — Method.
adjr2(obj::StatisticalModel)
adjr(obj::StatisticalModel)
2.10 StatsBase.aic
StatsBase.aic — Method.
aic(obj::StatisticalModel)
2.11 StatsBase.aicc
StatsBase.aicc — Method.
aicc(obj::StatisticalModel)
Corrected Akaike’s Information Criterion for small sample sizes (Hurvich and
Tsai 1989), defined as −2 log L+2k +2k(k −1)/(n−k −1), with L the likelihood
of the model, k its number of consumed degrees of freedom (as returned by dof),
and n the number of observations (as returned by nobs).
source
2.12 StatsBase.autocor!
StatsBase.autocor! — Method.
2.13 StatsBase.autocor
StatsBase.autocor — Method.
2.14 StatsBase.autocov!
StatsBase.autocov! — Method.
2.15 StatsBase.autocov
StatsBase.autocov — Method.
2.16 StatsBase.aweights
StatsBase.aweights — Method.
aweights(vs)
2.17 StatsBase.bic
StatsBase.bic — Method.
bic(obj::StatisticalModel)
Bayesian Information Criterion, defined as −2 log L+k log n, with L the like-
lihood of the model, k its number of consumed degrees of freedom (as returned
by dof), and n the number of observations (as returned by nobs).
source
2.18 StatsBase.coef
StatsBase.coef — Method.
coef(obj::StatisticalModel)
2.19 StatsBase.coefnames
StatsBase.coefnames — Method.
coefnames(obj::StatisticalModel)
2.20 StatsBase.coeftable
StatsBase.coeftable — Method.
coeftable(obj::StatisticalModel)
2.21 StatsBase.competerank
StatsBase.competerank — Method.
2.22 StatsBase.confint
StatsBase.confint — Method.
confint(obj::StatisticalModel)
2.23 StatsBase.cor2cov
StatsBase.cor2cov — Method.
cor2cov(C, s)
Compute the covariance matrix from the correlation matrix C and a vector
of standard deviations s. Use StatsBase.cor2cov! for an in-place version.
source
2.24 StatsBase.corkendall
StatsBase.corkendall — Method.
corkendall(x, y=x)
2.25 StatsBase.corspearman
StatsBase.corspearman — Method.
corspearman(x, y=x)
2.26 StatsBase.counteq
StatsBase.counteq — Method.
counteq(a, b)
Count the number of indices at which the elements of the arrays a and b are
equal.
source
2.27 StatsBase.countmap
StatsBase.countmap — Method.
• :dict: use Dict-based method which is generally slower but uses less
RAM and is safe for any data type.
source
2.28 StatsBase.countne
StatsBase.countne — Method.
countne(a, b)
Count the number of indices at which the elements of the arrays a and b are
not equal.
source
2.29. STATSBASE.COUNTS 55
2.29 StatsBase.counts
StatsBase.counts — Function.
counts(x, [wv::AbstractWeights])
counts(x, levels::UnitRange{<:Integer}, [wv::AbstractWeights])
counts(x, k::Integer, [wv::AbstractWeights])
2.30 StatsBase.cov2cor
StatsBase.cov2cor — Method.
cov2cor(C, s)
Compute the correlation matrix from the covariance matrix C and a vector
of standard deviations s. Use StatsBase.cov2cor! for an in-place version.
source
2.31 StatsBase.crosscor!
StatsBase.crosscor! — Method.
2.32 StatsBase.crosscor
StatsBase.crosscor — Method.
2.33 StatsBase.crosscov!
StatsBase.crosscov! — Method.
2.34 StatsBase.crosscov
StatsBase.crosscov — Method.
2.35 StatsBase.crossentropy
StatsBase.crossentropy — Method.
crossentropy(p, q, [b])
2.36 StatsBase.denserank
StatsBase.denserank — Method.
denserank(x)
2.37 StatsBase.describe
StatsBase.describe — Method.
describe(a)
2.38 StatsBase.deviance
StatsBase.deviance — Method.
deviance(obj::StatisticalModel)
2.39 StatsBase.dof
StatsBase.dof — Method.
dof(obj::StatisticalModel)
dof_residual(obj::RegressionModel)
2.41 StatsBase.ecdf
StatsBase.ecdf — Method.
ecdf(X)
2.42 StatsBase.entropy
StatsBase.entropy — Method.
entropy(p, [b])
2.43 StatsBase.findat
StatsBase.findat — Method.
findat(a, b)
For each element in b, find its first index in a. If the value does not occur
in a, the corresponding index is 0.
source
2.44 StatsBase.fit!
StatsBase.fit! — Method.
Fit a statistical model in-place.
source
2.45 StatsBase.fit
StatsBase.fit — Method.
Fit a statistical model.
source
2.46 StatsBase.fit
StatsBase.fit — Method.
Keyword arguments
Examples
[] Univariate h = fit(Histogram, rand(100)) h = fit(Histogram, rand(100),
0:0.1:1.0) h = fit(Histogram, rand(100), nbins=10) h = fit(Histogram, rand(100),
weights(rand(100)), 0:0.1:1.0) h = fit(Histogram, [20], 0:20:100) h = fit(Histogram,
[20], 0:20:100, closed=:left)
Multivariate h = fit(Histogram, (rand(100),rand(100))) h = fit(Histogram,
(rand(100),rand(100)),nbins=10)
source
2.47 StatsBase.fitted
StatsBase.fitted — Method.
fitted(obj::RegressionModel)
2.48 StatsBase.fweights
StatsBase.fweights — Method.
fweights(vs)
2.49 StatsBase.genmean
StatsBase.genmean — Method.
genmean(a, p)
Return the generalized/power mean with exponent p of a real-valued array,
Pn 1
i.e. n1 i=1 api p , where n = length(a). It is taken to be the geometric mean
when p == 0.
source
2.50 StatsBase.geomean
StatsBase.geomean — Method.
geomean(a)
Return the geometric mean of a real-valued array.
source
2.51 StatsBase.gkldiv
StatsBase.gkldiv — Method.
gkldiv(a, b)
2.52 StatsBase.harmmean
StatsBase.harmmean — Method.
harmmean(a)
Return the harmonic mean of a real-valued array.
source
2.53 StatsBase.indexmap
StatsBase.indexmap — Method.
indexmap(a)
Construct a dictionary that maps each unique value in a to the index of its
first occurrence in a.
source
62 CHAPTER 2. STATSBASE
2.54 StatsBase.indicatormat
StatsBase.indicatormat — Method.
2.55 StatsBase.indicatormat
StatsBase.indicatormat — Method.
source
2.56 StatsBase.informationmatrix
StatsBase.informationmatrix — Method.
inverse_rle(vals, lens)
Reconstruct a vector from its run-length encoding (see rle). vals is a vector
of the values and lens is a vector of the corresponding run lengths.
source
2.58 StatsBase.iqr
StatsBase.iqr — Method.
iqr(v)
Compute the interquartile range (IQR) of an array, i.e. the 75th percentile
minus the 25th percentile.
source
2.59 StatsBase.isfitted
StatsBase.isfitted — Method.
isfitted(obj::StatisticalModel)
2.60 StatsBase.islinear
StatsBase.islinear — Method.
islinear(obj::StatisticalModel)
2.61 StatsBase.kldivergence
StatsBase.kldivergence — Method.
kldivergence(p, q, [b])
2.62 StatsBase.kurtosis
StatsBase.kurtosis — Method.
2.63 StatsBase.levelsmap
StatsBase.levelsmap — Method.
levelsmap(a)
2.64 StatsBase.leverage
StatsBase.leverage — Method.
leverage(obj::RegressionModel)
2.65 StatsBase.loglikelihood
StatsBase.loglikelihood — Method.
loglikelihood(obj::StatisticalModel)
2.66 StatsBase.mad!
StatsBase.mad! — Method.
2.67 StatsBase.mad
StatsBase.mad — Method.
2.68 StatsBase.maxad
StatsBase.maxad — Method.
maxad(a, b)
2.72 StatsBase.meanad
StatsBase.meanad — Method.
meanad(a, b)
2.73 StatsBase.meanresponse
StatsBase.meanresponse — Method.
meanresponse(obj::RegressionModel)
2.74 StatsBase.mode
StatsBase.mode — Method.
mode(a, [r])
Return the mode (most common number) of an array, optionally over a
specified range r. If several modes exist, the first one (in order of appearance)
is returned.
source
2.75 StatsBase.modelmatrix
StatsBase.modelmatrix — Method.
modelmatrix(obj::RegressionModel)
Return the model matrix (a.k.a. the design matrix).
source
2.76 StatsBase.modes
StatsBase.modes — Method.
modes(a, [r])::Vector
Return all modes (most common numbers) of an array, optionally over a
specified range r.
source
2.77 StatsBase.moment
StatsBase.moment — Method.
moment(v, k, [wv::AbstractWeights], m=mean(v))
Return the kth order central moment of a real-valued array v, optionally
specifying a weighting vector wv and a center m.
source
2.78 StatsBase.msd
StatsBase.msd — Method.
msd(a, b)
Return the mean squared deviation between two arrays: mean(abs2(a -
b)).
source
68 CHAPTER 2. STATSBASE
2.79 StatsBase.mss
StatsBase.mss — Method.
mss(obj::StatisticalModel)
2.80 StatsBase.nobs
StatsBase.nobs — Method.
nobs(obj::StatisticalModel)
Return the number of independent observations on which the model was fit-
ted. Be careful when using this information, as the definition of an independent
observation may vary depending on the model, on the format used to pass the
data, on the sampling plan (if specified), etc.
source
2.81 StatsBase.nquantile
StatsBase.nquantile — Method.
nquantile(v, n)
Return the n-quantiles of a real-valued array, i.e. the values which partition
v into n subsets of nearly equal size.
Equivalent to quantile(v, [0:n]/n). For example, nquantiles(x, 5) re-
turns a vector of quantiles, respectively at [0.0, 0.2, 0.4, 0.6, 0.8, 1.0].
source
2.82 StatsBase.nulldeviance
StatsBase.nulldeviance — Method.
nulldeviance(obj::StatisticalModel)
Return the deviance of the null model, that is the one including only the
intercept.
source
2.83. STATSBASE.NULLLOGLIKELIHOOD 69
2.83 StatsBase.nullloglikelihood
StatsBase.nullloglikelihood — Method.
loglikelihood(obj::StatisticalModel)
Return the log-likelihood of the null model corresponding to model obj. This
is usually the model containing only the intercept.
source
2.84 StatsBase.ordinalrank
StatsBase.ordinalrank — Method.
2.85 StatsBase.pacf !
StatsBase.pacf! — Method.
2.86 StatsBase.pacf
StatsBase.pacf — Method.
2.87 StatsBase.percentile
StatsBase.percentile — Method.
percentile(v, p)
2.88 StatsBase.predict
StatsBase.predict — Function.
predict(obj::RegressionModel, [newX])
Form the predicted response of model obj. An object with new covariate
values newX can be supplied, which should have the same type and structure as
that used to fit obj; e.g. for a GLM it would generally be a DataFrame with the
same variable names as the original predictors.
source
2.89 StatsBase.predict!
StatsBase.predict! — Function.
predict!
2.90 StatsBase.proportionmap
StatsBase.proportionmap — Method.
proportionmap(x)
Return a dictionary mapping each unique value in x to its proportion in x.
source
2.91 StatsBase.proportions
StatsBase.proportions — Method.
proportions(x, k::Integer, [wv::AbstractWeights])
Return the proportion of integers in 1 to k that occur in x.
source
2.92 StatsBase.proportions
StatsBase.proportions — Method.
proportions(x, levels=span(x), [wv::AbstractWeights])
Return the proportion of values in the range levels that occur in x. Equiva-
lent to counts(x, levels) / length(x). If a weighting vector wv is specified,
the sum of the weights is used rather than the raw counts.
source
2.93 StatsBase.psnr
StatsBase.psnr — Method.
psnr(a, b, maxv)
Compute the peak signal-to-noise ratio between two arrays a and b. maxv is
the maximum possible value either array can take. The PSNR is computed as
10 * log10(maxv^2 / msd(a, b)).
source
2.94 StatsBase.pweights
StatsBase.pweights — Method.
pweights(vs)
Construct a ProbabilityWeights vector from a given array. See the docu-
mentation for ProbabilityWeights for more details.
source
72 CHAPTER 2. STATSBASE
2.95 StatsBase.r2
StatsBase.r2 — Method.
r2(obj::StatisticalModel, variant::Symbol)
r(obj::StatisticalModel, variant::Symbol)
2.96 StatsBase.r2
StatsBase.r2 — Method.
r2(obj::StatisticalModel)
r(obj::StatisticalModel)
2.97 StatsBase.renyientropy
StatsBase.renyientropy — Method.
renyientropy(p, )
2.98 StatsBase.residuals
StatsBase.residuals — Method.
residuals(obj::RegressionModel)
2.99 StatsBase.response
StatsBase.response — Method.
response(obj::RegressionModel)
2.100 StatsBase.rle
StatsBase.rle — Method.
julia> rle([1,1,1,2,2,3,3,3,3,2,2,2])
([1, 2, 3, 2], [3, 2, 4, 3])
source
2.101 StatsBase.rmsd
StatsBase.rmsd — Method.
rmsd(a, b; normalize=false)
Return the root mean squared deviation between two optionally normalized
arrays. The root mean squared deviation is computed as sqrt(msd(a, b)).
source
74 CHAPTER 2. STATSBASE
2.102 StatsBase.rss
StatsBase.rss — Method.
rss(obj::StatisticalModel)
2.103 StatsBase.sample!
StatsBase.sample! — Method.
Draw a random sample of length(x) elements from an array a and store the
result in x. A polyalgorithm is used for sampling. Sampling probabilities are
proportional to the weights given in wv, if provided. replace dictates whether
sampling is performed with replacement and order dictates whether an ordered
sample, also called a sequential sample, should be taken.
Optionally specify a random number generator rng as the first argument
(defaults to Random.GLOBAL RNG).
source
2.104 StatsBase.sample
StatsBase.sample — Method.
sample([rng], a, [wv::AbstractWeights])
2.105 StatsBase.sample
StatsBase.sample — Method.
sample([rng], wv::AbstractWeights)
2.106 StatsBase.sample
StatsBase.sample — Method.
2.107 StatsBase.sample
StatsBase.sample — Method.
2.108 StatsBase.samplepair
StatsBase.samplepair — Method.
samplepair([rng], a)
2.109 StatsBase.samplepair
StatsBase.samplepair — Method.
samplepair([rng], n)
76 CHAPTER 2. STATSBASE
2.110 StatsBase.scattermat
StatsBase.scattermat — Function.
• vardim=1: the dimension along which the variables are organized. When
vardim = 1, the variables are considered columns with observations in
rows; when vardim = 2, variables are in rows with observations in columns.
source
2.111 StatsBase.score
StatsBase.score — Method.
score(obj::StatisticalModel)
Return the score of the statistical model. The score is the gradient of the
log-likelihood with respect to the coefficients.
source
2.112 StatsBase.sem
StatsBase.sem — Method.
sem(a)
2.113 StatsBase.skewness
StatsBase.skewness — Method.
skewness(v, [wv::AbstractWeights], m=mean(v))
Compute the standardized skewness of a real-valued array v, optionally spec-
ifying a weighting vector wv and a center m.
source
2.114 StatsBase.span
StatsBase.span — Method.
span(x)
Return the span of an integer array, i.e. the range minimum(x):maximum(x).
The minimum and maximum of x are computed in one-pass using extrema.
source
2.115 StatsBase.sqL2dist
StatsBase.sqL2dist — Method.
sqL2dist(a, b)
Pn
Compute the squared L2 distance between two arrays: i=1 |ai − bi |2 . Ef-
ficient equivalent of sumabs2(a - b).
source
2.116 StatsBase.stderror
StatsBase.stderror — Method.
stderror(obj::StatisticalModel)
Return the standard errors for the coefficients of the model.
source
2.117 StatsBase.summarystats
StatsBase.summarystats — Method.
summarystats(a)
Compute summary statistics for a real-valued array a. Returns a SummaryStats
object containing the mean, minimum, 25th percentile, median, 75th percentile,
and maxmimum.
source
78 CHAPTER 2. STATSBASE
2.118 StatsBase.tiedrank
StatsBase.tiedrank — Method.
tiedrank(x)
Return the tied ranking, also called fractional or “1 2.5 2.5 4” ranking, of
an array. The lt keyword allows providing a custom “less than” function; use
rev=true to reverse the sorting order. Items that compare equal receive the
mean of the rankings they would have been assigned under ordinal ranking.
Missing values are assigned rank missing.
source
2.119 StatsBase.trim!
StatsBase.trim! — Method.
2.120 StatsBase.trim
StatsBase.trim — Method.
2.121 StatsBase.trimvar
StatsBase.trimvar — Method.
Compute the variance of the trimmed mean of x. This function uses the
Winsorized variance, as described in Wilcox (2010).
source
2.122. STATSBASE.VARIATION 79
2.122 StatsBase.variation
StatsBase.variation — Method.
variation(x, m=mean(x))
2.123 StatsBase.vcov
StatsBase.vcov — Method.
vcov(obj::StatisticalModel)
2.124 StatsBase.weights
StatsBase.weights — Method.
weights(vs)
Construct a Weights vector from array vs. See the documentation for
Weights for more details.
source
2.125 StatsBase.weights
StatsBase.weights — Method.
weights(obj::StatisticalModel)
2.126 StatsBase.winsor!
StatsBase.winsor! — Method.
2.127 StatsBase.winsor
StatsBase.winsor — Method.
2.128 StatsBase.wmean
StatsBase.wmean — Method.
wmean(v, w::AbstractVector)
2.129 StatsBase.wmedian
StatsBase.wmedian — Method.
wmedian(v, w)
2.130 StatsBase.wquantile
StatsBase.wquantile — Method.
wquantile(v, w, p)
2.131 StatsBase.wsample!
StatsBase.wsample! — Method.
Select a weighted sample from an array a and store the result in x. Sam-
pling probabilities are proportional to the weights given in w. replace dictates
whether sampling is performed with replacement and order dictates whether
an ordered sample, also called a sequential sample, should be taken.
Optionally specify a random number generator rng as the first argument
(defaults to Random.GLOBAL RNG).
source
2.132 StatsBase.wsample
StatsBase.wsample — Method.
wsample([rng], [a], w)
2.133 StatsBase.wsample
StatsBase.wsample — Method.
2.134 StatsBase.wsample
StatsBase.wsample — Method.
2.135 StatsBase.wsum!
StatsBase.wsum! — Method.
Compute the weighted sum of A with weights w over the dimension dim and
store the result in R. If init=false, the sum is added to R rather than starting
from zero.
source
2.136 StatsBase.wsum
StatsBase.wsum — Method.
Compute the weighted sum of an array v with weights w, optionally over the
dimension dim.
source
2.137 StatsBase.zscore!
StatsBase.zscore! — Method.
zscore!([Z], X, , )
2.138 StatsBase.zscore
StatsBase.zscore — Method.
zscore(X, [, ])
PyPlot
3.1 Base.step
Base.step — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“step”,))
source
3.2 PyPlot.Axes3D
PyPlot.Axes3D — Method.
PyPlot.LazyHelp(PyPlot.LazyPyModule(“mpl toolkits.mplot3d.axes3d”, Py-
Call.PyObject(Ptr{PyCall.PyObject struct} @0x0000000000000000)), (“Axes3D”,))
source
3.3 PyPlot.acorr
PyPlot.acorr — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“acorr”,))
source
3.4 PyPlot.annotate
PyPlot.annotate — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“annotate”,))
source
84
3.5. PYPLOT.ARROW 85
3.5 PyPlot.arrow
PyPlot.arrow — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“arrow”,))
source
3.6 PyPlot.autoscale
PyPlot.autoscale — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“autoscale”,))
source
3.7 PyPlot.autumn
PyPlot.autumn — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“autumn”,))
source
3.8 PyPlot.axes
PyPlot.axes — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“axes”,))
source
3.9 PyPlot.axhline
PyPlot.axhline — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“axhline”,))
source
3.10 PyPlot.axhspan
PyPlot.axhspan — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“axhspan”,))
source
86 CHAPTER 3. PYPLOT
3.11 PyPlot.axis
PyPlot.axis — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“axis”,))
source
3.12 PyPlot.axvline
PyPlot.axvline — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“axvline”,))
source
3.13 PyPlot.axvspan
PyPlot.axvspan — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“axvspan”,))
source
3.14 PyPlot.bar
PyPlot.bar — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“bar”,))
source
3.15 PyPlot.bar3D
PyPlot.bar3D — Method.
PyPlot.LazyHelp(PyPlot.LazyPyModule(“mpl toolkits.mplot3d.axes3d”, Py-
Call.PyObject(Ptr{PyCall.PyObject struct} @0x0000000000000000)), (“Axes3D”,
“bar3d”))
source
3.16 PyPlot.barbs
PyPlot.barbs — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“barbs”,))
source
3.17. PYPLOT.BARH 87
3.17 PyPlot.barh
PyPlot.barh — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“barh”,))
source
3.18 PyPlot.bone
PyPlot.bone — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“bone”,))
source
3.19 PyPlot.box
PyPlot.box — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“box”,))
source
3.20 PyPlot.boxplot
PyPlot.boxplot — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“boxplot”,))
source
3.22 PyPlot.cla
PyPlot.cla — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“cla”,))
source
88 CHAPTER 3. PYPLOT
3.23 PyPlot.clabel
PyPlot.clabel — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“clabel”,))
source
3.24 PyPlot.clf
PyPlot.clf — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“clf”,))
source
3.25 PyPlot.clim
PyPlot.clim — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“clim”,))
source
3.26 PyPlot.cohere
PyPlot.cohere — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“cohere”,))
source
3.27 PyPlot.colorbar
PyPlot.colorbar — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“colorbar”,))
source
3.28 PyPlot.colors
PyPlot.colors — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“colors”,))
source
3.29. PYPLOT.CONTOUR 89
3.29 PyPlot.contour
PyPlot.contour — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“contour”,))
source
3.30 PyPlot.contour3D
PyPlot.contour3D — Method.
PyPlot.LazyHelp(PyPlot.LazyPyModule(“mpl toolkits.mplot3d.axes3d”, Py-
Call.PyObject(Ptr{PyCall.PyObject struct} @0x0000000000000000)), (“Axes3D”,
“contour3D”))
source
3.31 PyPlot.contourf
PyPlot.contourf — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“contourf”,))
source
3.32 PyPlot.contourf3D
PyPlot.contourf3D — Method.
PyPlot.LazyHelp(PyPlot.LazyPyModule(“mpl toolkits.mplot3d.axes3d”, Py-
Call.PyObject(Ptr{PyCall.PyObject struct} @0x0000000000000000)), (“Axes3D”,
“contourf3D”))
source
3.33 PyPlot.cool
PyPlot.cool — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“cool”,))
source
3.34 PyPlot.copper
PyPlot.copper — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“copper”,))
source
90 CHAPTER 3. PYPLOT
3.35 PyPlot.csd
PyPlot.csd — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“csd”,))
source
3.36 PyPlot.delaxes
PyPlot.delaxes — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“delaxes”,))
source
3.37 PyPlot.disconnect
PyPlot.disconnect — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“disconnect”,))
source
3.38 PyPlot.draw
PyPlot.draw — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“draw”,))
source
3.39 PyPlot.errorbar
PyPlot.errorbar — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“errorbar”,))
source
3.40 PyPlot.eventplot
PyPlot.eventplot — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“eventplot”,))
source
3.41. PYPLOT.FIGASPECT 91
3.41 PyPlot.figaspect
PyPlot.figaspect — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“figaspect”,))
source
3.42 PyPlot.figimage
PyPlot.figimage — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“figimage”,))
source
3.43 PyPlot.figlegend
PyPlot.figlegend — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“figlegend”,))
source
3.44 PyPlot.figtext
PyPlot.figtext — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“figtext”,))
source
3.45 PyPlot.figure
PyPlot.figure — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x00000000383be0d0),
())
source
3.48 PyPlot.findobj
PyPlot.findobj — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“findobj”,))
source
3.49 PyPlot.flag
PyPlot.flag — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“flag”,))
source
3.50 PyPlot.gca
PyPlot.gca — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“gca”,))
source
3.51 PyPlot.gcf
PyPlot.gcf — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x00000000383be1e0),
())
source
3.52 PyPlot.gci
PyPlot.gci — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“gci”,))
source
3.53. PYPLOT.GET CMAP 93
3.58 PyPlot.ginput
PyPlot.ginput — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“ginput”,))
source
94 CHAPTER 3. PYPLOT
3.59 PyPlot.gray
PyPlot.gray — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“gray”,))
source
3.60 PyPlot.grid
PyPlot.grid — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“grid”,))
source
3.61 PyPlot.hexbin
PyPlot.hexbin — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“hexbin”,))
source
3.62 PyPlot.hist2D
PyPlot.hist2D — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“hist2d”,))
source
3.63 PyPlot.hlines
PyPlot.hlines — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“hlines”,))
source
3.64 PyPlot.hold
PyPlot.hold — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“hold”,))
source
3.65. PYPLOT.HOT 95
3.65 PyPlot.hot
PyPlot.hot — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“hot”,))
source
3.66 PyPlot.hsv
PyPlot.hsv — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“hsv”,))
source
3.67 PyPlot.imread
PyPlot.imread — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“imread”,))
source
3.68 PyPlot.imsave
PyPlot.imsave — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“imsave”,))
source
3.69 PyPlot.imshow
PyPlot.imshow — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“imshow”,))
source
3.70 PyPlot.ioff
PyPlot.ioff — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“ioff”,))
source
96 CHAPTER 3. PYPLOT
3.71 PyPlot.ion
PyPlot.ion — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“ion”,))
source
3.72 PyPlot.ishold
PyPlot.ishold — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“ishold”,))
source
3.73 PyPlot.jet
PyPlot.jet — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“jet”,))
source
3.74 PyPlot.legend
PyPlot.legend — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“legend”,))
source
3.76 PyPlot.loglog
PyPlot.loglog — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“loglog”,))
source
3.77. PYPLOT.MARGINS 97
3.77 PyPlot.margins
PyPlot.margins — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“margins”,))
source
3.78 PyPlot.matshow
PyPlot.matshow — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“matshow”,))
source
3.79 PyPlot.mesh
PyPlot.mesh — Method.
PyPlot.LazyHelp(PyPlot.LazyPyModule(“mpl toolkits.mplot3d.axes3d”, Py-
Call.PyObject(Ptr{PyCall.PyObject struct} @0x0000000000000000)), (“Axes3D”,
“plot wireframe”))
source
3.81 PyPlot.minorticks on
PyPlot.minorticks on — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“minorticks on”,))
source
3.82 PyPlot.over
PyPlot.over — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“over”,))
source
98 CHAPTER 3. PYPLOT
3.83 PyPlot.pause
PyPlot.pause — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“pause”,))
source
3.84 PyPlot.pcolor
PyPlot.pcolor — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“pcolor”,))
source
3.85 PyPlot.pcolormesh
PyPlot.pcolormesh — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“pcolormesh”,))
source
3.86 PyPlot.pie
PyPlot.pie — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“pie”,))
source
3.87 PyPlot.pink
PyPlot.pink — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“pink”,))
source
3.88 PyPlot.plot
PyPlot.plot — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“plot”,))
source
3.89. PYPLOT.PLOT3D 99
3.89 PyPlot.plot3D
PyPlot.plot3D — Method.
PyPlot.LazyHelp(PyPlot.LazyPyModule(“mpl toolkits.mplot3d.axes3d”, Py-
Call.PyObject(Ptr{PyCall.PyObject struct} @0x0000000000000000)), (“Axes3D”,
“plot3D”))
source
3.94 PyPlot.plotfile
PyPlot.plotfile — Method.
100 CHAPTER 3. PYPLOT
3.95 PyPlot.polar
PyPlot.polar — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“polar”,))
source
3.96 PyPlot.prism
PyPlot.prism — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“prism”,))
source
3.97 PyPlot.psd
PyPlot.psd — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“psd”,))
source
3.98 PyPlot.quiver
PyPlot.quiver — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“quiver”,))
source
3.99 PyPlot.quiverkey
PyPlot.quiverkey — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“quiverkey”,))
source
3.100. PYPLOT.RC 101
3.100 PyPlot.rc
PyPlot.rc — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“rc”,))
source
3.102 PyPlot.rcdefaults
PyPlot.rcdefaults — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“rcdefaults”,))
source
3.104 PyPlot.rgrids
PyPlot.rgrids — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“rgrids”,))
source
3.105 PyPlot.savefig
PyPlot.savefig — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“savefig”,))
source
102 CHAPTER 3. PYPLOT
3.106 PyPlot.sca
PyPlot.sca — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“sca”,))
source
3.107 PyPlot.scatter
PyPlot.scatter — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“scatter”,))
source
3.108 PyPlot.scatter3D
PyPlot.scatter3D — Method.
PyPlot.LazyHelp(PyPlot.LazyPyModule(“mpl toolkits.mplot3d.axes3d”, Py-
Call.PyObject(Ptr{PyCall.PyObject struct} @0x0000000000000000)), (“Axes3D”,
“scatter3D”))
source
3.109 PyPlot.sci
PyPlot.sci — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“sci”,))
source
3.110 PyPlot.semilogx
PyPlot.semilogx — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“semilogx”,))
source
3.111 PyPlot.semilogy
PyPlot.semilogy — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“semilogy”,))
source
3.112. PYPLOT.SET CMAP 103
3.113 PyPlot.setp
PyPlot.setp — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“setp”,))
source
3.114 PyPlot.specgram
PyPlot.specgram — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“specgram”,))
source
3.115 PyPlot.spectral
PyPlot.spectral — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“spectral”,))
source
3.116 PyPlot.spring
PyPlot.spring — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“spring”,))
source
3.117 PyPlot.spy
PyPlot.spy — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“spy”,))
source
104 CHAPTER 3. PYPLOT
3.118 PyPlot.stackplot
PyPlot.stackplot — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“stackplot”,))
source
3.119 PyPlot.stem
PyPlot.stem — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“stem”,))
source
3.120 PyPlot.streamplot
PyPlot.streamplot — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“streamplot”,))
source
3.121 PyPlot.subplot
PyPlot.subplot — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“subplot”,))
source
3.122 PyPlot.subplot2grid
PyPlot.subplot2grid — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“subplot2grid”,))
source
3.124 PyPlot.subplots
PyPlot.subplots — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“subplots”,))
source
3.126 PyPlot.summer
PyPlot.summer — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“summer”,))
source
3.127 PyPlot.suptitle
PyPlot.suptitle — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“suptitle”,))
source
3.128 PyPlot.surf
PyPlot.surf — Method.
PyPlot.LazyHelp(PyPlot.LazyPyModule(“mpl toolkits.mplot3d.axes3d”, Py-
Call.PyObject(Ptr{PyCall.PyObject struct} @0x0000000000000000)), (“Axes3D”,
“plot surface”))
source
3.129 PyPlot.table
PyPlot.table — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“table”,))
source
106 CHAPTER 3. PYPLOT
3.130 PyPlot.text
PyPlot.text — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“text”,))
source
3.131 PyPlot.text2D
PyPlot.text2D — Method.
PyPlot.LazyHelp(PyPlot.LazyPyModule(“mpl toolkits.mplot3d.axes3d”, Py-
Call.PyObject(Ptr{PyCall.PyObject struct} @0x0000000000000000)), (“Axes3D”,
“text2D”))
source
3.132 PyPlot.text3D
PyPlot.text3D — Method.
PyPlot.LazyHelp(PyPlot.LazyPyModule(“mpl toolkits.mplot3d.axes3d”, Py-
Call.PyObject(Ptr{PyCall.PyObject struct} @0x0000000000000000)), (“Axes3D”,
“text3D”))
source
3.133 PyPlot.thetagrids
PyPlot.thetagrids — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“thetagrids”,))
source
3.137 PyPlot.title
PyPlot.title — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“title”,))
source
3.138 PyPlot.tricontour
PyPlot.tricontour — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“tricontour”,))
source
3.139 PyPlot.tricontourf
PyPlot.tricontourf — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“tricontourf”,))
source
3.140 PyPlot.tripcolor
PyPlot.tripcolor — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“tripcolor”,))
source
3.141 PyPlot.triplot
PyPlot.triplot — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“triplot”,))
source
108 CHAPTER 3. PYPLOT
3.142 PyPlot.twinx
PyPlot.twinx — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“twinx”,))
source
3.143 PyPlot.twiny
PyPlot.twiny — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“twiny”,))
source
3.144 PyPlot.using3D
PyPlot.using3D — Method.
using3D()
This function ensures that the mplot3d module is loaded for 3d plotting.
This occurs automatically if you call any of the 3d plotting functions like plot3D
or surf, but it may be necessary to call this function manually if you are passing
projection="3d" explicitly to axes or subplot objects.
source
3.145 PyPlot.vlines
PyPlot.vlines — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“vlines”,))
source
3.146 PyPlot.waitforbuttonpress
PyPlot.waitforbuttonpress — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“waitforbuttonpress”,))
source
3.147. PYPLOT.WINTER 109
3.147 PyPlot.winter
PyPlot.winter — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“winter”,))
source
3.148 PyPlot.xkcd
PyPlot.xkcd — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“xkcd”,))
source
3.149 PyPlot.xlabel
PyPlot.xlabel — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“xlabel”,))
source
3.150 PyPlot.xlim
PyPlot.xlim — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“xlim”,))
source
3.151 PyPlot.xscale
PyPlot.xscale — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“xscale”,))
source
3.152 PyPlot.xticks
PyPlot.xticks — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“xticks”,))
source
110 CHAPTER 3. PYPLOT
3.153 PyPlot.ylabel
PyPlot.ylabel — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“ylabel”,))
source
3.154 PyPlot.ylim
PyPlot.ylim — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“ylim”,))
source
3.155 PyPlot.yscale
PyPlot.yscale — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“yscale”,))
source
3.156 PyPlot.yticks
PyPlot.yticks — Method.
PyPlot.LazyHelp(PyCall.PyObject(Ptr{PyCall.PyObject struct} @0x000000002ba7ed68),
(“yticks”,))
source
3.157 PyPlot.zlabel
PyPlot.zlabel — Method.
PyPlot.LazyHelp(PyPlot.LazyPyModule(“mpl toolkits.mplot3d.axes3d”, Py-
Call.PyObject(Ptr{PyCall.PyObject struct} @0x0000000000000000)), (“Axes3D”,
“set zlabel”))
source
3.158 PyPlot.zlim
PyPlot.zlim — Method.
PyPlot.LazyHelp(PyPlot.LazyPyModule(“mpl toolkits.mplot3d.axes3d”, Py-
Call.PyObject(Ptr{PyCall.PyObject struct} @0x0000000000000000)), (“Axes3D”,
“set zlim”))
source
3.159. PYPLOT.ZSCALE 111
3.159 PyPlot.zscale
PyPlot.zscale — Method.
PyPlot.LazyHelp(PyPlot.LazyPyModule(“mpl toolkits.mplot3d.axes3d”, Py-
Call.PyObject(Ptr{PyCall.PyObject struct} @0x0000000000000000)), (“Axes3D”,
“set zscale”))
source
3.160 PyPlot.zticks
PyPlot.zticks — Method.
PyPlot.LazyHelp(PyPlot.LazyPyModule(“mpl toolkits.mplot3d.axes3d”, Py-
Call.PyObject(Ptr{PyCall.PyObject struct} @0x0000000000000000)), (“Axes3D”,
“set zticks”))
source
Chapter 4
IndexedTables
4.1 Base.Sort.select
Base.Sort.select — Method.
select(t::Table, which::Selection)
Select all or a subset of columns, or a single column from the table.
Selection is a type union of many types that can select from a table. It
can be:
Examples:
Selection with Integer – returns the column at this position.
julia> tbl = table([0.01, 0.05], [2,1], [3,4], names=[:t, :x, :y], pkey=:t)
Table with 2 rows, 3 columns:
t x y
0.01 2 3
0.05 1 4
112
4.1. BASE.SORT.SELECT 113
julia> select(tbl, 2)
2-element Array{Int64,1}:
2
1
Selection with Tuple– returns a table containing a column for every selector
in the tuple.
2 0.01
1 0.05
1 -0.05
2 -0.01
114 CHAPTER 4. INDEXEDTABLES
Note that since tbl was initialized with t as the primary key column, se-
lections that retain the key column will retain its status as a key. The same
applies when multiple key columns are selected.
Selection with a custom array in the tuple will cause the name of the columns
to be removed and replaced with integers.
2 0.01 3
1 0.05 4
2 0.01 3
1 0.05 4
2 0.01 -0.01
1 0.05 -0.05
2 0.01 200.0
1 0.05 20.0
source
4.2 Base.reduce
Base.reduce — Method.
reduce(f, t::Table; select::Selection)
4.2. BASE.REDUCE 115
0.1 0
0.5 1
0.75 2
When f is a function, it reduces the selection as usual:
julia> reduce(+, t, select=:t)
1.35
If select is omitted, the rows themselves are passed to reduce as tuples.
julia> reduce((a, b) -> @NT(t=a.t+b.t, x=a.x+b.x), t)
(t = 1.35, x = 3)
If f is an OnlineStat object from the OnlineStats package, the statistic is
computed on the selection.
julia> using OnlineStats
julia> y.max
2
julia> y.min
0
116 CHAPTER 4. INDEXEDTABLES
Note that the return value of invoking reduce with a tuple of functions will
be a named tuple which has the function names as the keys. In the example,
we reduced using min and max functions to obtain the minimum and maximum
values in column x.
If you want to give a different name to the fields in the output, use a named
tuple as f instead:
You can also compute many OnlineStats by passing tuple or named tuple of
OnlineStat objects as the reducer.
julia> y.Mean
Mean: n=3 | value=0.45
julia> y.Variance
Variance: n=3 | value=0.1075
See Selection for more on what selectors can be specified. Here since
each output can select its own input, select keyword is unsually unnecessary.
If specified, the slections in the reducer tuple will be done over the result of
selecting with the select argument.
source
4.3 DataValues.dropna
DataValues.dropna — Function.
dropna(t[, select])
Drop rows which contain NA values.
0.1 2 #NA
0.5 #NA 6
#NA 4 #NA
0.7 5 7
julia> dropna(t)
Table with 1 rows, 3 columns:
t x y
0.7 5 7
Optionally select can be speicified to limit columns to look for NAs in.
0.5 #NA 6
0.7 5 7
0.1 2 #NA
0.7 5 7
Any columns whose NA rows have been dropped will be converted to non-
na array type. In our last example, columns t and x got converted from
Array{DataValue{Int}} to Array{Int}. Similarly if the vectors are of type
DataValueArray{T} (default for loadtable) they will be converted to Array{T}.
[] julia¿ typeof(column(dropna(t,:x), :x)) Array{Int64,1}
source
4.4 IndexedTables.aggregate!
IndexedTables.aggregate! — Method.
aggregate!(f::Function, arr::NDSparse)
Combine adjacent rows with equal indices using the given 2-argument re-
duction function, in place.
source
118 CHAPTER 4. INDEXEDTABLES
4.5 IndexedTables.asofjoin
IndexedTables.asofjoin — Method.
asofjoin(left::NDSparse, right::NDSparse)
asofjoin is most useful on two time-series. It joins rows from left with the
“most recent” value from right.
julia> asofjoin(x,y)
2-d NDSparse with 4 values (Int64):
1 2
"ko" 2017-11-11 1
"ko" 2017-11-12 5
"xrx" 2017-11-11 7
"xrx" 2017-11-12 7
source
julia> collect_columns(s)
2-element Columns{Tuple{Int64,Int64}}:
(1, 2)
(3, 4)
julia> collect_columns(s)
4-element Array{Int64,1}:
1
4.7. INDEXEDTABLES.COLNAMES 119
3
5
7
source
4.7 IndexedTables.colnames
IndexedTables.colnames — Function.
colnames(itr)
julia> colnames([1,2,3])
1-element Array{Int64,1}:
1
:x
1
2
source
4.8 IndexedTables.columns
IndexedTables.columns — Function.
columns(itr[, select::Selection])
Select one or more columns from an iterable of rows as a tuple of vectors.
select specifies which columns to select. See Selection convention for
possible values. If unspecified, returns all columns.
itr can be NDSparse, Columns and AbstractVector, and their distributed
counterparts.
Examples
1 3
2 4
julia> columns(t)
(x = [1, 2], y = [3, 4])
1
2
source
4.9 IndexedTables.columns
IndexedTables.columns — Method.
columns(itr, which)
Returns a vector or a tuple of vectors from the iterator.
source
4.10 IndexedTables.convertdim
IndexedTables.convertdim — Method.
convertdim(x::NDSparse, d::DimName, xlate; agg::Function, vecagg::Function,
name)
Apply function or dictionary xlate to each index in the specified dimension.
If the mapping is many-to-one, agg or vecagg is used to aggregate the results.
If agg is passed, it is used as a 2-argument reduction function over the data. If
vecagg is passed, it is used as a vector-to-scalar function to aggregate the data.
name optionally specifies a new name for the translated dimension.
source
4.11 IndexedTables.dimlabels
IndexedTables.dimlabels — Method.
dimlabels(t::NDSparse)
Returns an array of integers or symbols giving the labels for the dimensions
of t. ndims(t) == length(dimlabels(t)).
source
4.12 IndexedTables.flatten
IndexedTables.flatten — Function.
flatten(t::Table, col=length(columns(t)))
Flatten col column which may contain a vector of vectors while repeating
the other fields. If column argument is not provided, default to last column.
122 CHAPTER 4. INDEXEDTABLES
Examples:
1 [3, 4]
2 [5, 6]
julia> flatten(x, 2)
Table with 4 rows, 2 columns:
x y
1 3
1 4
2 5
2 6
1 3 5
1 4 6
2 7 9
2 8 10
source
4.13 IndexedTables.flush!
IndexedTables.flush! — Method.
flush!(arr::NDSparse)
Commit queued assignment operations, by sorting and merging the internal
temporary buffer.
source
4.14 IndexedTables.groupby
IndexedTables.groupby — Function.
groupby(f, t[, by::Selection]; select::Selection, flatten)
4.14. INDEXEDTABLES.GROUPBY 123
Group rows by by, and apply f to each group. f can be a function or a tuple
of functions. The result of f on each group is put in a table keyed by unique by
values. flatten will flatten the result and can be used when f returns a vector
instead of a single scalar value.
Examples
1 2.0
2 5.0
1 1 [1, 2]
1 2 [3]
2 1 [5, 6]
2 2 [4]
1 1 1.5
1 2 3.0
2 1 5.5
2 2 4.0
multiple aggregates can be computed by passing a tuple of functions:
Finally, it’s possible to select different inputs for different functions by using
a named tuple of slector => function pairs:
1 2.0 0.57735
2 5.0 0.57735
1 3.5
1 3.5
2 5.5
2 5.5
The keyword option usekey = true allows to use information from the in-
dexing column. f will need to accept two arguments, the first being the key (as
a Tuple or NamedTuple) the second the data (as Columns).
1 4.5
2 7.5
source
4.15. INDEXEDTABLES.GROUPJOIN 125
4.15 IndexedTables.groupjoin
IndexedTables.groupjoin — Method.
groupjoin([f, ] left, right; how, <options>)
Join left and right creating groups of values with matching keys.
Inner join
Inner join is the default join (when how is unspecified). It looks up keys from
left in right and only joins them when there is a match. This generates the
“intersection” of keys from left and right.
One-to-many and many-to-many matches
If the same key appears multiple times in either table (say, m and n times
respectively), each row with a key from left is matched with each row from
right with that key. The resulting group has mn output elements.
1 1 1
1 2 2
1 2 3
2 1 4
0 1 1
1 2 2
1 2 3
2 1 4
julia> groupjoin(l,r)
Table with 2 rows, 3 columns:
a b groups
Left join
Left join looks up rows from right where keys match that in left. If there
are no such rows in right, an NA value is used for every selected field from
right.
1 1 NamedTuples._NT_c_d{Int64,Int64}[]
1 2 NamedTuples._NT_c_d{Int64,Int64}[(c = 2, d = 2), (c = 2, d = 3), (c = 3, d = 2),
2 1 NamedTuples._NT_c_d{Int64,Int64}[(c = 4, d = 4)]
Outer join
Outer (aka Union) join looks up rows from right where keys match that in
left, and also rows from left where keys match those in left, if there are no
matches on either side, a tuple of NA values is used. The output is guarranteed
to contain
0 1 NamedTuples._NT_c_d{Int64,Int64}[]
1 1 NamedTuples._NT_c_d{Int64,Int64}[]
1 2 NamedTuples._NT_c_d{Int64,Int64}[(c = 2, d = 2), (c = 2, d = 3), (c = 3, d = 2),
2 1 NamedTuples._NT_c_d{Int64,Int64}[(c = 4, d = 4)]
Options
0 NamedTuples._NT_c_d{Int64,Int64}[]
1 NamedTuples._NT_c_d{Int64,Int64}[(c = 1, d = 2), (c = 1, d = 3), (c = 2, d = 2), (c
2 NamedTuples._NT_c_d{Int64,Int64}[(c = 4, d = 4)]
source
4.16. INDEXEDTABLES.GROUPREDUCE 127
4.16 IndexedTables.groupreduce
IndexedTables.groupreduce — Function.
groupreduce(f, t[, by::Selection]; select::Selection)
Group rows by by, and apply f to reduce each group. f can be a function,
OnlineStat or a struct of these as described in reduce. Recommended: see
documentation for reduce first. The result of reducing each group is put in a
table keyed by unique by values, the names of the output columns are the same
as the names of the fields of the reduced tuples.
Examples
1 6
2 15
1 1 3
1 2 3
2 1 11
2 2 4
1 1 3 1 2
1 2 3 3 3
2 1 11 5 6
2 2 4 4 4
1 1 3 1 2
1 2 3 3 3
2 1 11 5 6
2 2 4 4 4
Finally, it’s possible to select different inputs for different reducers by using
a named tuple of slector => function pairs:
1 3 -4
2 6 -4
source
4.17 IndexedTables.insertcol
IndexedTables.insertcol — Method.
insertcol(t, position::Integer, name, x)
Insert a column x named name at position. Returns a new table.
0.01 2 3
0.05 1 4
0.01 0 2 3
0.05 1 1 4
source
4.18 IndexedTables.insertcolafter
IndexedTables.insertcolafter — Method.
insertcolafter(t, after, name, col)
Insert a column col named name after after. Returns a new table.
4.19. INDEXEDTABLES.INSERTCOLBEFORE 129
0.01 2 3
0.05 1 4
0.01 0 2 3
0.05 1 1 4
source
4.19 IndexedTables.insertcolbefore
IndexedTables.insertcolbefore — Method.
insertcolbefore(t, before, name, col)
Insert a column col named name before before. Returns a new table.
julia> t = table([0.01, 0.05], [2,1], [3,4], names=[:t, :x, :y], pkey=:t)
Table with 2 rows, 3 columns:
t x y
0.01 2 3
0.05 1 4
0.01 0 2 3
0.05 1 1 4
source
source
4.21 IndexedTables.ncols
IndexedTables.ncols — Function.
ncols(itr)
Returns the number of columns in itr.
julia> ncols([1,2,3])
1
julia> d = ncols(rows(([1,2,3],[4,5,6])))
2
julia> ncols(table(([1,2,3],[4,5,6])))
2
julia> ncols(table(@NT(x=[1,2,3],y=[4,5,6])))
2
source
4.22 IndexedTables.ndsparse
IndexedTables.ndsparse — Function.
ndsparse(indices, data; agg, presorted, copy, chunks)
Construct an NDSparse array with the given indices and data. Each vector
in indices represents the index values for one dimension. On construction, the
indices and data are sorted in lexicographic order of the indices.
Arguments:
Examples:
1-dimensional NDSparse can be constructed with a single array as index.
julia> x = ndsparse(["a","b"],[3,4])
1-d NDSparse with 2 values (Int64):
1
"a" 3
"b" 4
2014-01-01 4
2015-01-01 5
2016-01-01 6
2017-01-01 7
julia> x[Date("2015-01-01")]
5
"a" 3 5
"b" 4 6
julia> x["a", 3]
5
The data itself can also contain tuples (these are stored in columnar format,
just like in table.)
"a" 3 5 7.0
"b" 4 6 8.0
julia> x = ndsparse(@NT(x=["a","a","b"],y=[3,4,4]),
@NT(p=[5,6,7], q=[8.,9.,10.]))
2-d NDSparse with 3 values (2 field named tuples):
x y p q
"a" 3 5 8.0
"a" 4 6 9.0
"b" 4 7 10.0
julia> x["a", :]
2-d NDSparse with 2 values (2 field named tuples):
x y p q
"a" 3 5 8.0
"a" 4 6 9.0
2014-01-01 4.0
2015-01-01 5.0
2016-01-01 6.0
2017-01-01 7.0
2014-01-01 4.0
2015-01-01 5.0
2016-01-01 6.0
2017-01-01 7.0
Distribution is done to match the first distributed column from left to right.
Specify chunks to override this.
source
4.23 IndexedTables.pairs
IndexedTables.pairs — Method.
pairs(arr::NDSparse, indices...)
Similar to where, but returns an iterator giving index=>value pairs. index
will be a tuple.
source
4.24 IndexedTables.pkeynames
IndexedTables.pkeynames — Method.
pkeynames(t::Table)
Names of the primary key columns in t.
Example
julia> pkeynames(t)
()
julia> pkeynames(t)
(1,)
julia> pkeys(t)
2-element IndexedTables.Columns{NamedTuples._NT_x_y{Int64,Int64},NamedTuples._NT_x_y{Ar
(x = 1, y = 3)
(x = 2, y = 1)
source
4.25 IndexedTables.pkeynames
IndexedTables.pkeynames — Method.
pkeynames(t::NDSparse)
julia> x = ndsparse([1,2],[3,4])
1-d NDSparse with 2 values (Int64):
1
1 3
2 4
julia> pkeynames(x)
(1,)
source
4.26 IndexedTables.pkeys
IndexedTables.pkeys — Method.
pkeys(itr::Table)
Primary keys of the table. If Table doesn’t have any designated primary
key columns (constructed without pkey argument) then a default key of tuples
(1,):(n,) is generated.
Example
"a" 3
"b" 4
julia> pkeys(a)
2-element Columns{Tuple{Int64}}:
(1,)
(2,)
"a" 3
"b" 4
julia> pkeys(a)
2-element Columns{Tuple{String}}:
("a",)
("b",)
source
4.27 IndexedTables.popcol
IndexedTables.popcol — Method.
popcol(t, col)
Remove the column col from the table. Returns a new table.
popcol(t, cols...)
Remove many columns at a time.
0.01 2 3
0.05 1 4
0.01 3
0.05 4
source
136 CHAPTER 4. INDEXEDTABLES
4.28 IndexedTables.pushcol
IndexedTables.pushcol — Method.
pushcol(t, name, x)
Push a column x to the end of the table. name is the name for the new
column. Returns a new table.
pushcol(t, map::Pair...)
Push many columns at a time.
Example:
0.01 2 3
0.05 1 4
0.01 2 3 1//2
0.05 1 4 3//4
source
4.30 IndexedTables.reindex
IndexedTables.reindex — Function.
reindex(t::Table, by[, select])
Reindex t by columns selected in by. Keeps columns selected by select as
non-indexed columns. By default all columns not mentioned in by are kept.
Use selectkeys to reindex and NDSparse object.
1 4 2
3 5 1
julia> pkeynames(t)
(:y, :z)
4 5 1 3
5 4 2 1
julia> pkeynames(t)
(:w, :z)
source
4.31 IndexedTables.renamecol
IndexedTables.renamecol — Method.
renamecol(t, col, newname)
Set newname as the new name for column col in t. Returns a new table.
renamecol(t, map::Pair...)
Rename many columns at a time.
0.01 2
0.05 1
0.01 2
0.05 1
source
138 CHAPTER 4. INDEXEDTABLES
4.32 IndexedTables.rows
IndexedTables.rows — Function.
rows(itr[, select::Selection])
Select one or more fields from an iterable of rows as a vector of their values.
select specifies which fields to select. See Selection convention for pos-
sible values. If unspecified, returns all columns.
itr can be NDSparse, Columns and AbstractVector, and their distributed
counterparts.
Examples
1 3
2 4
julia> rows(t)
2-element IndexedTables.Columns{NamedTuples._NT_x_y{Int64,Int64},NamedTuples._NT_x_y{Ar
(x = 1, y = 3)
(x = 2, y = 4)
Note that vectors of tuples returned are Columns object and have columnar
internal storage.
source
4.33 IndexedTables.setcol
IndexedTables.setcol — Method.
setcol(t::Table, col::Union{Symbol, Int}, x::Selection)
4.33. INDEXEDTABLES.SETCOL 139
1 3
2 4
1 5
2 6
x can be any selection that transforms existing columns.
julia> setcol(t, :x, :x => x->1/x)
Table with 2 rows, 2 columns:
x y
1.0 5
0.5 6
setcol will result in a re-sorted copy if a primary key column is replaced.
julia> t = table([0.01, 0.05], [1,2], [3,4], names=[:t, :x, :y], pkey=:t)
Table with 2 rows, 3 columns:
t x y
0.01 1 3
0.05 2 4
0.05 2 4
0.1 1 3
julia> t == t2
false
If col is not an existing column, setcol will add it:
140 CHAPTER 4. INDEXEDTABLES
1 2
2 3
1 2 1
2 3 2
source
4.34 IndexedTables.stack
IndexedTables.stack — Method.
stack(t, by = pkeynames(t); select = excludecols(t, by), variable
= :variable, value = :value)
Reshape a table from the wide to the long format. Columns in by are
kept as indexing columns. Columns in select are stacked. In addition to the
id columns, two additional columns labeled variable and value are added,
containg the column identifier and the stacked columns.
Examples
julia> t = table(1:4, [1, 4, 9, 16], [1, 8, 27, 64], names = [:x, :xsquare, :xcube], pk
julia> stack(t)
Table with 8 rows, 3 columns:
x variable value
1 :xsquare 1
1 :xcube 1
2 :xsquare 4
2 :xcube 8
3 :xsquare 9
3 :xcube 27
4 :xsquare 16
4 :xcube 64
source
4.35. INDEXEDTABLES.SUMMARIZE 141
4.35 IndexedTables.summarize
IndexedTables.summarize — Function.
summarize(f, t, by = pkeynames(t); select = excludecols(t, by),
stack = false, variable = :variable)
Apply summary functions column-wise to a table. Return a NamedTuple in
the non-grouped case and a table in the grouped case. Use stack=true to stack
results of the same summary function for different columns.
Examples
julia> s = table(["a","a","b","b"], [1,3,5,7], [2,2,2,2], names = [:x, :y, :z], pkey = :x);
julia> summarize(mean, s)
Table with 2 rows, 3 columns:
x y z
"a" :y 2.0
"a" :z 2.0
"b" :y 6.0
"b" :z 2.0
source
142 CHAPTER 4. INDEXEDTABLES
4.36 IndexedTables.table
IndexedTables.table — Function.
table(cols::AbstractVector...; names, <options>)
Create a table with columns given by cols.
1 4
2 5
3 6
names specify names for columns. If specified, the table will be an iterator
of named tuples.
1 4
2 5
3 6
table(cols::Columns; <options>)
Construct a table from a vector of tuples. See rows.
julia> b == table(b)
true
4.36. INDEXEDTABLES.TABLE 143
table(iter; <options>)
Construct a table from an iterable table.
Options:
• copy: creates a copy of the input vectors if true. true by default. Irrela-
vant if chunks is specified.
• chunks: distribute the table into chunks (Integer) chunks (a safe bet is
nworkers()). Table is not distributed by default. See Distributed docs.
Examples:
Specifying pkey will cause the table to be sorted by the columns named in
pkey:
1 6
2 4
3 5
julia> b = table([2,1,2,1],[2,3,1,3],[4,5,6,7],
names=[:x, :y, :z], pkey=(:x,:y))
Table with 4 rows, 3 columns:
x y z
1 3 5
1 3 7
2 1 6
2 2 4
1 6
2 4
3 5
4 7
A distributed table will be constructed if one of the arrays passed into table
constructor is a distributed array. A distributed Array can be constructed using
distribute:
1 5
2 6
3 7
4 8
1 5 9
2 6 10
3 7 11
4 8 12
Distribution is done to match the first distributed column from left to right.
Specify chunks to override this.
source
4.37 IndexedTables.unstack
IndexedTables.unstack — Method.
unstack(t, by = pkeynames(t); variable = :variable, value = :value)
Reshape a table from the long to the wide format. Columns in by are kept
as indexing columns. Keyword arguments variable and value denote which
column contains the column identifier and which the corresponding values.
4.38. INDEXEDTABLES.UPDATE! 145
Examples
julia> t = table(1:4, [1, 4, 9, 16], [1, 8, 27, 64], names = [:x, :xsquare, :xcube], pkey = :x);
1 :xsquare 1
1 :xcube 1
2 :xsquare 4
2 :xcube 8
3 :xsquare 9
3 :xcube 27
4 :xsquare 16
4 :xcube 64
julia> unstack(long)
Table with 4 rows, 3 columns:
x xsquare xcube
1 1 1
2 4 8
3 9 27
4 16 64
source
4.38 IndexedTables.update!
IndexedTables.update! — Method.
update!(f::Function, arr::NDSparse, indices...)
Replace data values x with f(x) at each location that matches the given
indices.
source
4.39 IndexedTables.where
IndexedTables.where — Method.
where(arr::NDSparse, indices...)
Returns an iterator over data items where the given indices match. Accepts
the same index arguments as getindex.
source
Chapter 5
Images
5.1 ColorTypes.blue
ColorTypes.blue — Function.
b = blue(img) extracts the blue channel from an RGB image img
source
5.2 ColorTypes.green
ColorTypes.green — Function.
g = green(img) extracts the green channel from an RGB image img
source
5.3 ColorTypes.red
ColorTypes.red — Function.
r = red(img) extracts the red channel from an RGB image img
source
146
5.5. IMAGES.BILINEAR INTERPOLATION 147
For coloured images, the input is converted to YIQ type and the Y channel
is gamma corrected. This is the combined with the I and Q channels and the
resulting image converted to the same type as the input.
source
P = bilinear_interpolation(img, r, c)
Find “blobs” in an N-D image using the negative Lapacian of Gaussians with
the specifed vector or tuple of values. The algorithm searches for places where
the filtered image (for a particular ) is at a peak compared to all spatially- and
-adjacent voxels, where is scales[i] * shape for some i. By default, shape
is an ntuple of 1s.
The optional edges argument controls whether peaks on the edges are in-
cluded. edges can be true or false, or a N+1-tuple in which the first entry
controls whether edge- values are eligible to serve as peaks, and the remaining
N entries control each of the N dimensions of img.
Citation:
Lindeberg T (1998), “Feature Detection with Automatic Scale Selection”,
International Journal of Computer Vision, 30(2), 79–116.
See also: BlobLoG.
source
5.7 Images.boxdiff
Images.boxdiff — Method.
A - - - - - - B -
- * * * * * * * -
- * * * * * * * -
- * * * * * * * -
- * * * * * * * -
- * * * * * * * -
C * * * * * * D -
- - - - - - - - -
5.8 Images.canny
Images.canny — Method.
5.9 Images.clahe
Images.clahe — Method.
5.10 Images.clearborder
Images.clearborder — Function.
cleared_img = clearborder(img)
cleared_img = clearborder(img, width)
cleared_img = clearborder(img, width, background)
Returns a copy of the original image after clearing objects connected to the
border of the image.
Parameters:
source
5.11 Images.cliphist
Images.cliphist — Method.
Clips the histogram above a certain value clip. The excess left in the bins
exceeding clip is redistributed among the remaining bins.
source
150 CHAPTER 5. IMAGES
5.12 Images.complement
Images.complement — Method.
y = complement(x)
source
5.18 Images.convexhull
Images.convexhull — Method.
chull = convexhull(img)
Computes the convex hull of a binary image and returns the vertices of
convex hull as a CartesianIndex array.
source
5.19 Images.corner2subpixel
Images.corner2subpixel — Method.
corners = corner2subpixel(responses::AbstractMatrix,corner_indicator::AbstractMatrix{Bool})
-> Vector{HomogeneousPoint{Float64,3}}
!!! note Corners on the boundary of the image are not refined to sub-pixel
precision.
source
5.20 Images.entropy
Images.entropy — Method.
entropy(log, img)
entropy(img; [kind=:shannon])
source
5.21 Images.fastcorners
Images.fastcorners — Method.
5.22 Images.findlocalmaxima
Images.findlocalmaxima — Function.
findlocalmaxima(img, [region, edges]) -> Vector{CartesianIndex}
Returns the coordinates of elements whose value is larger than all of their
immediate neighbors. region is a list of dimensions to consider. edges is a
boolean specifying whether to include the first and last elements of each dimen-
sion, or a tuple-of-Bool specifying edge behavior for each dimension separately.
source
5.23. IMAGES.FINDLOCALMINIMA 153
5.23 Images.findlocalminima
Images.findlocalminima — Function.
Like findlocalmaxima, but returns the coordinates of the smallest elements.
source
5.25 Images.harris
Images.harris — Method.
Performs Harris corner detection. The covariances can be taken using either
a mean weighted filter or a gamma kernel.
source
5.26 Images.histeq
Images.histeq — Method.
ω = (ω11 , ω12 , . . . , ω1J , ω21 , ω22 , . . . , ω2J , ωI1 , ωI2 , . . . , ωIJ ), where each ωij ∈
{0, 1, . . . , L − 1}. Furthermore, impose a probability measure on Ω such that
the functions Ω 3 ω → ωij ∈ {0, 1, . . . , L − 1} are independent and identically
distributed.
One can then regard an image as a matrix of random variables G = [Gi,j (ω)],
where each function Gi,j : Ω → R is defined by
ωij
Gi,j (ω) = ,
L−1
and each Gi,j is distributed according to some unknown density fG . While
fG is unknown, one can approximate it with a normalised histogram of gray
levels,
nv
fˆG (v) = ,
IJ
where
Options
Various options for the parameters of this function are described in more
detail below.
Choices for img
The histeq function can handle a variety of input types. The returned
image depends on the input type. If the input is an Image then the resulting
image is of the same type and has the same properties.
For coloured images, the input is converted to YIQ type and the Y channel
is equalised. This is the combined with the I and Q channels and the resulting
image converted to the same type as the input.
Choices for nbins
You can specify the total number of bins in the histogram.
Choices for minval and maxval
If minval and maxval are specified then intensities are equalized to the range
(minval, maxval). The default values are 0 and 1.
Example
[]
using TestImages, FileIO, ImageView
img = testimage(”mandrilg ray”);imgeq = histeq(img,256);
5.27. IMAGES.HISTMATCH 155
imshow(img) imshow(imgeq)
References
5.27 Images.histmatch
Images.histmatch — Function.
5.28 Images.imROF
Images.imROF — Method.
5.29 Images.imadjustintensity
Images.imadjustintensity — Method.
imadjustintensity(img [, (minval,maxval)]) -> Image
Map intensities over the interval (minval,maxval) to the interval [0,1].
This is equivalent to map(ScaleMinMax(eltype(img), minval, maxval),
img). (minval,maxval) defaults to extrema(img).
source
156 CHAPTER 5. IMAGES
5.30 Images.imcorner
Images.imcorner — Method.
corners = imcorner(img; [method])
corners = imcorner(img, threshold, percentile; [method])
Performs corner detection using one of the following methods -
1. harris
2. shi_tomasi
3. kitchen_rosenfeld
The parameters of the individual methods are described in their documen-
tation. The maxima values of the resultant responses are taken as corners. If a
threshold is specified, the values of the responses are thresholded to give the cor-
ner pixels. The threshold is assumed to be a percentile value unless percentile
is set to false.
source
5.32 Images.imedge
Images.imedge — Function.
grad_y, grad_x, mag, orient = imedge(img, kernelfun=KernelFactors.ando3, border="replic
Edge-detection filtering. kernelfun is a valid kernel function for imgradients,
defaulting to KernelFactors.ando3. border is any of the boundary conditions
specified in padarray.
Returns a tuple (grad y, grad x, mag, orient), which are the horizontal
gradient, vertical gradient, and the magnitude and orientation of the strongest
edge, respectively.
source
5.33. IMAGES.IMHIST 157
5.33 Images.imhist
Images.imhist — Method.
Generates a histogram for the image over nbins spread between (minval,
maxval]. Color images are automatically converted to grayscale.
Output
Returns edges which is a range type that specifies how the interval (minval,
maxval] is divided into bins, and an array count which records the concomitant
bin frequencies. In particular, count has the following properties:
• length(count) == length(edges)+1.
Details
One can consider a histogram as a piecewise-constant model of a probability
density function f [1]. Suppose that f has support on some interval I = [a, b].
Let m be an integer and a = a1 < a2 < . . . < am < am+1 = b a sequence of real
numbers. Construct a sequence of intervals
N
(
X 1 ifx ∈ Ij ,
nj = 1(Ij ) (xn ), where 1(Ij ) (x) = ,
n=1
0 otherwise,
m
X nj
fˆn (x) = 1(I ) (x)
j=1
N wj j
m
X π̂j
= 1(Ij ) (x)
w
j=1 j
m
X
= ĥj 1(Ij ) (x).
j=1
The function fˆn (x) is a genuine density estimator because fˆn (x) ≥ 0 and
Z ∞ m
X nj
fˆn (x) d x = wj
−∞ j=1
N wj
= 1.
Options
Various options for the parameters of this function are described in more
detail below.
Choices for nbins
You can specify the number of discrete bins for the histogram.
Choices for minval
You have the option to specify the lower bound of the interval over which
the histogram will be computed. If minval is not specified then the minimum
value present in the image is taken as the lower bound.
Choices for maxval
You have the option to specify the upper bound of the interval over which
the histogram will be computed. If maxval is not specified then the maximum
value present in the image is taken as the upper bound.
Choices for edges
If you do not designate the number of bins, nor the lower or upper bound
of the interval, then you have the option to directly stipulate how the intervals
will be divided by specifying a range type.
Example
Compute the histogram of a grayscale image.
[]
using TestImages, FileIO, ImageView
img = testimage(”mandrilg ray”);edges, counts = imhist(img,256);
Given a color image, compute the hisogram of the red channel.
[] img = testimage(”mandrill”) r = red(img) edges, counts = imhist(r,256);
References
[1] E. Herrholz, “Parsimonious Histograms,” Ph.D. dissertation, Inst. of
Math. and Comp. Sci., University of Greifswald, Greifswald, Germany, 2011.
source
5.34. IMAGES.IMSTRETCH 159
5.34 Images.imstretch
Images.imstretch — Method.
imgs = imstretch(img, m, slope) enhances or reduces (for slope > 1 or
< 1, respectively) the contrast near saturation (0 and 1). This is essentially a
symmetric gamma-correction. For a pixel of brightness p, the new intensity is
1/(1+(m/(p+eps))^slope).
This assumes the input img has intensities between 0 and 1.
source
integral_img = integral_image(img)
Find the connected components in a binary array tf. There are two forms
that connectivity can take:
along each dimension. Each entry in the array determines whether a given
neighbor is used for connectivity analyses. For example, connectivity = trues(3,3)
would use 8-connectivity and test all pixels that touch the current one, even the
corners.
determine connectivity. For example, region = [1,3] would not test neigh-
bors along dimension 2 for connectivity. This corresponds to just the nearest
neighbors, i.e., 4-connectivity in 2d and 6-connectivity in 3d.
The default is region = 1:ndims(A).
The output label is an integer array, where 0 is used for background pixels,
and each connected region gets a different integer index.
source
5.38 Images.magnitude
Images.magnitude — Method.
m = magnitude(grad_x, grad_y)
Calculates the magnitude of the gradient images given by grad x and grad y.
Equivalent to sqrt(gradx .2 + grady .2 ).
Returns a magnitude image the same size as grad x and grad y.
source
Convenience function for calculating the magnitude and phase of the gradient
images given in grad x and grad y. Returns a tuple containing the magnitude
and phase images. See magnitude and phase for details.
source
5.40 Images.maxabsfinite
Images.maxabsfinite — Method.
m = maxabsfinite(A) calculates the maximum absolute value in A, ignoring
any values that are not finite (Inf or NaN).
source
5.41. IMAGES.MAXFINITE 161
5.41 Images.maxfinite
Images.maxfinite — Method.
m = maxfinite(A) calculates the maximum value in A, ignoring any values
that are not finite (Inf or NaN).
source
5.42 Images.meanfinite
Images.meanfinite — Method.
M = meanfinite(img, region) calculates the mean value along the dimen-
sions listed in region, ignoring any non-finite values.
source
5.43 Images.minfinite
Images.minfinite — Method.
m = minfinite(A) calculates the minimum value in A, ignoring any values
that are not finite (Inf or NaN).
source
5.44 Images.ncc
Images.ncc — Method.
C = ncc(A, B) computes the normalized cross-correlation of A and B.
source
5.45 Images.orientation
Images.orientation — Method.
Calculate the orientation angle of the strongest edge from gradient images
given by grad x and grad y. Equivalent to atan2(grad x, grad y). When
both grad x and grad y are effectively zero, the corresponding angle is set to
zero.
source
thres = otsu_threshold(img)
thres = otsu_threshold(img, bins)
source
5.47 Images.phase
Images.phase — Method.
Calculate the rotation angle of the gradient given by grad x and grad y.
Equivalent to atan2(-grad y, grad x), except that when both grad x and
grad y are effectively zero, the corresponding angle is set to zero.
source
5.48 Images.sad
Images.sad — Method.
s = sad(A, B) computes the sum-of-absolute differences over arrays/images
A and B
source
5.49 Images.sadn
Images.sadn — Method.
s = sadn(A, B) computes the sum-of-absolute differences over arrays/images
A and B, normalized by array size
source
output the NxM Shepp-Logan phantom, which is a standard test image usu-
ally used for comparing image reconstruction algorithms in the field of computed
tomography (CT) and magnetic resonance imaging (MRI). If the argument M
is omitted, the phantom is of size NxN. When setting the keyword argument
highConstrast to false, the CT version of the phantom is created. Otherwise,
the high contrast MRI version is calculated.
source
Performs Shi Tomasi corner detection. The covariances can be taken using
either a mean weighted filter or a gamma kernel.
source
5.52 Images.ssd
Images.ssd — Method.
s = ssd(A, B) computes the sum-of-squared differences over arrays/images
A and B
source
5.53 Images.ssdn
Images.ssdn — Method.
s = ssdn(A, B) computes the sum-of-squared differences over arrays/images
A and B, normalized by array size
source
Edge thinning for 2D edge images. Currently the only algorithm available
is non-maximal suppression, which takes an edge image and its gradient angle,
164 CHAPTER 5. IMAGES
and checks each edge point for local maximality in the direction of the gradient.
The returned image is non-zero only at maximal edge locations.
border is any of the boundary conditions specified in padarray.
In addition to the maximal edge image, the subpix versions of these func-
tions also return an estimate of the subpixel location of each local maxima, as a
2D array or image of Graphics.Point objects. Additionally, each local maxima
is adjusted to the estimated value at the subpixel location.
Currently, the nonmaxsup functions are identical to the first two function
calls, except that they also accept additional keyword arguments. radius indi-
cates the step size to use when searching in the direction of the gradient; values
between 1.2 and 1.5 are suggested (default 1.35). theta indicates the step size
to use when discretizing angles in the gradientangle image, in radians (default:
1 degree in radians = pi/180).
Example:
g = rgb2gray(rgb_image)
gx, gy = imgradients(g)
mag, grad_angle = magnitude_phase(gx,gy)
mag[mag .< 0.5] = 0.0 # Threshold magnitude image
thinned, subpix = thin_edges_subpix(mag, grad_angle)
source
thres = yen_threshold(img)
thres = yen_threshold(img, bins)
DataFrames
6.1 Base.insert!
Base.insert! — Method.
Insert a column into a data frame in place.
[] insert!(df::DataFrame, coli nd :: Int, item ::AbstractV ector, name ::Symbol;makeunique ::Bool= f alse)
Arguments
Result
Examples
julia> d = DataFrame(a=1:3)
31 DataFrames.DataFrame
Row a
1 1
2 2
3 3
165
166 CHAPTER 6. DATAFRAMES
1 ’a’ 1
2 ’b’ 2
3 ’c’ 3
source
6.2 Base.vcat
Base.vcat — Method.
vcat(dfs::AbstractDataFrame...)
1 1 1
2 2 2
3 3 3
4 4 4
5 5 5
6 6 6
1 1 1
2 2 2
3 3 3
6.3. DATAFRAMES.AGGREGATE 167
4 4 4
5 5 5
6 6 6
source
6.3 DataFrames.aggregate
DataFrames.aggregate — Method.
Split-apply-combine that applies a set of functions over columns of an Ab-
stractDataFrame or GroupedDataFrame
[] aggregate(d::AbstractDataFrame, cols, fs) aggregate(gd::GroupedDataFrame,
fs)
Arguments
• d : an AbstractDataFrame
• gd : a GroupedDataFrame
Each fs should return a value or vector. All returns must be the same
length.
Returns
• ::DataFrame
Examples
[] df = DataFrame(a = repeat([1, 2, 3, 4], outer=[2]), b = repeat([2, 1],
outer=[4]), c = randn(8)) aggregate(df, :a, sum) aggregate(df, :a, [sum, x-
¿mean(skipmissing(x))]) aggregate(groupby(df, :a), [sum, x-¿mean(skipmissing(x))])
source
6.4 DataFrames.allowmissing!
DataFrames.allowmissing! — Function.
allowmissing!(df::DataFrame)
6.5 DataFrames.by
DataFrames.by — Method.
Split-apply-combine in one step; apply f to each grouping in d based on
columns col
[] by(d::AbstractDataFrame, cols, f::Function; sort::Bool = false) by(f::Function,
d::AbstractDataFrame, cols; sort::Bool = false)
Arguments
• d : an AbstractDataFrame
• ::DataFrame
Examples
[] df = DataFrame(a = repeat([1, 2, 3, 4], outer=[2]), b = repeat([2,
1], outer=[4]), c = randn(8)) by(df, :a, d -¿ sum(d[:c])) by(df, :a, d -¿ 2 *
skipmissing(d[:c])) by(df, :a, d -¿ DataFrame(cs um = sum(d[: c]), cm ean =
mean(skipmissing(d[: c]))))by(df, : a, d− > DataF rame(c = d[: c], cm ean = mean(skipmissing(d[: c])))
source
6.6. DATAFRAMES.COLWISE 169
6.6 DataFrames.colwise
DataFrames.colwise — Method.
Apply a function to each column in an AbstractDataFrame or Grouped-
DataFrame
[] colwise(f::Function, d) colwise(d)
Arguments
• d : an AbstractDataFrame of GroupedDataFrame
Examples
[] df = DataFrame(a = repeat([1, 2, 3, 4], outer=[2]), b = repeat([2, 1],
outer=[4]), c = randn(8)) colwise(sum, df) colwise([sum, length], df) col-
wise((minimum, maximum), df) colwise(sum, groupby(df, :a))
source
6.7 DataFrames.combine
DataFrames.combine — Method.
Combine a GroupApplied object (rudimentary)
[] combine(ga::GroupApplied)
Arguments
• ga : a GroupApplied
Returns
• ::DataFrame
Examples
[] df = DataFrame(a = repeat([1, 2, 3, 4], outer=[2]), b = repeat([2, 1],
outer=[4]), c = randn(8)) gd = groupby(df, :a) combine(map(d -¿ mean(skipmissing(d[:c])),
gd))
source
170 CHAPTER 6. DATAFRAMES
6.8 DataFrames.completecases
DataFrames.completecases — Method.
Indexes of complete cases (rows without missing values)
[] completecases(df::AbstractDataFrame)
Arguments
• df : the AbstractDataFrame
Result
6.9 DataFrames.disallowmissing!
DataFrames.disallowmissing! — Function.
disallowmissing!(df::DataFrame)
6.10 DataFrames.dropmissing!
DataFrames.dropmissing! — Method.
Remove rows with missing values in-place.
[] dropmissing!(df::AbstractDataFrame)
Arguments
6.11. DATAFRAMES.DROPMISSING 171
• df : the AbstractDataFrame
Result
6.11 DataFrames.dropmissing
DataFrames.dropmissing — Method.
Remove rows with missing values.
[] dropmissing(df::AbstractDataFrame)
Arguments
• df : the AbstractDataFrame
Result
6.12 DataFrames.eachrow
DataFrames.eachrow — Method.
6.13 DataFrames.eltypes
DataFrames.eltypes — Method.
Return element types of columns
[] eltypes(df::AbstractDataFrame)
Arguments
• df : the AbstractDataFrame
Result
Examples
[] df = DataFrame(i = 1:10, x = rand(10), y = rand([”a”, ”b”, ”c”], 10))
eltypes(df)
source
6.14 DataFrames.groupby
DataFrames.groupby — Method.
A view of an AbstractDataFrame split into row groups
[] groupby(d::AbstractDataFrame, cols; sort = false, skipmissing = false)
groupby(cols; sort = false, skipmissing = false)
Arguments
Returns
Details
An iterator over a GroupedDataFrame returns a SubDataFrame view for each
grouping into d. A GroupedDataFrame also supports indexing by groups and
map.
See the following for additional split-apply-combine operations:
Examples
[] df = DataFrame(a = repeat([1, 2, 3, 4], outer=[2]), b = repeat([2, 1],
outer=[4]), c = randn(8)) gd = groupby(df, :a) gd[1] last(gd) vcat([g[:b] for g in
gd]...) for g in gd println(g) end map(d -¿ mean(skipmissing(d[:c])), gd) returns
a GroupApplied object combine(map(d -¿ mean(skipmissing(d[:c])), gd))
source
6.15 DataFrames.head
DataFrames.head — Function.
Show the first or last part of an AbstractDataFrame
[] head(df::AbstractDataFrame, r::Int = 6) tail(df::AbstractDataFrame, r::Int
= 6)
Arguments
• df : the AbstractDataFrame
• r : the number of rows to show
Result
Examples
[] df = DataFrame(i = 1:10, x = rand(10), y = rand([”a”, ”b”, ”c”], 10))
head(df) tail(df)
source
6.16 DataFrames.melt
DataFrames.melt — Method.
Stacks a DataFrame; convert from a wide to long format; see stack.
source
6.17 DataFrames.meltdf
DataFrames.meltdf — Method.
A stacked view of a DataFrame (long format); see stackdf
source
174 CHAPTER 6. DATAFRAMES
6.18 DataFrames.names!
DataFrames.names! — Method.
Set column names
[] names!(df::AbstractDataFrame, vals)
Arguments
• df : the AbstractDataFrame
• vals : column names, normally a Vector{Symbol} the same length as the
number of columns in df
• makeunique : if false (the default), an error will be raised if duplicate
names are found; if true, duplicate names will be suffixed with i (i
starting at 1 for the first duplicate).
Result
Examples
[] df = DataFrame(i = 1:10, x = rand(10), y = rand([”a”, ”b”, ”c”], 10))
names!(df, [:a, :b, :c]) names!(df, [:a, :b, :a]) throws ArgumentError names!(df,
[:a, :b, :a], makeunique=true) renames second :a to :a1
source
6.19 DataFrames.nonunique
DataFrames.nonunique — Method.
Indexes of duplicate rows (a row that is a duplicate of a prior row)
[] nonunique(df::AbstractDataFrame) nonunique(df::AbstractDataFrame, cols)
Arguments
• df : the AbstractDataFrame
• cols : a column indicator (Symbol, Int, Vector{Symbol}, etc.) specifying
the column(s) to compare
Result
6.20 DataFrames.readtable
DataFrames.readtable — Method.
Read data from a tabular-file format (CSV, TSV, . . . )
[] readtable(filename, [keyword options])
Arguments
Keyword Arguments
• header::Bool – Use the information from the file’s header line to deter-
mine column names. Defaults to true.
• nrows::Int – Read only nrows from the file. Defaults to -1, which indi-
cates that the entire file should be read.
Result
• ::DataFrame
Examples
[] df = readtable(”data.csv”) df = readtable(”data.tsv”) df = readtable(”data.wsv”)
df = readtable(”data.txt”, separator = ’ ’) df = readtable(”data.txt”, header =
false)
source
6.21 DataFrames.rename
DataFrames.rename — Function.
Rename columns
[] rename!(df::AbstractDataFrame, (from =¿ to)::Pair{Symbol, Symbol}...)
rename!(df::AbstractDataFrame, d::AbstractDict{Symbol,Symbol}) rename!(df::AbstractDataFrame,
d::AbstractArray{Pair{Symbol,Symbol}}) rename!(f::Function, df::AbstractDataFrame)
rename(df::AbstractDataFrame, (from =¿ to)::Pair{Symbol, Symbol}...) re-
name(df::AbstractDataFrame, d::AbstractDict{Symbol,Symbol}) rename(df::AbstractDataFrame,
d::AbstractArray{Pair{Symbol,Symbol}}) rename(f::Function, df::AbstractDataFrame)
Arguments
• df : the AbstractDataFrame
• d : an Associative type or an AbstractArray of pairs that maps the original
names to new names
6.22. DATAFRAMES.RENAME! 177
• f : a function which for each column takes the old name (a Symbol) and
returns the new name (a Symbol)
Result
• ::AbstractDataFrame : the updated result
New names are processed sequentially. A new name must not already exist
in the DataFrame at the moment an attempt to rename a column is performed.
Examples
[] df = DataFrame(i = 1:10, x = rand(10), y = rand([”a”, ”b”, ”c”], 10))
rename(df, :i =¿ :A, :x =¿ :X) rename(df, [:i =¿ :A, :x =¿ :X]) rename(df, Dict(:i
=¿ :A, :x =¿ :X)) rename(x -¿ Symbol(uppercase(string(x))), df) rename!(df,
Dict(:i =¿: A, :x =¿ :X))
source
6.22 DataFrames.rename!
DataFrames.rename! — Function.
Rename columns
[] rename!(df::AbstractDataFrame, (from =¿ to)::Pair{Symbol, Symbol}...)
rename!(df::AbstractDataFrame, d::AbstractDict{Symbol,Symbol}) rename!(df::AbstractDataFrame,
d::AbstractArray{Pair{Symbol,Symbol}}) rename!(f::Function, df::AbstractDataFrame)
rename(df::AbstractDataFrame, (from =¿ to)::Pair{Symbol, Symbol}...) re-
name(df::AbstractDataFrame, d::AbstractDict{Symbol,Symbol}) rename(df::AbstractDataFrame,
d::AbstractArray{Pair{Symbol,Symbol}}) rename(f::Function, df::AbstractDataFrame)
Arguments
• df : the AbstractDataFrame
• d : an Associative type or an AbstractArray of pairs that maps the original
names to new names
• f : a function which for each column takes the old name (a Symbol) and
returns the new name (a Symbol)
Result
• ::AbstractDataFrame : the updated result
New names are processed sequentially. A new name must not already exist
in the DataFrame at the moment an attempt to rename a column is performed.
Examples
[] df = DataFrame(i = 1:10, x = rand(10), y = rand([”a”, ”b”, ”c”], 10))
rename(df, :i =¿ :A, :x =¿ :X) rename(df, [:i =¿ :A, :x =¿ :X]) rename(df, Dict(:i
=¿ :A, :x =¿ :X)) rename(x -¿ Symbol(uppercase(string(x))), df) rename!(df,
Dict(:i =¿: A, :x =¿ :X))
source
178 CHAPTER 6. DATAFRAMES
6.23 DataFrames.stack
DataFrames.stack — Method.
Stacks a DataFrame; convert from a wide to long format
[] stack(df::AbstractDataFrame, [measurev ars], [idv ars]; variablen ame ::Symbol=: variable, valuen am
Arguments
• variable name : the name of the new stacked column that shall hold the
names of each of measure vars
• value name : the name of the new stacked column containing the values
from each of measure vars
Result
See also stackdf and meltdf for stacking methods that return a view into
the original DataFrame. See unstack for converting from long to wide format.
Examples
[] d1 = DataFrame(a = repeat([1:3;], inner = [4]), b = repeat([1:4;], inner
= [3]), c = randn(12), d = randn(12), e = map(string, ’a’:’l’))
d1s = stack(d1, [:c, :d]) d1s2 = stack(d1, [:c, :d], [:a]) d1m = melt(d1, [:a,
:b, :e]) d1sn ame = melt(d1, [: a, : b, : e], variablen ame =: somemeasure)
source
6.24 DataFrames.stackdf
DataFrames.stackdf — Method.
A stacked view of a DataFrame (long format)
Like stack and melt, but a view is returned rather than data copies.
6.25. DATAFRAMES.TAIL 179
[] stackdf(df::AbstractDataFrame, [measurev ars], [idv ars]; variablen ame ::Symbol=: variable, valuen ame ::Symbo
Arguments
• df : the wide AbstractDataFrame
• measure vars : the columns to be stacked (the measurement variables),
a normal column indexing type, like a Symbol, Vector{Symbol}, Int, etc.;
for melt, defaults to all variables that are not id vars
• id vars : the identifier columns that are repeated during stacking, a
normal column indexing type; for stack defaults to all variables that are
not measure vars
Result
• ::DataFrame : the long-format DataFrame with column :value holding
the values of the stacked columns (measure vars), with column :variable
a Vector of Symbols with the measure vars name, and with columns for
each of the id vars.
The result is a view because the columns are special AbstractVectors that
return indexed views into the original DataFrame.
Examples
[] d1 = DataFrame(a = repeat([1:3;], inner = [4]), b = repeat([1:4;], inner
= [3]), c = randn(12), d = randn(12), e = map(string, ’a’:’l’))
d1s = stackdf(d1, [:c, :d]) d1s2 = stackdf(d1, [:c, :d], [:a]) d1m = meltdf(d1,
[:a, :b, :e])
source
6.25 DataFrames.tail
DataFrames.tail — Function.
Show the first or last part of an AbstractDataFrame
[] head(df::AbstractDataFrame, r::Int = 6) tail(df::AbstractDataFrame, r::Int
= 6)
Arguments
• df : the AbstractDataFrame
• r : the number of rows to show
Result
• ::AbstractDataFrame : the first or last part of df
Examples
[] df = DataFrame(i = 1:10, x = rand(10), y = rand([”a”, ”b”, ”c”], 10))
head(df) tail(df)
source
180 CHAPTER 6. DATAFRAMES
6.26 DataFrames.unique!
DataFrames.unique! — Function.
Delete duplicate rows
[] unique(df::AbstractDataFrame) unique(df::AbstractDataFrame, cols) unique!(df::AbstractDataFram
unique!(df::AbstractDataFrame, cols)
Arguments
• df : the AbstractDataFrame
• cols : column indicator (Symbol, Int, Vector{Symbol}, etc.)
When cols is specified, the return DataFrame contains complete rows, re-
taining in each case the first instance for which df[cols] is unique.
See also nonunique.
Examples
[] df = DataFrame(i = 1:10, x = rand(10), y = rand([”a”, ”b”, ”c”], 10)) df
= vcat(df, df) unique(df) doesn’t modify df unique(df, 1) unique!(df) modifies
df
source
6.27 DataFrames.unstack
DataFrames.unstack — Method.
Unstacks a DataFrame; convert from a long to wide format
[] unstack(df::AbstractDataFrame, rowkeys::Union{Symbol, Integer}, colkey::Union{Symbol,
Integer}, value::Union{Symbol, Integer}) unstack(df::AbstractDataFrame, rowkeys::AbstractVector{¡:Un
Integer}}, colkey::Union{Symbol, Integer}, value::Union{Symbol, Integer}) un-
stack(df::AbstractDataFrame, colkey::Union{Symbol, Integer}, value::Union{Symbol,
Integer}) unstack(df::AbstractDataFrame)
Arguments
Result
6.28. DATAFRAMES.WRITETABLE 181
6.28 DataFrames.writetable
DataFrames.writetable — Method.
Write data to a tabular-file format (CSV, TSV, . . . )
[] writetable(filename, df, [keyword options])
Arguments
• filename::AbstractString : the filename to be created
• df::AbstractDataFrame : the AbstractDataFrame to be written
Keyword Arguments
• separator::Char – The separator character that you would like to use.
Defaults to the output of getseparator(filename), which uses commas
for files that end in .csv, tabs for files that end in .tsv and a single space
for files that end in .wsv.
• quotemark::Char – The character used to delimit string fields. Defaults
to ".
• header::Bool – Should the file contain a header that specifies the column
names from df. Defaults to true.
• nastring::AbstractString – What to write in place of missing data.
Defaults to "NA".
Result
• ::DataFrame
Examples
[] df = DataFrame(A = 1:10) writetable(”output.csv”, df) writetable(”output.dat”,
df, separator = ’,’, header = false) writetable(”output.dat”, df, quotemark =
”’, separator = ’,’) writetable(”output.dat”, df, header = false)
source
182 CHAPTER 6. DATAFRAMES
6.29 StatsBase.describe
StatsBase.describe — Method.
Summarize the columns of an AbstractDataFrame
[] describe(df::AbstractDataFrame) describe(io, df::AbstractDataFrame)
Arguments
• df : the AbstractDataFrame
• io : optional output descriptor
Result
• nothing
Details
If the column’s base type derives from Number, compute the minimum, first
quantile, median, mean, third quantile, and maximum. Missings are filtered
and reported separately.
For boolean columns, report trues, falses, and missings.
For other types, show column characteristics and number of missings.
Examples
[] df = DataFrame(i = 1:10, x = rand(10), y = rand([”a”, ”b”, ”c”], 10))
describe(df)
source
Chapter 7
Knet
7.1 Knet.accuracy
Knet.accuracy — Method.
7.2 Knet.accuracy
Knet.accuracy — Method.
7.3 Knet.batchnorm
Knet.batchnorm — Function.
batchnorm(x[, moments, params]; kwargs...) performs batch normal-
ization to x with optional scaling factor and bias stored in params.
2d, 4d and 5d inputs are supported. Mean and variance are computed over
dimensions (2,), (1,2,4) and (1,2,3,5) for 2d, 4d and 5d arrays, respectively.
183
184 CHAPTER 7. KNET
# Inilization, C is an integer
moments = bnmoments()
params = bnparams(C)
...
# size(x) -> (H, W, C, N)
y = batchnorm(x, moments, params)
# size(y) -> (H, W, C, N)
Keywords
eps=1e-5: The epsilon parameter added to the variance to avoid division by
0.
training: When training is true, the mean and variance of x are used and
moments argument is modified if it is provided. When training is false, mean
and variance stored in the moments argument are used. Default value is true
when at least one of x and params is AutoGrad.Rec, false otherwise.
source
7.4 Knet.bilinear
Knet.bilinear — Method.
Bilinear interpolation filter weights; used for initializing deconvolution layers.
Adapted from https://github.com/shelhamer/fcn.berkeleyvision.org/blob/master/surgery.py#L33
Arguments:
T : Data Type
fw: Width upscale factor
fh: Height upscale factor
IN: Number of input filters
ON: Number of output filters
Example usage:
w = bilinear(Float32,2,2,128,128)
source
7.5 Knet.bnmoments
Knet.bnmoments — Method.
bnmoments(;momentum=0.1, mean=nothing, var=nothing, meaninit=zeros,
varinit=ones) can be used directly load moments from data. meaninit and
varinit are called if mean and var are nothing. Type and size of the mean and
7.6. KNET.BNPARAMS 185
var are determined automatically from the inputs in the batchnorm calls. A
BNMoments object is returned.
BNMoments
A high-level data structure used to store running mean and running variance
of batch normalization with the following fields:
momentum::AbstractFloat: A real number between 0 and 1 to be used as
the scale of last mean and variance. The existing running mean or variance is
multiplied by (1-momentum).
mean: The running mean.
var: The running variance.
meaninit: The function used for initialize the running mean. Should either
be nothing or of the form (eltype, dims...)->data. zeros is a good option.
varinit: The function used for initialize the running variance. Should either
be nothing or (eltype, dims...)->data. ones is a good option.
source
7.6 Knet.bnparams
Knet.bnparams — Method.
bnparams(etype, channels) creates a single 1d array that contains both
scale and bias of batchnorm, where the first half is scale and the second half is
bias.
bnparams(channels) calls bnparams with etype=Float64, following Julia
convention
source
7.7 Knet.conv4
Knet.conv4 — Method.
conv4(w, x; kwargs...)
Yi=1+floor((Xi+2*padding[i]-Wi)/stride[i])
source
7.8 Knet.deconv4
Knet.deconv4 — Method.
y = deconv4(w, x; kwargs...)
7.9 Knet.dropout
Knet.dropout — Method.
dropout(x, p)
Given an array x and probability 0<=p<=1, just return x if p==0, or re-
turn an array y in which each element is 0 with probability p or x[i]/(1-p)
with probability 1-p. Use seed::Number to set the random number seed for
reproducible results. See (Srivastava et al. 2014) for a reference.
source
7.10 Knet.gaussian
Knet.gaussian — Method.
gaussian(a...; mean=0.0, std=0.01)
Return a Gaussian array with a given mean and standard deviation. The a
arguments are passed to randn.
source
7.11 Knet.goldensection
Knet.goldensection — Method.
goldensection(f,n;kwargs) => (fmin,xmin)
Find the minimum of f using concurrent golden section search in n dimen-
sions. See Knet.goldensection demo() for an example.
f is a function from a Vector{Float64} of length n to a Number. It can
return NaN for out of range inputs. Goldensection will always start with a
zero vector as the initial input to f, and the initial step size will be 1 in each
dimension. The user should define f to scale and shift this input range into a
vector meaningful for their application. For positive inputs like learning rate or
hidden size, you can use a transformation such as x0*exp(x) where x is a value
goldensection passes to f and x0 is your initial guess for this value. This will
effectively start the search at x0, then move with multiplicative steps.
I designed this algorithm combining ideas from Golden Section Search and
Hill Climbing Search. It essentially runs golden section search concurrently in
each dimension, picking the next step based on estimated gain.
Keyword arguments
188 CHAPTER 7. KNET
7.12 Knet.gpu
Knet.gpu — Function.
gpu() returns the id of the active GPU device or -1 if none are active.
gpu(true) resets all GPU devices and activates the one with the most avail-
able memory.
gpu(false) resets and deactivates all GPU devices.
gpu(d::Int) activates the GPU device d if 0 <= d < gpuCount(), other-
wise deactivates devices.
gpu(true/false) resets all devices. If there are any allocated KnetArrays
their pointers will be left dangling. Thus gpu(true/false) should only be used
during startup. If you want to suspend GPU use temporarily, use gpu(-1).
gpu(d::Int) does not reset the devices. You can select a previous device
and find allocated memory preserved. However trying to operate on arrays of
an inactive device will result in error.
source
7.13 Knet.hyperband
Knet.hyperband — Function.
hyperband(getconfig, getloss, maxresource=27, reduction=3)
Hyperparameter optimization using the hyperband algorithm from (Lisha et
al. 2016). You can try a simple MNIST example using Knet.hyperband demo().
Arguments
• getconfig() returns random configurations with a user defined type and
distribution.
• getloss(c,n) returns loss for configuration c and number of resources
(e.g. epochs) n.
• maxresource is the maximum number of resources any one configuration
should be given.
• reduction is an algorithm parameter (see paper), 3 is a good value.
source
7.14. KNET.INVX 189
7.14 Knet.invx
Knet.invx — Function.
invx(x) = (1./x)
source
7.15 Knet.knetgc
Knet.knetgc — Function.
knetgc(dev=gpu())
cudaFree all pointers allocated on device dev that were previously allocated
and garbage collected. Normally Knet holds on to all garbage collected pointers
for reuse. Try this if you run out of GPU memory.
source
7.16 Knet.logp
Knet.logp — Method.
logp(x,[dims])
7.17 Knet.logsumexp
Knet.logsumexp — Method.
logsumexp(x,[dims])
7.18 Knet.mat
Knet.mat — Method.
mat(x)
Reshape x into a two-dimensional matrix.
This is typically used when turning the output of a 4-D convolution re-
sult into a 2-D input for a fully connected layer. For 1-D inputs returns
reshape(x, (length(x),1)). For inputs with more than two dimensions of
size (X1,X2,...,XD), returns
reshape(x, (X1*X2*...*X[D-1],XD))
source
7.19 Knet.minibatch
Knet.minibatch — Method.
minibatch(x, y, batchsize; shuffle, partial, xtype, ytype)
Return an iterable of minibatches [(xi,yi). . . ] given data tensors x, y and
batchsize. The last dimension of x and y should match and give the number of
instances. Keyword arguments:
• shuffle=false: Shuffle the instances before minibatching.
• partial=false: If true include the last partial minibatch < batchsize.
• xtype=typeof(x): Convert xi in minibatches to this type.
• ytype=typeof(y): Convert yi in minibatches to this type.
source
7.20 Knet.minibatch
Knet.minibatch — Method.
minibatch(x, batchsize; shuffle, partial, xtype, ytype)
Return an iterable of minibatches [x1,x2,. . . ] given data tensor x and batch-
size. The last dimension of x gives the number of instances. Keyword arguments:
• shuffle=false: Shuffle the instances before minibatching.
• partial=false: If true include the last partial minibatch < batchsize.
• xtype=typeof(x): Convert xi in minibatches to this type.
source
7.21. KNET.NLL 191
7.21 Knet.nll
Knet.nll — Method.
nll(model, data, predict; average=true)
Compute nll(predict(model,x), y) for (x,y) in data and return the
per-instance average (if average=true) or total (if average=false) negative log
likelihood.
source
7.22 Knet.nll
Knet.nll — Method.
nll(scores, answers, d=1; average=true)
Given an unnormalized scores matrix and an Integer array of correct
answers, return the per-instance negative log likelihood. d=1 means instances
are in columns, d=2 means instances are in rows. Use average=false to return
the sum instead of per-instance average.
source
7.23 Knet.optimizers
Knet.optimizers — Method.
optimizers(model, otype; options...)
Given parameters of a model, initialize and return corresponding optimiza-
tion parameters for a given optimization type otype and optimization options
options. This is useful because each numeric array in model needs its own dis-
tinct optimization parameter. optimizers makes the creation of optimization
parameters that parallel model parameters easy when all of them use the same
type and options.
source
7.24 Knet.pool
Knet.pool — Method.
pool(x; kwargs...)
Compute pooling of input values (i.e., the maximum or average of several
adjacent values) to produce an output with smaller height and/or width.
Currently 4 or 5 dimensional KnetArrays with Float32 or Float64 entries
are supported. If x has dimensions (X1,X2,...,I,N), the result y will have
dimensions (Y1,Y2,...,I,N) where
192 CHAPTER 7. KNET
Yi=1+floor((Xi+2*padding[i]-window[i])/stride[i])
source
7.25 Knet.relu
Knet.relu — Function.
relu(x) = max(0,x)
source
7.26 Knet.rnnforw
Knet.rnnforw — Method.
The boolean keyword arguments hy and cy control whether hyout and cyout
will be output. By default hy = (hx!=nothing) and cy = (cx!=nothing &&
r.mode==2), i.e. a hidden state will be output if one is provided as input and
for cell state we also require an LSTM. If hy/cy is false, hyout/cyout will be
nothing. batchSizes can be an integer array that specifies non-uniform batch
sizes as explained below. By default batchSizes=nothing and the same batch
size, size(x,2), is used for all time steps.
The input and output dimensions are:
• x: (X,[B,T])
• y: (H/2H,[B,T])
• hx,cx,hyout,cyout: (H,B,L/2L)
• batchSizes: nothing or Vector{Int}(T)
7.27 Knet.rnninit
Knet.rnninit — Method.
Return an (r,w) pair where r is a RNN struct and w is a single weight array
that includes all matrices and biases for the RNN. Keyword arguments:
RNNs compute the output h[t] for a given iteration from the recurrent input
h[t-1] and the previous layer input x[t] given matrices W, R and biases bW, bR
from the following equations:
:relu and :tanh: Single gate RNN with activation function f:
source
7.28 Knet.rnnparam
Knet.rnnparam — Method.
Valid id values:
7.29. KNET.RNNPARAMS 195
• For GRU reset = 1,4; update = 2,5; newmem = 3,6; 1:3 for input, 4:6 for
hidden
• For LSTM inputgate = 1,5; forget = 2,6; newmem = 3,7; output = 4,8;
1:4 for input, 5:8 for hidden
The effect of skipInput: Let I=1 for RELU/TANH, 1:3 for GRU, 1:4 for
LSTM
source
7.29 Knet.rnnparams
Knet.rnnparams — Method.
rnnparams(r::RNN, w)
source
196 CHAPTER 7. KNET
7.30 Knet.setseed
Knet.setseed — Method.
setseed(n::Integer)
7.31 Knet.sigm
Knet.sigm — Function.
sigm(x) = (1./(1+exp(-x)))
source
7.32 Knet.unpool
Knet.unpool — Method.
Unpooling; reverse of pooling.
x == pool(unpool(x;o...); o...)
source
7.33 Knet.update!
Knet.update! — Function.
Update the weights using their gradients and the optimization algorithm
parameters specified by params. The 2-arg version defaults to the Sgd algorithm
with learning rate lr and gradient clip gclip. gclip==0 indicates no clipping.
The weights and possibly gradients and params are modified in-place.
weights can be an individual numeric array or a collection of arrays repre-
sented by an iterator or dictionary. In the individual case, gradients should
be a similar numeric array of size(weights) and params should be a single
object. In the collection case, each individual weight array should have a cor-
responding params object. This way different weight arrays can have their own
optimization state, different learning rates, or even different optimization algo-
rithms running in parallel. In the iterator case, gradients and params should
be iterators of the same length as weights with corresponding elements. In the
dictionary case, gradients and params should be dictionaries with the same
keys as weights.
7.34. KNET.XAVIER 197
• Sgd(;lr=0.001, gclip=0)
Example:
source
7.34 Knet.xavier
Knet.xavier — Method.
xavier(a...)
198 CHAPTER 7. KNET
BinaryProvider
8.1 Base.merge
Base.merge — Method.
merge(collector::OutputCollector; colored::Bool = false)
Merge the stdout and stderr streams of the OutputCollector on a per-
line basis, returning a single string containing all collected lines, interleaved by
capture time. If colored is set to true, embeds terminal color codes to print
stderr in red.
source
8.2 BinaryProvider.activate
BinaryProvider.activate — Method.
activate(prefix::Prefix)
Prepends paths to environment variables so that binaries and libraries are
available to Julia.
source
8.3 BinaryProvider.activate
BinaryProvider.activate — Method.
activate(func::Function, prefix::Prefix)
Prepends paths to environment variables so that binaries and libraries are
available to Julia, calls the user function func, then deactivate()’s the ‘prefix“
again.
source
199
200 CHAPTER 8. BINARYPROVIDER
8.4 BinaryProvider.arch
BinaryProvider.arch — Method.
arch(p::Platform)
julia> arch(Linux(:aarch64))
:aarch64
julia> arch(MacOS())
:x86_64
source
8.5 BinaryProvider.bindir
BinaryProvider.bindir — Method.
bindir(prefix::Prefix)
collect_stderr(collector::OutputCollector)
collect_stdout(collector::OutputCollector)
8.8 BinaryProvider.deactivate
BinaryProvider.deactivate — Method.
deactivate(prefix::Prefix)
download_verify(url::AbstractString, hash::AbstractString,
dest::AbstractString; verbose::Bool = false,
force::Bool = false, quiet_download::Bool = false)
Download file located at url, verify it matches the given hash, and throw
an error if anything goes wrong. If dest already exists, just verify it. If force
is set to true, overwrite the given file if it exists but does not match the given
hash.
This method returns true if the file was downloaded successfully, false if
an existing file was removed due to the use of force, and throws an error if
force is not set and the already-existent file fails verification, or if force is set,
verification fails, and then verification fails again after redownloading the file.
If quiet download is set to false (the default), this method will print to
stdout when downloading a new file. If it is set to true (and verbose is set
to false) the downloading process will be completely silent. If verbose is set
to true, messages about integrity verification will be printed in addition to
messages regarding downloading.
source
download_verify_unpack(url::AbstractString, hash::AbstractString,
dest::AbstractString; verbose::Bool = false,
force::Bool = false)
extract_platform_key(path::AbstractString)
Given the path to a tarball, return the platform key of that tarball. If none
can be found, prints a warning and return the current platform suffix.
source
gen_download_cmd(url::AbstractString, out_path::AbstractString)
Return a Cmd that will download resource located at url and store it at the
location given by out path.
This method is initialized by probe platform engines(), which should be
automatically called upon first import of BinaryProvider.
source
gen_list_tarball_cmd(tarball_path::AbstractString)
Return a Cmd that will list the files contained within the tarball located at
tarball path. The list will not include directories contained within the tarball.
This method is initialized by probe platform engines(), which should be
automatically called upon first import of BinaryProvider.
source
8.14. BINARYPROVIDER.GEN PACKAGE CMD 203
gen_package_cmd(in_path::AbstractString, tarball_path::AbstractString)
Return a Cmd that will package up the given in path directory into a tarball
located at tarball path.
This method is initialized by probe platform engines(), which should be
automatically called upon first import of BinaryProvider.
source
gen_sh_cmd(cmd::Cmd)
Runs a command using sh. On Unices, this will default to the first sh found
on the PATH, however on Windows if that is not found it will fall back to the sh
provided by the busybox.exe shipped with Julia.
This method is initialized by probe platform engines(), which should be
automatically called upon first import of BinaryProvider.
source
gen_unpack_cmd(tarball_path::AbstractString, out_path::AbstractString)
Return a Cmd that will unpack the given tarball path into the given out path.
If out path is not already a directory, it will be created.
This method is initialized by probe platform engines(), which should be
automatically called upon first import of BinaryProvider.
source
8.17 BinaryProvider.includedir
BinaryProvider.includedir — Method.
includedir(prefix::Prefix)
8.18 BinaryProvider.install
BinaryProvider.install — Method.
install(tarball_url::AbstractString,
hash::AbstractString;
prefix::Prefix = global_prefix,
force::Bool = false,
ignore_platform::Bool = false,
verbose::Bool = false)
Given a prefix, a tarball url and a hash, download that tarball into the
prefix, verify its integrity with the hash, and install it into the prefix. Also
save a manifest of the files into the prefix for uninstallation later.
This will not overwrite any files within prefix unless force=true is set. If
force=true is set, installation will overwrite files as needed, and it will also
delete any files previously installed for tarball url as listed in a pre-existing
manifest (if any).
By default, this will not install a tarball that does not match the platform
of the current host system, this can be overridden by setting ignore platform.
source
8.19 BinaryProvider.isinstalled
BinaryProvider.isinstalled — Method.
isinstalled(tarball_url::AbstractString,
hash::AbstractString;
prefix::Prefix = global_prefix)
Given a prefix, a tarball url and a hash, check whether the tarball with
that hash has been installed into prefix.
In particular, it checks for the tarball, matching hash file, and manifest
installed by install, and checks that the files listed in the manifest are installed
and are not older than the tarball.
source
8.20 BinaryProvider.libdir
BinaryProvider.libdir — Function.
Returns the library directory for the given prefix (note that this differs
between unix systems and windows systems).
source
8.21. BINARYPROVIDER.LIST TARBALL FILES 205
8.22 BinaryProvider.locate
BinaryProvider.locate — Method.
locate(fp::ExecutableProduct; platform::Platform = platform key(),
verbose::Bool = false, isolate::Bool = false)
If the given executable file exists and is executable, return its path.
On all platforms, an ExecutableProduct checks for existence of the file. On
non-Windows platforms, it will check for the executable bit being set. On
Windows platforms, it will check that the file ends with “.exe”, (adding it on
automatically, if it is not already present).
source
8.23 BinaryProvider.locate
BinaryProvider.locate — Method.
locate(fp::FileProduct; platform::Platform = platform key(), verbose::Bool
= false, isolate::Bool = false)
If the given file exists, return its path. The platform argument is ignored
here, but included for uniformity.
source
8.24 BinaryProvider.locate
BinaryProvider.locate — Method.
locate(lp::LibraryProduct; verbose::Bool = false, platform::Platform = plat-
form key())
If the given library exists (under any reasonable name) and is dlopen()able,
(assuming it was built for the current platform) return its location. Note that
the dlopen() test is only run if the current platform matches the given platform
keyword argument, as cross-compiled libraries cannot be dlopen()ed on foreign
platforms.
source
206 CHAPTER 8. BINARYPROVIDER
8.25 BinaryProvider.logdir
BinaryProvider.logdir — Method.
logdir(prefix::Prefix)
Returns the manifest file containing the installation receipt for the given
path, throws an error if it cannot find a matching manifest.
source
Returns the file path of the manifest file for the tarball located at url.
source
8.28 BinaryProvider.package
BinaryProvider.package — Method.
package(src_dir::AbstractString, tarball_path::AbstractString;
verbose::Bool = false)
8.29 BinaryProvider.package
BinaryProvider.package — Method.
package(prefix::Prefix, output_base::AbstractString,
version::VersionNumber;
platform::Platform = platform_key(),
verbose::Bool = false, force::Bool = false)
8.30. BINARYPROVIDER.PARSE 7Z LIST 207
Build a tarball of the prefix, storing the tarball at output base, appending
a version number, a platform-dependent suffix and a file extension. If no plat-
form is given, defaults to current platform. Runs an audit() on the prefix,
to ensure that libraries can be dlopen()’ed, that all dependencies are located
within the prefix, etc. . . See the audit() documentation for a full list of the
audit steps. Returns the full path to and hash of the generated tarball.
source
parse_7z_list(output::AbstractString)
Given the output of 7z l, parse out the listed filenames. This funciton used
by list tarball files.
source
parse_7z_list(output::AbstractString)
Given the output of tar -t, parse out the listed filenames. This funciton
used by list tarball files.
source
parse_tarball_listing(output::AbstractString)
Parses the result of gen list tarball cmd() into something useful.
This method is initialized by probe platform engines(), which should be
automatically called upon first import of BinaryProvider.
source
platform_dlext(platform::Platform = platform_key())
208 CHAPTER 8. BINARYPROVIDER
Return the dynamic library extension for the given platform, defaulting to
the currently running platform. E.g. returns “so” for a Linux-based platform,
“dll” for a Windows-based platform, etc. . .
source
platform_key(machine::AbstractString = Sys.MACHINE)
Returns the platform key for the current platform, or any other though the
the use of the machine parameter.
source
8.35 BinaryProvider.satisfied
BinaryProvider.satisfied — Method.
8.36 BinaryProvider.tail
BinaryProvider.tail — Method.
Write out the last len lines, optionally writing colored lines.
source
8.37 BinaryProvider.tee
BinaryProvider.tee — Method.
temp_prefix(func::Function)
Create a temporary prefix, passing the prefix into the user-defined function
so that build/packaging operations can occur within the temporary prefix, which
is then cleaned up after all operations are finished. If the path provided exists
already, it will be deleted.
Usage example:
out_path = abspath("./libfoo")
temp_prefix() do p
# <insert build steps here>
source
8.39 BinaryProvider.triplet
BinaryProvider.triplet — Method.
triplet(platform)
Get the target triplet for the given Platform object as a String.
Examples
julia> triplet(MacOS())
"x86_64-apple-darwin14"
julia> triplet(Windows(:i686))
"i686-w64-mingw32"
julia> triplet(Linux(:armv7l))
"arm-linux-gnueabihf"
source
8.40 BinaryProvider.uninstall
BinaryProvider.uninstall — Method.
Uninstall a package from a prefix by providing the manifest path that was
generated during install(). To find the manifest file for a particular in-
stalled file, use manifest for file(file path; prefix=prefix).
source
8.41 BinaryProvider.unpack
BinaryProvider.unpack — Method.
unpack(tarball_path::AbstractString, dest::AbstractString;
verbose::Bool = false)
valid_dl_path(path::AbstractString, platform::Platform)
Return true if the given path ends in a valid dynamic library filename. E.g.
returns true for a path like "usr/lib/libfoo.so.3.5", but returns false for
a path like "libbar.so.f.a".
source
variable_name(p::Product)
8.44 BinaryProvider.verify
BinaryProvider.verify — Method.
verify(path::AbstractString, hash::AbstractString;
verbose::Bool = false, report_cache_status::Bool = false)
8.45. BINARYPROVIDER.WORDSIZE 211
Given a file path and a hash, calculate the SHA256 of the file and compare
it to hash. If an error occurs, verify() will throw an error. This method caches
verification results in a "$(path).sha256" file to accelerate re- verification of
files that have been previously verified. If no ".sha256" file exists, a full verifi-
cation will be done and the file will be created, with the calculated hash being
stored within the ".sha256" file.. If a ".sha256" file does exist, its contents
are checked to ensure that the hash contained within matches the given hash
parameter, and its modification time shows that the file located at path has not
been modified since the last verification.
If report cache status is set to true, then the return value will be a
Symbol giving a granular status report on the state of the hash cache, in addition
to the true/false signifying whether verification completed successfully.
source
8.45 BinaryProvider.wordsize
BinaryProvider.wordsize — Method.
wordsize(platform)
julia> wordsize(Linux(:arm7vl))
32
julia> wordsize(MacOS())
64
source
write_deps_file(depsjl_path::AbstractString, products::Vector{Product};
verbose::Bool = false)
Generate a deps.jl file that contains the variables referred to by the prod-
ucts within products. As an example, running the following code:
Will generate a deps.jl file that contains definitions for the two vari-
ables foo exe and libbar. If any Product object cannot be satisfied (e.g.
LibraryProduct objects must be dlopen()-able, FileProduct objects must
exist on the filesystem, etc. . . ) this method will error out. Ensure that you
have used install() to install the binaries you wish to write a deps.jl file for.
The result of this method is a deps.jl file containing variables named as
defined within the Product objects passed in to it, holding the full path to the
installed binaries. Given the example above, it would contain code similar to:
DataStructures
9.1 Base.pop!
Base.pop! — Method.
pop!(sc, k)
Deletes the item with key k in SortedDict or SortedSet sc and returns the
value that was associated with k in the case of SortedDict or k itself in the case
of SortedSet. A KeyError results if k is not in sc. Time: O(c log n)
source
9.2 Base.pop!
Base.pop! — Method.
pop!(sc, k)
Deletes the item with key k in SortedDict or SortedSet sc and returns the
value that was associated with k in the case of SortedDict or k itself in the case
of SortedSet. A KeyError results if k is not in sc. Time: O(c log n)
source
9.3 Base.pop!
Base.pop! — Method.
pop!(ss)
Deletes the item with first key in SortedSet ss and returns the key. A
BoundsError results if ss is empty. Time: O(c log n)
source
213
214 CHAPTER 9. DATASTRUCTURES
9.4 Base.push!
Base.push! — Method.
push!(sc, k)
Argument sc is a SortedSet and k is a key. This inserts the key into the
container. If the key is already present, this overwrites the old value. (This is
not necessarily a no-op; see below for remarks about the customizing the sort
order.) The return value is sc. Time: O(c log n)
source
9.5 Base.push!
Base.push! — Method.
push!(sc, k=>v)
9.6 Base.push!
Base.push! — Method.
push!(sc, k=>v)
9.7 DataStructures.back
DataStructures.back — Method.
back(q::Deque)
9.8 DataStructures.compare
DataStructures.compare — Method.
Determines the relative positions of the data items indexed by (m,s) and
(m,t) in the sorted order. The return value is -1 if (m,s) precedes (m,t), 0 if
they are equal, and 1 if (m,s) succeeds (m,t). s and t are semitokens for the
same container m.
source
9.9 DataStructures.counter
DataStructures.counter — Method.
counter(seq)
9.10 DataStructures.dec!
DataStructures.dec! — Method.
dec!(ct, x, [v=1])
9.11 DataStructures.deque
DataStructures.deque — Method.
deque(T)
9.12 DataStructures.dequeue!
DataStructures.dequeue! — Method.
dequeue!(pq)
Remove and return the lowest priority key from a priority queue.
216 CHAPTER 9. DATASTRUCTURES
julia> a = PriorityQueue(["a","b","c"],[2,3,1],Base.Order.Forward)
PriorityQueue{String,Int64,Base.Order.ForwardOrdering} with 3 entries:
"c" => 1
"b" => 3
"a" => 2
julia> dequeue!(a)
"c"
julia> a
PriorityQueue{String,Int64,Base.Order.ForwardOrdering} with 2 entries:
"b" => 3
"a" => 2
source
9.13 DataStructures.dequeue!
DataStructures.dequeue! — Method.
dequeue!(s::Queue)
Removes an element from the front of the queue s and returns it.
source
julia> dequeue_pair!(a)
"c" => 1
julia> a
PriorityQueue{String,Int64,Base.Order.ForwardOrdering} with 2 entries:
"b" => 3
"a" => 2
source
9.15. DATASTRUCTURES.ENQUEUE! 217
9.15 DataStructures.enqueue!
DataStructures.enqueue! — Method.
enqueue!(pq, k, v)
Insert the a key k into a priority queue pq with priority v.
source
9.16 DataStructures.enqueue!
DataStructures.enqueue! — Method.
enqueue!(s::Queue, x)
Inserts the value x to the end of the queue s.
source
9.17 DataStructures.enqueue!
DataStructures.enqueue! — Method.
enqueue!(pq, k=>v)
Insert the a key k into a priority queue pq with priority v.
julia> a = PriorityQueue(PriorityQueue("a"=>1, "b"=>2, "c"=>3))
PriorityQueue{String,Int64,Base.Order.ForwardOrdering} with 3 entries:
"c" => 3
"b" => 2
"a" => 1
9.19 DataStructures.findkey
DataStructures.findkey — Method.
findkey(sd, k)
Argument sd is a SortedDict and argument k is a key. This function returns
the semitoken that refers to the item whose key is k, or past-end semitoken if k
is absent. Time: O(c log n)
source
9.20 DataStructures.front
DataStructures.front — Method.
front(q::Deque)
Returns the first element of the deque q.
source
9.21 DataStructures.heapify
DataStructures.heapify — Function.
heapify(v, ord::Ordering=Forward)
Returns a new vector in binary heap order, optionally using the given order-
ing.
julia> a = [1,3,4,5,2];
julia> heapify(a)
5-element Array{Int64,1}:
1
2
4
5
3
9.22 DataStructures.heapify!
DataStructures.heapify! — Function.
heapify!(v, ord::Ordering=Forward)
In-place heapify.
source
9.23 DataStructures.heappop!
DataStructures.heappop! — Function.
heappop!(v, [ord])
Given a binary heap-ordered array, remove and return the lowest ordered
element. For efficiency, this function does not check that the array is indeed
heap-ordered.
source
9.24 DataStructures.heappush!
DataStructures.heappush! — Function.
heappush!(v, x, [ord])
Given a binary heap-ordered array, push a new element x, preserving the
heap property. For efficiency, this function does not check that the array is
indeed heap-ordered.
source
9.26 DataStructures.inc!
DataStructures.inc! — Method.
inc!(ct, x, [v=1])
Increments the count for x by v (defaulting to one)
source
220 CHAPTER 9. DATASTRUCTURES
9.27 DataStructures.isheap
DataStructures.isheap — Function.
isheap(v, ord::Ordering=Forward)
Return true if an array is heap-ordered according to the given order.
julia> a = [1,2,3]
3-element Array{Int64,1}:
1
2
3
julia> isheap(a,Base.Order.Forward)
true
julia> isheap(a,Base.Order.Reverse)
false
source
9.28 DataStructures.nlargest
DataStructures.nlargest — Method.
nlargest(acc::Accumulator, [n])
Returns a sorted vector of the n most common elements, with their counts.
If n is omitted, the full sorted collection is returned.
This corresponds to Python’s Counter.most common function.
Example
julia> nlargest(counter("abbbccddddda"))
4-element Array{Pair{Char,Int64},1}:
’d’=>5
’b’=>3
’c’=>2
’a’=>2
julia> nlargest(counter("abbbccddddda"),2)
2-element Array{Pair{Char,Int64},1}:
’d’=>5
’b’=>3
source
9.29. DATASTRUCTURES.NLARGEST 221
9.29 DataStructures.nlargest
DataStructures.nlargest — Method.
nlargest(n, arr)
9.30 DataStructures.nsmallest
DataStructures.nsmallest — Method.
nsmallest(acc::Accumulator, [n])
Returns a sorted vector of the n least common elements, with their counts.
If n is omitted, the full sorted collection is returned.
This is the opposite of the nlargest function. For obvious reasons this will
not include zero counts for items not encountered. (unless those elements are
added to he accumulator directly, eg via ‘acc[foo]=0)
source
9.31 DataStructures.nsmallest
DataStructures.nsmallest — Method.
nsmallest(n, arr)
9.32 DataStructures.orderobject
DataStructures.orderobject — Method.
orderobject(sc)
Returns the order object used to construct the container. Time: O(1)
source
222 CHAPTER 9. DATASTRUCTURES
9.33 DataStructures.orderobject
DataStructures.orderobject — Method.
orderobject(sc)
Returns the order object used to construct the container. Time: O(1)
source
9.34 DataStructures.orderobject
DataStructures.orderobject — Method.
orderobject(sc)
Returns the order object used to construct the container. Time: O(1)
source
9.35 DataStructures.ordtype
DataStructures.ordtype — Method.
ordtype(sc)
Returns the order type for SortedDict, SortedMultiDict and SortedSet. This
function may also be applied to the type itself. Time: O(1)
source
9.36 DataStructures.ordtype
DataStructures.ordtype — Method.
ordtype(sc)
Returns the order type for SortedDict, SortedMultiDict and SortedSet. This
function may also be applied to the type itself. Time: O(1)
source
9.37 DataStructures.ordtype
DataStructures.ordtype — Method.
ordtype(sc)
Returns the order type for SortedDict, SortedMultiDict and SortedSet. This
function may also be applied to the type itself. Time: O(1)
source
9.38. DATASTRUCTURES.PACKCOPY 223
9.38 DataStructures.packcopy
DataStructures.packcopy — Method.
packcopy(sc)
This returns a copy of sc in which the data is packed. When deletions take
place, the previously allocated memory is not returned. This function can be
used to reclaim memory after many deletions. Time: O(cn log n)
source
9.39 DataStructures.packcopy
DataStructures.packcopy — Method.
packcopy(sc)
This returns a copy of sc in which the data is packed. When deletions take
place, the previously allocated memory is not returned. This function can be
used to reclaim memory after many deletions. Time: O(cn log n)
source
9.40 DataStructures.packcopy
DataStructures.packcopy — Method.
packcopy(sc)
This returns a copy of sc in which the data is packed. When deletions take
place, the previously allocated memory is not returned. This function can be
used to reclaim memory after many deletions. Time: O(cn log n)
source
9.41 DataStructures.packdeepcopy
DataStructures.packdeepcopy — Method.
packdeepcopy(sc)
This returns a packed copy of sc in which the keys and values are deep-
copied. This function can be used to reclaim memory after many deletions.
Time: O(cn log n)
source
224 CHAPTER 9. DATASTRUCTURES
9.42 DataStructures.packdeepcopy
DataStructures.packdeepcopy — Method.
packdeepcopy(sc)
This returns a packed copy of sc in which the keys and values are deep-
copied. This function can be used to reclaim memory after many deletions.
Time: O(cn log n)
source
9.43 DataStructures.packdeepcopy
DataStructures.packdeepcopy — Method.
packdeepcopy(sc)
This returns a packed copy of sc in which the keys and values are deep-
copied. This function can be used to reclaim memory after many deletions.
Time: O(cn log n)
source
9.44 DataStructures.peek
DataStructures.peek — Method.
peek(pq)
Return the lowest priority key from a priority queue without removing that
key from the queue.
source
9.45 DataStructures.reset!
DataStructures.reset! — Method.
reset!(ct::Accumulator, x)
Resets the count of x to zero. Returns its former count.
source
9.46 DataStructures.top
DataStructures.top — Method.
top(h::BinaryHeap)
Returns the element at the top of the heap h.
source
9.47. DATASTRUCTURES.TOP WITH HANDLE 225
top_with_handle(h::MutableBinaryHeap)
Returns the element at the top of the heap h and its handle.
source
9.48 DataStructures.update!
DataStructures.update! — Method.
JDBC
10.1 JDBC.commit
JDBC.commit — Method.
Commit any pending transaction to the database. Throws a JDBCError if
connection is null.
Returns nothing.
source
10.2 JDBC.commit
JDBC.commit — Method.
commit(connection::JConnection)
Returns
None
source
10.3 JDBC.connection
JDBC.connection — Method.
Return the corresponding connection for a given cursor.
source
226
10.4. JDBC.CREATESTATEMENT 227
10.4 JDBC.createStatement
JDBC.createStatement — Method.
createStatement(connection::JConnection)
Initializes a Statement
Args
Returns
The JStatement object
source
10.5 JDBC.cursor
JDBC.cursor — Method.
Create a new database cursor.
Returns a JDBCCursor instance.
source
10.6 JDBC.execute!
JDBC.execute! — Method.
Run a query on a database.
The results of the query are not returned by this function but are accessible
through the cursor.
parameters can be any iterable of positional parameters, or of some T<:Associative
for keyword/named parameters.
Throws a JDBCError if query caused an error, cursor is not initialized or
connection is null.
Returns nothing.
source
10.7 JDBC.execute
JDBC.execute — Method.
execute(stmt::JStatement, query::AbstractString)
Returns
A boolean indicating whether the execution was successful or not
source
10.8 JDBC.execute
JDBC.execute — Method.
execute(stmt::(Union{JPreparedStatement, JCallableStatement}))
Returns
A boolean indicating whether the execution was successful or not
source
10.9 JDBC.executeQuery
JDBC.executeQuery — Method.
executeQuery(stmt::JStatement, query::AbstractString)
Returns
The result set as a JResultSet object
source
10.10 JDBC.executeQuery
JDBC.executeQuery — Method.
executeQuery(stmt::Union{JPreparedStatement, JCallableStatement})
Returns
The result set as a JResultSet object
source
10.11 JDBC.executeUpdate
JDBC.executeUpdate — Method.
executeUpdate(stmt::JStatement, query::AbstractString)
Executes the update auery and returns the status of the execution of the
query
Args
Returns
An integer representing the status of the execution
source
10.12 JDBC.executeUpdate
JDBC.executeUpdate — Method.
executeUpdate(stmt::Union{JPreparedStatement, JCallableStatement})
Returns
An integer indicating the status of the execution of the query
source
10.13 JDBC.getColumnCount
JDBC.getColumnCount — Method.
getColumnCount(rsmd::JResultSetMetaData)
230 CHAPTER 10. JDBC
Returns
The number of columns.
source
10.14 JDBC.getColumnName
JDBC.getColumnName — Method.
getColumnName(rsmd::JResultSetMetaData, col::Integer)
Returns
The column name
source
10.15 JDBC.getColumnType
JDBC.getColumnType — Method.
getColumnType(rsmd::JResultSetMetaData, col::Integer)
Returns
The column type as an integer
source
10.16. JDBC.GETDATE 231
10.16 JDBC.getDate
JDBC.getDate — Method.
getDate(rs::Union{JResultSet, JCallableStatement}, fld::AbstractString)
Returns the Date object based on the result set or a callable statement. The
value is extracted based on the column name.
Args
• stmt: The JResultSet or JCallableStatement object
• fld: The column name
Returns
The Date object.
source
10.17 JDBC.getDate
JDBC.getDate — Method.
getDate(rs::Union{JResultSet, JCallableStatement}, fld::Integer)
Returns the Date object based on the result set or a callable statement. The
value is extracted based on the column number.
Args
• stmt: The JResultSet or JCallableStatement object
• fld: The column number
Returns
The Date object.
source
10.18 JDBC.getMetaData
JDBC.getMetaData — Method.
getMetaData(rs::JResultSet)
Returns information about the types and properties of the columns in the
ResultSet object
Args
• stmt: The JResultSet object
Returns
The JResultSetMetaData object.
source
232 CHAPTER 10. JDBC
10.19 JDBC.getResultSet
JDBC.getResultSet — Method.
getResultSet(stmt::JStatement)
Returns the result set based on the previous execution of the query based
on a JStatement
Args
Returns
The JResultSet object.
source
10.20 JDBC.getTableMetaData
JDBC.getTableMetaData — Method.
Get the metadata (column name and type) for each column of the table in
the result set rs.
Returns an array of (column name, column type) tuples.
source
10.21 JDBC.getTime
JDBC.getTime — Method.
Returns the Time object based on the result set or a callable statement. The
value is extracted based on the column name.
Args
Returns
The Time object.
source
10.22. JDBC.GETTIME 233
10.22 JDBC.getTime
JDBC.getTime — Method.
getTime(rs::Union{JResultSet, JCallableStatement}, fld::Integer)
Returns the Time object based on the result set or a callable statement. The
value is extracted based on the column number.
Args
• stmt: The JResultSet or JCallableStatement object
• fld: The column number
Returns
The Time object.
source
10.23 JDBC.getTimestamp
JDBC.getTimestamp — Method.
getTimestamp(rs::Union{JResultSet, JCallableStatement}, fld::AbstractString)
Returns the Timestamp object based on the result set or a callable state-
ment. The value is extracted based on the column name.
Args
• stmt: The JResultSet or JCallableStatement object
• fld: The column name
Returns
The Timestamp object.
source
10.24 JDBC.getTimestamp
JDBC.getTimestamp — Method.
getTimestamp(rs::@Union{JResultSet, JCallableStatement}, fld::Integer)
Returns the Timestamp object based on the result set or a callable state-
ment. The value is extracted based on the column number.
Args
• stmt: The JResultSet or JCallableStatement object
• fld: The column number
Returns
The Timestamp object.
source
234 CHAPTER 10. JDBC
10.25 JDBC.isopen
JDBC.isopen — Method.
Returns a boolean indicating whether connection conn is open.
source
10.26 JDBC.prepareCall
JDBC.prepareCall — Method.
prepareCall(connection::JConnection, query::AbstractString)
Returns
The JCallableStatement object
source
10.27 JDBC.prepareStatement
JDBC.prepareStatement — Method.
prepareStatement(connection::JConnection, query::AbstractString)
Returns
The JPreparedStatement object
source
10.28 JDBC.rollback
JDBC.rollback — Method.
Roll back to the start of any pending transaction. Throws a JDBCError if
connection is null.
Returns nothing.
source
10.29. JDBC.ROLLBACK 235
10.29 JDBC.rollback
JDBC.rollback — Method.
rollback(connection::JConnection)
Returns
None
source
10.30 JDBC.rows
JDBC.rows — Method.
Create a row iterator.
This method returns an instance of an iterator type which returns one row
on each iteration. Each row returnes a Tuple{. . . }.
Throws a JDBCError if execute! was not called on the cursor or connection
is null.
Returns a JDBCRowIterator instance.
source
10.31 JDBC.setAutoCommit
JDBC.setAutoCommit — Method.
setAutoCommit(connection::JConnection, x::Bool)
Set the Auto Commit flag to either true or false. If set to false, commit has
to be called explicitly
Args
Returns
None
source
236 CHAPTER 10. JDBC
10.32 JDBC.setFetchSize
JDBC.setFetchSize — Method.
Returns
None
source
Chapter 11
ImageCore
assert_timedim_last(img)
Throw an error if the image has a time dimension that is not the last di-
mension.
source
11.2 ImageCore.channelview
ImageCore.channelview — Method.
channelview(A)
returns a view of A, splitting out (if necessary) the color channels of A into a
new first dimension. This is almost identical to ChannelView(A), except that if
A is a ColorView, it will simply return the parent of A, or will use reinterpret
when appropriate. Consequently, the output may not be a ChannelView array.
Of relevance for types like RGB and BGR, the channels of the returned array
will be in constructor-argument order, not memory order (see reinterpret if
you want to use memory order).
source
11.3 ImageCore.clamp01
ImageCore.clamp01 — Method.
clamp01(x) -> y
237
238 CHAPTER 11. IMAGECORE
Produce a value y that lies between 0 and 1, and equal to x when x is already
in this range. Equivalent to clamp(x, 0, 1) for numeric values. For colors,
this function is applied to each color channel separately.
See also: clamp01nan.
source
11.4 ImageCore.clamp01nan
ImageCore.clamp01nan — Method.
clamp01nan(x) -> y
11.5 ImageCore.colorsigned
ImageCore.colorsigned — Method.
colorsigned()
colorsigned(colorneg, colorpos) -> f
colorsigned(colorneg, colorcenter, colorpos) -> f
Define a function that maps negative values (in the range [-1,0]) to the linear
colormap between colorneg and colorcenter, and positive values (in the range
[0,1]) to the linear colormap between colorcenter and colorpos.
The default colors are:
• colorcenter: white
• colorneg: green1
• colorpos: magenta
11.6 ImageCore.colorview
ImageCore.colorview — Method.
11.7 ImageCore.colorview
ImageCore.colorview — Method.
colorview(C, A)
11.9 ImageCore.float32
ImageCore.float32 — Function.
float32.(img)
240 CHAPTER 11. IMAGECORE
converts the raw storage type of img to Float32, without changing the color
space.
source
11.10 ImageCore.float64
ImageCore.float64 — Function.
float64.(img)
converts the raw storage type of img to Float64, without changing the color
space.
source
indices_spatial(img)
Return a tuple with the indices of the spatial dimensions of the image. De-
faults to the same as indices, but using ImagesAxes you can mark some axes
as being non-spatial.
source
11.12 ImageCore.n0f16
ImageCore.n0f16 — Function.
n0f16.(img)
converts the raw storage type of img to N0f16, without changing the color
space.
source
11.13 ImageCore.n0f8
ImageCore.n0f8 — Function.
n0f8.(img)
converts the raw storage type of img to N0f8, without changing the color
space.
source
11.14. IMAGECORE.N2F14 241
11.14 ImageCore.n2f14
ImageCore.n2f14 — Function.
n2f14.(img)
converts the raw storage type of img to N2f14, without changing the color
space.
source
11.15 ImageCore.n4f12
ImageCore.n4f12 — Function.
n4f12.(img)
converts the raw storage type of img to N4f12, without changing the color
space.
source
11.16 ImageCore.n6f10
ImageCore.n6f10 — Function.
n6f10.(img)
converts the raw storage type of img to N6f10, without changing the color
space.
source
11.17 ImageCore.nimages
ImageCore.nimages — Method.
nimages(img)
source
242 CHAPTER 11. IMAGECORE
11.18 ImageCore.normedview
ImageCore.normedview — Method.
normedview([T], img::AbstractArray{Unsigned})
returns a “view” of img where the values are interpreted in terms of Normed
number types. For example, if img is an Array{UInt8}, the view will act like an
Array{N0f8}. Supply T if the element type of img is UInt16, to specify whether
you want a N6f10, N4f12, N2f14, or N0f16 result.
source
11.19 ImageCore.permuteddimsview
ImageCore.permuteddimsview — Method.
permuteddimsview(A, perm)
11.20 ImageCore.pixelspacing
ImageCore.pixelspacing — Method.
11.21 ImageCore.rawview
ImageCore.rawview — Method.
rawview(img::AbstractArray{FixedPoint})
returns a “view” of img where the values are interpreted in terms of their
raw underlying storage. For example, if img is an Array{N0f8}, the view will
act like an Array{UInt8}.
source
11.22. IMAGECORE.SCALEMINMAX 243
11.22 ImageCore.scaleminmax
ImageCore.scaleminmax — Method.
Return a function f which maps values less than or equal to min to 0, values
greater than or equal to max to 1, and uses a linear scale in between. min and
max should be real values.
Optionally specify the return type T. If T is a colorant (e.g., RGB), then
scaling is applied to each color channel.
Examples
Example 1
[] julia¿ f = scaleminmax(-10, 10) (::9) (generic function with 1 method)
julia¿ f(10) 1.0
julia¿ f(-10) 0.0
julia¿ f(5) 0.75
Example 2
[] julia¿ c = RGB(255.0,128.0,0.0) RGB{Float64}(255.0,128.0,0.0)
julia¿ f = scaleminmax(RGB, 0, 255) (::13) (generic function with 1 method)
julia¿ f(c) RGB{Float64}(1.0,0.5019607843137255,0.0)
See also: takemap.
source
11.23 ImageCore.scalesigned
ImageCore.scalesigned — Method.
scalesigned(maxabs) -> f
11.24 ImageCore.scalesigned
ImageCore.scalesigned — Method.
11.25 ImageCore.sdims
ImageCore.sdims — Method.
sdims(img)
Return the number of spatial dimensions in the image. Defaults to the same
as ndims, but with ImagesAxes you can specify that some axes correspond to
other quantities (e.g., time) and thus not included by sdims.
source
size_spatial(img)
Return a tuple listing the sizes of the spatial dimensions of the image. De-
faults to the same as size, but using ImagesAxes you can mark some axes as
being non-spatial.
source
11.27 ImageCore.spacedirections
ImageCore.spacedirections — Method.
11.28 ImageCore.takemap
ImageCore.takemap — Function.
or valid colorants. fnew may be adapted to the actual values present in A, and
may not produce valid values for any inputs not in A.
Optionally one can specify the output type T that fnew should produce.
Example:
[] julia¿ A = [0, 1, 1000];
julia¿ f = takemap(scaleminmax, A) (::7) (generic function with 1 method)
julia¿ f.(A) 3-element Array{Float64,1}: 0.0 0.001 1.0
source
Chapter 12
Reactive
12.1 Base.filter
Base.filter — Method.
remove updates from the signal where f returns false. The filter will hold
the value default until f(value(signal)) returns true, when it will be updated to
value(signal).
source
12.2 Base.filter
Base.filter — Method.
filter(f, signal)
remove updates from the signal where f returns false. The filter will hold
the current value of the signal until f(value(signal)) returns true.
source
12.3 Base.map
Base.map — Method.
246
12.4. BASE.MERGE 247
12.4 Base.merge
Base.merge — Method.
merge(inputs...)
Merge many signals into one. Returns a signal which updates when any of
the inputs update. If many signals update at the same time, the value of the
youngest (most recently created) input signal is taken.
source
12.5 Base.push!
Base.push! — Function.
push!(signal, value, onerror=Reactive.print error)
Queue an update to a signal. The update will be propagated when all
currently queued updates are done processing.
The third (optional) argument, onerror, is a callback triggered when the
update ends in an error. The callback receives 4 arguments, onerror(sig,
val, node, capex), where sig and val are the Signal and value that push!
was called with, respectively, node is the Signal whose action triggered the error,
and capex is a CapturedException with the fields ex which is the original
exception object, and processed bt which is the backtrace of the exception.
The default error callback will print the error and backtrace to STDERR.
source
Spawn a new task to run a function when input signal updates. Returns
a signal of tasks and a results signal which updates asynchronously with the
results. init will be used as the default value of results. onerror is the
callback to be called when an error occurs, by default it is set to a callback
which prints the error to STDERR. It’s the same as the onerror argument to
push! but is run in the spawned task.
source
12.7 Reactive.bind!
Reactive.bind! — Function.
for every update to src also update dest with the same value and, if twoway
is true, vice-versa. If initial is false, dest will only be updated to src’s value
when src next updates, otherwise (if initial is true) both dest and src will
take src’s value immediately.
source
12.8 Reactive.bindmap!
Reactive.bindmap! — Function.
for every update to src also update dest with a modified value (using the
function src2dest) and, if dest2src is specified, a two-way update will hold.
If initial is false, dest will only be updated to src’s modified value when src
next updates, otherwise (if initial is true) both dest and src will take their
respective modified values immediately.
source
12.11 Reactive.debounce
Reactive.debounce — Method.
Creates a signal that will delay updating until dt seconds have passed since
the last time input has updated. By default, the debounce signal holds the last
update of the input signal since the debounce signal last updated.
12.12. REACTIVE.DELAY 249
This behavior can be changed by the f, init and reinit arguments. The
init and f functions are similar to init and f in foldp. reinit is called after
the debounce sends an update, to reinitialize the initial value for accumulation,
it gets one argument, the previous accumulated value.
For example y = debounce(0.2, x, push!, Int[], ->Int[]) will accu-
mulate a vector of updates to the integer signal x and push it after x is inactive
(doesn’t update) for 0.2 seconds.
source
12.12 Reactive.delay
Reactive.delay — Method.
delay(input, default=value(input))
12.13 Reactive.droprepeats
Reactive.droprepeats — Method.
droprepeats(input)
Drop updates to input whenever the new value is the same as the previous
value of the signal.
source
12.14 Reactive.every
Reactive.every — Method.
every(dt)
12.15 Reactive.filterwhen
Reactive.filterwhen — Method.
12.16 Reactive.flatten
Reactive.flatten — Method.
flatten(input::Signal{Signal}; typ=Any)
Flatten a signal of signals into a signal which holds the value of the current
signal. The typ keyword argument specifies the type of the flattened signal. It
is Any by default.
source
12.17 Reactive.foldp
Reactive.foldp — Method.
12.18 Reactive.fps
Reactive.fps — Method.
fps(rate)
12.19 Reactive.fpswhen
Reactive.fpswhen — Method.
fpswhen(switch, rate)
returns a signal which when switch signal is true, updates rate times every
second. If rate is not possible to attain because of slowness in computing
dependent signal values, the signal will self adjust to provide the best possible
rate.
source
12.20 Reactive.preserve
Reactive.preserve — Method.
preserve(signal::Signal)
prevents signal from being garbage collected as long as any of its parents
are around. Useful for when you want to do some side effects in a signal. e.g.
preserve(map(println, x)) - this will continue to print updates to x, until x
goes out of scope. foreach is a shorthand for map with preserve.
source
12.21 Reactive.previous
Reactive.previous — Method.
previous(input, default=value(input))
Create a signal which holds the previous value of input. You can optionally
specify a different initial value.
source
Spawn a new task on process procid to run a function when input signal
updates. Returns a signal of remote refs and a results signal which updates
asynchronously with the results. init will be used as the default value of
results. onerror is the callback to be called when an error occurs, by default
it is set to a callback which prints the error to STDERR. It’s the same as the
onerror argument to push! but is run in the spawned task.
source
252 CHAPTER 12. REACTIVE
12.23 Reactive.rename!
Reactive.rename! — Method.
rename!(s::Signal, name::String)
Change a Signal’s name
source
12.24 Reactive.sampleon
Reactive.sampleon — Method.
sampleon(a, b)
Sample the value of b whenever a updates.
source
12.25 Reactive.throttle
Reactive.throttle — Method.
throttle(dt, input, f=(acc,x)->x, init=value(input), reinit=x->x;
typ=typeof(init), name=auto_name!(string("throttle ",dt,"s"), input), leadi
Throttle a signal to update at most once every dt seconds. By default, the
throttled signal holds the last update of the input signal during each dt second
time window.
This behavior can be changed by the f, init and reinit arguments. The
init and f functions are similar to init and f in foldp. reinit is called when a
new throttle time window opens to reinitialize the initial value for accumulation,
it gets one argument, the previous accumulated value.
For example y = throttle(0.2, x, push!, Int[], ->Int[]) will cre-
ate vectors of updates to the integer signal x which occur within 0.2 second time
windows.
If leading is true, the first update from input will be sent immediately by
the throttle signal. If it is false, the first update will happen dt seconds after
input’s first update
New in v0.4.1: throttle’s behaviour from previous versions is now available
with the debounce signal type.
source
12.26 Reactive.unbind!
Reactive.unbind! — Function.
‘unbind!(dest, src, twoway=true)‘
remove a link set up using bind!
source
12.27. REACTIVE.UNPRESERVE 253
12.27 Reactive.unpreserve
Reactive.unpreserve — Method.
unpreserve(signal::Signal)
Combinatorics
13.1 Base.factorial
Base.factorial — Method.
factorial(n, k)
Compute n!/k!.
source
13.2 Combinatorics.bellnum
Combinatorics.bellnum — Method.
bellnum(n)
13.3 Combinatorics.catalannum
Combinatorics.catalannum — Method.
catalannum(n)
254
13.4. COMBINATORICS.CHARACTER 255
13.4 Combinatorics.character
Combinatorics.character — Method.
character(::Partition, ::Partition)
Compute the character χλ(µ) of the partition in the th irreducible represen-
tation (“irrep”) of the symmetric group Sn .
Implements the Murnaghan-Nakayama algorithm as described in:
Dan Bernstein,
"The computational complexity of rules for the character table of Sn",
Journal of Symbolic Computation, vol. 37 iss. 6 (2004), pp 727-748.
doi:10.1016/j.jsc.2003.11.001
source
13.5 Combinatorics.combinations
Combinatorics.combinations — Method.
combinations(a, n)
Generate all combinations of n elements from an indexable object a. Because
the number of combinations can be very large, this function returns an iterator
object. Use collect(combinations(a, n)) to get an array of all combinations.
source
13.6 Combinatorics.combinations
Combinatorics.combinations — Method.
combinations(a)
Generate combinations of the elements of a of all orders. Chaining of order
iterators is eager, but the sequence at each order is lazy.
source
13.7 Combinatorics.derangement
Combinatorics.derangement — Method.
derangement(n)
Compute the number of permutations of n with no fixed points, also known
as the subfactorial. An alias subfactorial for this function is provided for
convenience.
source
256 CHAPTER 13. COMBINATORICS
integer_partitions(n)
13.9 Combinatorics.isrimhook
Combinatorics.isrimhook — Method.
isrimhook(::SkewDiagram)
isrimhook(::Partition, ::Partition)
13.10 Combinatorics.isrimhook
Combinatorics.isrimhook — Method.
isrimhook(a::Int, b::Int)
13.11 Combinatorics.lassallenum
Combinatorics.lassallenum — Method.
lassallenum(n)
13.12 Combinatorics.leglength
Combinatorics.leglength — Method.
leglength(::SkewDiagram)
leglength(::Partition, ::Partition)
13.13. COMBINATORICS.LEVICIVITA 257
13.13 Combinatorics.levicivita
Combinatorics.levicivita — Method.
levicivita(p)
13.14 Combinatorics.multiexponents
Combinatorics.multiexponents — Method.
multiexponents(m, n)
6-element Array{Any,1}:
[2, 0, 0]
[1, 1, 0]
[1, 0, 1]
[0, 2, 0]
[0, 1, 1]
[0, 0, 2]
source
13.15 Combinatorics.multinomial
Combinatorics.multinomial — Method.
multinomial(k...)
multiset_combinations(a, t)
multiset_permutations(m, f, t)
13.18 Combinatorics.nthperm!
Combinatorics.nthperm! — Method.
nthperm!(a, k)
13.19 Combinatorics.nthperm
Combinatorics.nthperm — Method.
nthperm(p)
13.20 Combinatorics.nthperm
Combinatorics.nthperm — Method.
nthperm(a, k)
13.21 Combinatorics.parity
Combinatorics.parity — Method.
parity(p)
13.22 Combinatorics.partitions
Combinatorics.partitions — Method.
partitions(s::AbstractVector, m::Int)
Generate all set partitions of the elements of an array s into exactly m subsets,
represented as arrays of arrays. Because the number of partitions can be very
large, this function returns an iterator object. Use collect(partitions(s,
m)) to get an array of all partitions. The number of partitions into m subsets is
equal to the Stirling number of the second kind, and can be efficiently computed
using length(partitions(s, m)).
source
13.23 Combinatorics.partitions
Combinatorics.partitions — Method.
partitions(s::AbstractVector)
13.24 Combinatorics.partitions
Combinatorics.partitions — Method.
partitions(n, m)
260 CHAPTER 13. COMBINATORICS
13.25 Combinatorics.partitions
Combinatorics.partitions — Method.
partitions(n)
Generate all integer arrays that sum to n. Because the number of partitions
can be very large, this function returns an iterator object. Use collect(partitions(n))
to get an array of all partitions. The number of partitions to generate can be
efficiently computed using length(partitions(n)).
source
13.26 Combinatorics.partitionsequence
Combinatorics.partitionsequence — Method.
partitionsequence(lambda::Partition)
Compute essential part of the partition sequence of lambda.
source
13.27 Combinatorics.permutations
Combinatorics.permutations — Method.
permutations(a, t)
Generate all size t permutations of an indexable object a.
source
13.28 Combinatorics.permutations
Combinatorics.permutations — Method.
permutations(a)
Generate all permutations of an indexable object a. Because the number of
permutations can be very large, this function returns an iterator object. Use
collect(permutations(a)) to get an array of all permutations.
source
13.29. COMBINATORICS.POWERSET 261
13.29 Combinatorics.powerset
Combinatorics.powerset — Function.
Generate all subsets of an indexable object a including the empty set, with
cardinality bounded by min and max. Because the number of subsets can be
very large, this function returns an iterator object. Use collect(powerset(a,
min, max)) to get an array of all subsets.
source
13.30 Combinatorics.prevprod
Combinatorics.prevprod — Method.
prevprod(a::Vector{Int}, x)
Previous integer not greater than x that can be written as kipi for integers
Q
p1 , p2 , etc.
For integers i1 , i2 , i3 , this is equivalent to finding the largest x such that
with_replacement_combinations(a, t)
JuliaDB
14.1 Dagger.compute
Dagger.compute — Method.
14.2 Dagger.distribute
Dagger.distribute — Function.
distribute(itable::NDSparse, nchunks::Int=nworkers())
262
14.3. DAGGER.DISTRIBUTE 263
14.3 Dagger.distribute
Dagger.distribute — Method.
distribute(t::Table, chunks)
14.4 Dagger.distribute
Dagger.distribute — Method.
distribute(itable::NDSparse, rowgroups::AbstractArray)
14.5 Dagger.load
Dagger.load — Method.
load(dir::AbstractString; tomemory)
Load a saved DNDSparse from dir directory. Data can be saved using the
save function.
source
14.6 Dagger.save
Dagger.save — Method.
save(t::Union{DNDSparse, DNDSparse}, outputdir::AbstractString)
Saves a distributed dataset to disk. Saved data can be loaded with load.
source
14.7 IndexedTables.convertdim
IndexedTables.convertdim — Method.
14.8 IndexedTables.leftjoin
IndexedTables.leftjoin — Method.
Keeps only rows with indices in left. If rows of the same index are present
in right, then they are combined using op. op by default picks the value from
right.
source
14.9 IndexedTables.naturaljoin
IndexedTables.naturaljoin — Method.
Returns a new DNDSparse containing only rows where the indices are present
both in left AND right tables. The data columns are concatenated. The data
of the matching rows from left and right are combined using op. If op returns
a tuple or NamedTuple, and ascolumns is set to true, the output table will
contain the tuple elements as separate data columns instead as a single column
of resultant tuples.
source
14.10 IndexedTables.naturaljoin
IndexedTables.naturaljoin — Method.
Returns a new DNDSparse containing only rows where the indices are present
both in left AND right tables. The data columns are concatenated.
source
14.11. INDEXEDTABLES.REDUCEDIM VEC 265
14.12 JuliaDB.loadndsparse
JuliaDB.loadndsparse — Method.
loadndsparse(files::Union{AbstractVector,String}; <options>)
Load an NDSparse from CSV files.
files is either a vector of file paths, or a directory name.
Options:
14.13 JuliaDB.loadtable
JuliaDB.loadtable — Method.
loadtable(files::Union{AbstractVector,String}; <options>)
Load a table from CSV files.
files is either a vector of file paths, or a directory name.
Options:
• usecache::Bool: (vestigial)
source
14.14 JuliaDB.partitionplot
JuliaDB.partitionplot — Function.
14.15 JuliaDB.rechunk
JuliaDB.rechunk — Function.
rechunk(t::Union{DNDSparse, DNDSparse}[, by[, select]]; <options>)
Reindex and sort a distributed dataset by keys selected by by.
Optionally select specifies which non-indexed fields are kept. By default
this is all fields not mentioned in by for Table and the value columns for
NDSparse.
Options:
• chunks sorted::Bool – are the chunks sorted locally? If true, this skips
sorting or re-indexing them.
268 CHAPTER 14. JULIADB
source
14.16 JuliaDB.tracktime
JuliaDB.tracktime — Method.
tracktime(f)
Track the time spent on different processes in different categories in running
f.
source
Chapter 15
HypothesisTests
15.1 HypothesisTests.ChisqTest
HypothesisTests.ChisqTest — Method.
15.2 HypothesisTests.MannWhitneyUTest
HypothesisTests.MannWhitneyUTest — Method.
MannWhitneyUTest(x::AbstractVector{<:Real}, y::AbstractVector{<:Real})
269
270 CHAPTER 15. HYPOTHESISTESTS
15.3 HypothesisTests.MultinomialLRT
HypothesisTests.MultinomialLRT — Method.
15.4 HypothesisTests.SignedRankTest
HypothesisTests.SignedRankTest — Method.
SignedRankTest(x::AbstractVector{<:Real})
SignedRankTest(x::AbstractVector{<:Real}, y::AbstractVector{T<:Real})
Perform a Wilcoxon signed rank test of the null hypothesis that the distri-
bution of x (or the difference x - y if y is provided) has zero median against
the alternative hypothesis that the median is non-zero.
15.5. HYPOTHESISTESTS.PVALUE 271
When there are no tied ranks and 50 samples, or tied ranks and 15 sam-
ples, SignedRankTest performs an exact signed rank test. In all other cases,
SignedRankTest performs an approximate signed rank test. Behavior may be
further controlled by using ExactSignedRankTest or ApproximateSignedRankTest
directly.
Implements: pvalue, confint
source
15.5 HypothesisTests.pvalue
HypothesisTests.pvalue — Function.
15.6 HypothesisTests.pvalue
HypothesisTests.pvalue — Method.
• :central (default): Central interval, i.e. the p-value is two times the
minimum of the one-sided p-values.
• :minlike: Minimum likelihood interval, i.e. the p-value is computed by
summing all tables with the same marginals that are equally or less prob-
able:
X
p= f(i)
f(i)f(a)
References
272 CHAPTER 15. HYPOTHESISTESTS
source
15.7 HypothesisTests.testname
HypothesisTests.testname — Method.
testname(::HypothesisTest)
15.8 StatsBase.confint
StatsBase.confint — Function.
$$
C (x, 1 ) = \{ : p_ (x) > \},
$$
source
15.9 StatsBase.confint
StatsBase.confint — Function.
References
source
15.10 StatsBase.confint
StatsBase.confint — Function.
source
274 CHAPTER 15. HYPOTHESISTESTS
15.11 StatsBase.confint
StatsBase.confint — Function.
References
• Brown, L.D., Cai, T.T., and DasGupta, A. Interval estimation for a bino-
mial proportion. Statistical Science, 16(2):101–117, 2001.
External links
source
Chapter 16
PyCall
16.1 PyCall.PyNULL
PyCall.PyNULL — Method.
PyNULL()
Return a PyObject that has a NULL underlying pointer, i.e. it doesn’t actually
refer to any Python object.
This is useful for initializing PyObject global variables and array elements
before an actual Python object is available. For example, you might do const
myglobal = PyNULL() and later on (e.g. in a module init function), reas-
sign myglobal to point to an actual object with copy!(myglobal, someobject).
This procedure will properly handle Python’s reference counting (so that the
Python object will not be freed until you are done with myglobal).
source
16.2 PyCall.PyReverseDims
PyCall.PyReverseDims — Method.
PyReverseDims(array)
16.3 PyCall.PyTextIO
PyCall.PyTextIO — Method.
275
276 CHAPTER 16. PYCALL
PyTextIO(io::IO)
PyObject(io::IO)
Julia IO streams are converted into Python objects implementing the Raw-
IOBase interface, so they can be used for binary I/O in Python
source
16.4 PyCall.ispynull
PyCall.ispynull — Method.
ispynull(o::PyObject)
16.5 PyCall.pybuiltin
PyCall.pybuiltin — Method.
pybuiltin(s::AbstractString)
16.6 PyCall.pybytes
PyCall.pybytes — Method.
pybytes(b::Union{String,DenseVector{UInt8}})
Convert b to a Python bytes object. This differs from the default PyObject(b)
conversion of String to a Python string (which may fail if b does not con-
tain valid Unicode), or from the default conversion of a Vector{UInt8} to a
bytearray object (which is mutable, unlike bytes).
source
16.7 PyCall.pycall
PyCall.pycall — Method.
Call the given Python function (typically looked up from a module) with
the given args. . . (of standard Julia types which are converted automatically
to the corresponding Python types if possible), converting the return value to
returntype (use a returntype of PyObject to return the unconverted Python
object reference, or of PyAny to request an automated conversion)
source
16.8 PyCall.pyeval
PyCall.pyeval — Function.
This evaluates s as a Python string and returns the result converted to rtype
(which defaults to PyAny). The remaining arguments are keywords that define
local variables to be used in the expression.
For example, pyeval("x + y", x=1, y=2) returns 3.
source
16.9 PyCall.pyfunction
PyCall.pyfunction — Method.
Create a Python object that wraps around the Julia function (or callable
object) f. Unlike PyObject(f), this allows you to specify the argument types
that the Julia function expects — giving you more control and potentially better
performance.
kwtypes... should be a set of somekeyword=SomeType arguments giving
the desired Julia type for each keyword somekeyword. Unspecified keywords are
converted to PyAny (i.e. auto-detected) by default.
The return value ret = f(...) is still converted back to a Python object by
PyObject(ret). If you want a different return-type conversion than the default
of PyObject(ret), you can instead call pyfunctionret.
source
16.10 PyCall.pyfunctionret
PyCall.pyfunctionret — Method.
Like pyfunction, but also lets you specify the returntype for conversion
back to Python. In particular, if ret = f(...) is the return value of f, then
it is converted to Python via PyObject(returntype(ret)).
If returntype is Any, then ret is not converted to a “native” Python type
at all, and is instead converted to a “wrapped” Julia object in Python. If
returntype is nothing, then the return value is discarded and nothing is re-
turned to Python.
source
16.11 PyCall.pygui
PyCall.pygui — Method.
pygui()
pygui_start(gui::Symbol = pygui())
pygui_stop(gui::Symbol = pygui())
Stop any running event loop for gui. The gui argument defaults to current
default GUI.
source
16.14 PyCall.pyimport
PyCall.pyimport — Method.
pyimport(s::AbstractString)
16.15. PYCALL.PYIMPORT CONDA 279
16.16 PyCall.pyimport e
PyCall.pyimport e — Method.
pyimport_e(s::AbstractString)
16.17 PyCall.pyrepr
PyCall.pyrepr — Method.
pyrepr(o::PyObject)
16.18 PyCall.pystr
PyCall.pystr — Method.
pystr(o::PyObject)
16.19 PyCall.pystring
PyCall.pystring — Method.
pystring(o::PyObject)
pytype_mapping(pytype, jltype)
pytype_query(o::PyObject, default=PyObject)
Given a Python object o, return the corresponding native Julia type (de-
faulting to default) that we convert o to in PyAny(o) conversions.
source
16.22. PYCALL.PYWRAP 281
16.22 PyCall.pywrap
PyCall.pywrap — Function.
pywrap(o::PyObject)
CategoricalArrays
17.1 CategoricalArrays.categorical
CategoricalArrays.categorical — Function.
17.2 CategoricalArrays.compress
CategoricalArrays.compress — Method.
compress(A::CategoricalArray)
282
17.3. CATEGORICALARRAYS.CUT 283
Return a copy of categorical array A using the smallest reference type able
to hold the number of levels of A.
While this will reduce memory use, this function is type-unstable, which can
affect performance inside the function where the call is made. Therefore, use it
with caution.
source
17.3 CategoricalArrays.cut
CategoricalArrays.cut — Method.
cut(x::AbstractArray, ngroups::Integer;
labels::AbstractVector=String[])
17.4 CategoricalArrays.cut
CategoricalArrays.cut — Method.
cut(x::AbstractArray, breaks::AbstractVector;
extend::Bool=false, labels::AbstractVector=[], allow_missing::Bool=false)
source
284 CHAPTER 17. CATEGORICALARRAYS
17.5 CategoricalArrays.decompress
CategoricalArrays.decompress — Method.
decompress(A::CategoricalArray)
Return a copy of categorical array A using the default reference type (UInt32).
If A is using a small reference type (such as UInt8 or UInt16) the decompressed
array will have room for more levels.
To avoid the need to call decompress, ensure compress is not called when
creating the categorical array.
source
17.6 CategoricalArrays.isordered
CategoricalArrays.isordered — Method.
isordered(A::CategoricalArray)
Test whether entries in A can be compared using <, > and similar operators,
using the ordering of levels.
source
17.7 CategoricalArrays.levels!
CategoricalArrays.levels! — Method.
levels!(A::CategoricalArray, newlevels::Vector; allow_missing::Bool=false)
Set the levels categorical array A. The order of appearance of levels will be
respected by levels, which may affect display of results in some operations; if
A is ordered (see isordered), it will also be used for order comparisons using <,
> and similar operators. Reordering levels will never affect the values of entries
in the array.
If A accepts missing values (i.e. eltype(A) >: Missing) and allow missing=true,
entries corresponding to omitted levels will be set to missing. Else, newlevels
must include all levels which appear in the data.
source
17.8 CategoricalArrays.ordered!
CategoricalArrays.ordered! — Method.
ordered!(A::CategoricalArray, ordered::Bool)
Set whether entries in A can be compared using <, > and similar operators,
using the ordering of levels. Return the modified A.
source
17.9. CATEGORICALARRAYS.RECODE 285
17.9 CategoricalArrays.recode
CategoricalArrays.recode — Function.
If a contains missing values, they are never replaced with default: use
missing in a pair to recode them. If that’s not the case, the returned array will
accept missing values.
Examples
0
0
0
-1
missing
7
8
-1
-1
source
17.10 CategoricalArrays.recode!
CategoricalArrays.recode! — Function.
Fill dest with elements from src, replacing those matching a key of pairs
with the corresponding value.
For each Pair in pairs, if the element is equal to (according to isequal))
the key (first item of the pair) or to one of its entries if it is a collection, then
the corresponding value (second item) is copied to dest. If the element matches
no key and default is not provided or nothing, it is copied as-is; if default
is specified, it is used in place of the original element. dest and src must be
of the same length, but not necessarily of the same type. Elements of src as
well as values from pairs will be converted when possible on assignment. If
an element matches more than one key, the first match is used.
If src contains missing values, they are never replaced with default: use
missing in a pair to recode them.
source
17.11 CategoricalArrays.recode!
CategoricalArrays.recode! — Method.
julia> x = collect(1:10);
julia> x
10-element Array{Int64,1}:
100
0
0
0
-1
6
7
8
-1
-1
source
17.12 Missings.levels
Missings.levels — Method.
levels(A::CategoricalArray)
Return the levels of categorical array A. This may include levels which do
not actually appear in the data (see droplevels!).
source
Chapter 18
GLM
18.1 GLM.canonicallink
GLM.canonicallink — Function.
canonicallink(D::Distribution)
Return the canonical link for distribution D, which must be in the exponential
family.
Examples
julia> canonicallink(Bernoulli())
GLM.LogitLink()
source
18.2 GLM.delbeta!
GLM.delbeta! — Function.
delbeta!(p::LinPred, r::Vector)
Evaluate and return p.delbeta the increment to the coefficient vector from
residual r
source
18.3 GLM.devresid
GLM.devresid — Function.
devresid(D, y, )
288
18.4. GLM.FTEST 289
source
18.4 GLM.ftest
GLM.ftest — Method.
ftest(mod::LinearModel...; atol=0::Real)
source
18.5 GLM.glmvar
GLM.glmvar — Function.
glmvar(D::Distribution, )
source
18.6 GLM.inverselink
GLM.inverselink — Function.
inverselink(L::Link, )
18.7. GLM.LINKFUN 291
Return a 3-tuple of the inverse link, the derivative of the inverse link, and
when appropriate, the variance function *(1 - ).
The variance function is returned as NaN unless the range of is (0, 1)
Examples
source
18.7 GLM.linkfun
GLM.linkfun — Function.
linkfun(L::Link, )
julia> = inv(10):inv(5):1
0.1:0.2:0.9
julia> show(linkfun.(LogitLink(), ))
[-2.19722, -0.847298, 0.0, 0.847298, 2.19722]
source
18.8 GLM.linkinv
GLM.linkinv — Function.
linkinv(L::Link, )
source
292 CHAPTER 18. GLM
18.9 GLM.linpred
GLM.linpred — Function.
linpred(p::LinPred, f::Read=1.0)
Return the linear predictor p.X * (p.beta0 .+ f * p.delbeta)
source
18.10 GLM.linpred!
GLM.linpred! — Function.
linpred!(out, p::LinPred, f::Real=1.0)
Overwrite out with the linear predictor from p with factor f
The effective coefficient vector, p.scratchbeta, is evaluated as p.beta0 .+
f * p.delbeta, and out is updated to p.X * p.scratchbeta
source
18.11 GLM.lm
GLM.lm — Function.
lm(X, y, allowrankdeficient::Bool=false)
An alias for fit(LinearModel, X, y, allowrankdeficient)
The arguments X and y can be a Matrix and a Vector or a Formula and a
DataFrame.
source
18.12 GLM.mueta
GLM.mueta — Function.
mueta(L::Link, )
Return the derivative of linkinv, d/d, for link L at linear predictor value .
Examples
julia> showcompact(mueta(LogitLink(), 0.0))
0.25
julia> showcompact(mueta(CloglogLink(), 0.0))
0.367879
julia> showcompact(mueta(LogLink(), 2.0))
7.38906
source
18.13. GLM.MUSTART 293
18.13 GLM.mustart
GLM.mustart — Function.
mustart(D::Distribution, y, wt)
Return a starting value for .
For some distributions it is appropriate to set = y to initialize the IRLS
algorithm but for others, notably the Bernoulli, the values of y are not allowed
as values of and must be modified.
Examples
julia> showcompact(mustart(Bernoulli(), 0.0, 1))
0.25
julia> showcompact(mustart(Bernoulli(), 1.0, 1))
0.75
julia> showcompact(mustart(Binomial(), 0.0, 10))
0.0454545
julia> showcompact(mustart(Normal(), 0.0, 1))
0.0
source
18.14 GLM.update!
GLM.update! — Function.
update!{T<:FPVector}(r::GlmResp{T}, linPr::T)
Update the mean, working weights and working residuals, in r given a value
of the linear predictor, linPr.
source
18.15 GLM.wrkresp
GLM.wrkresp — Method.
wrkresp(r::GlmResp)
The working response, r.eta + r.wrkresid - r.offset.
source
18.16 StatsBase.deviance
StatsBase.deviance — Method.
deviance(obj::LinearModel)
For linear models, the deviance is equal to the residual sum of squares (RSS).
source
294 CHAPTER 18. GLM
18.17 StatsBase.nobs
StatsBase.nobs — Method.
nobs(obj::LinearModel)
nobs(obj::GLM)
For linear and generalized linear models, returns the number of rows, or,
when prior weights are specified, the sum of weights.
source
18.18 StatsBase.nulldeviance
StatsBase.nulldeviance — Method.
nulldeviance(obj::LinearModel)
For linear models, the deviance of the null model is equal to the total sum
of squares (TSS).
source
18.19 StatsBase.predict
StatsBase.predict — Function.
Specifying interval type will return a 3-column matrix with the prediction
and the lower and upper confidence bounds for a given level (0.95 equates
alpha = 0.05). Valid values of interval type are :confint delimiting the
uncertainty of the predicted relationship, and :predint delimiting estimated
bounds for new data points.
source
18.20 StatsBase.predict
StatsBase.predict — Method.
Form the predicted response of model mm from covariate values newX and,
optionally, an offset.
source
Chapter 19
Roots
19.1 Roots.D
Roots.D — Function.
Take derivative of order k of a function.
Arguments:
295
296 CHAPTER 19. ROOTS
For more detail, see the help page for each method (e.g., ?Order5).
If no method is specified, the default method depends on x0:
• If x0 is a scalar, the default is the slower, but more robust Order0 method.
• If x0 is a tuple or vector indicating a bracketing interval, the Bisection
method is use. (this method specializes on floating point values, but oth-
erwise uses an algorithm of Alefeld, Potra, and Shi.)
Convergence
For most methods there are several heuristics used for convergence:
• if x n x {n-1}, using the tolerances xatol and xrtol, and f(x n) 0 with
a relaxed tolerance then convergence is declared.
• if the algorithm has an issue (say a value of NaN appears) and f(x n) 0
with a relaxed tolerance then convergence is declared, otherwise a failure
to converge is declared
# default methods
find_zero(sin, 3) # use Order0()
find_zero(sin, (3,4)) # use Bisection()
# specifying a method
find_zero(sin, 3.0, Order2()) # Use Steffensen method
find_zero(sin, big(3.0), Order16()) # rapid convergence
find_zero(sin, (3, 4), FalsePosition()) # fewer function calls than Bisection(), in this case
find_zero(sin, (3, 4), FalsePosition(8)) # 1 or 12 possible algorithms for false position
find_zero((sin,cos), 3.0, Roots.Newton()) # use Newton’s method
find_zero(sin, 3.0, Roots.Newton()) # use Newton’s method with automatic f’(x)
find_zero((sin, cos, x->-sin(x)), 3.0, Roots.Halley()) # use Halley’s method
# changing tolerances
fn, x0, xstar = (x -> (2x*cos(x) + x^2 - 3)^10/(x^2 + 1), 3.0, 2.9806452794385368)
find_zero(fn, x0, Order2()) - xstar # 0.011550654688925466
find_zero(fn, x0, Order2(), atol=0.0, rtol=0.0) # error: x_n x_{n-1}; just f(x_n) 0
fn, x0, xstar = (x -> (sin(x)*cos(x) - x^3 + 1)^9, 1.0, 1.117078770687451)
find_zero(fn, x0, Order2()) # 1.1122461983100858
find_zero(fn, x0, Order2(), maxevals=10) # Roots.ConvergenceFailed: 26 iterations needed
# tracing output
find_zero(x->sin(x), 3.0, Order2(), verbose=true) # 3 iterations
find_zero(x->sin(x)^5, 3.0, Order2(), verbose=true) # 23 iterations
source
298 CHAPTER 19. ROOTS
If there are many zeros relative to the number of points, the process is re-
peated with more points, in hopes of finding more zeros for oscillating functions.
Called by fzeros or Roots.find zeros.
source
19.4 Roots.fzero
Roots.fzero — Method.
Find zero of a function within a bracket
Uses a modified bisection method for non big arguments
Arguments:
source
19.5. ROOTS.FZERO 299
19.5 Roots.fzero
Roots.fzero — Method.
Find zero of a function using an iterative algorithm
Keyword arguments:
• ftol: tolerance for a guess abs(f(x)) < ftol + max(1, |xnew|) * ftolrel
19.6 Roots.fzero
Roots.fzero — Method.
Find zero using Newton’s method.
source
19.7 Roots.fzero
Roots.fzero — Method.
Find a zero within a bracket with an initial guess to possibly speed things
along.
source
300 CHAPTER 19. ROOTS
19.8 Roots.fzeros
Roots.fzeros — Method.
fzeros(f, a, b)
Attempt to find all zeros of f within an interval [a,b].
Simple algorithm that splits [a,b] into subintervals and checks each for a
root. For bracketing subintervals, bisection is used. Otherwise, a derivative-
free method is used. If there are a large number of zeros found relative to the
number of subintervals, the number of subintervals is increased and the process
is re-run.
There are possible issues with close-by zeros and zeros which do not cross the
origin (non-simple zeros). Answers should be confirmed graphically, if possible.
source
19.9 Roots.halley
Roots.halley — Method.
Implementation of Halley’s method. xn1 = xn - 2f(xn)*f(xn) / (2*f(xn)^2
- f(xn) * f(xn))
Arguments:
19.10 Roots.newton
Roots.newton — Method.
Implementation of Newton’s method: x n1 = x n - f(x n)/ f(x n)
Arguments:
Documenter
20.1 Documenter.deploydocs
Documenter.deploydocs — Method.
deploydocs(
root = "<current-directory>",
target = "site",
repo = "<required>",
branch = "gh-pages",
latest = "master",
osname = "linux",
julia = "<required>",
deps = <Function>,
make = <Function>,
)
302
20.2. DOCUMENTER.HIDE 303
root has the same purpose as the root keyword for makedocs.
target is the directory, relative to root, where generated HTML content
should be written to. This directory must be added to the repository’s .gitignore
file. The default value is "site".
branch is the branch where the generated documentation is pushed. If the
branch does not exist, a new orphaned branch is created automatically. It
defaults to "gh-pages".
latest is the branch that “tracks” the latest generated documentation. By
default this value is set to "master".
osname is the operating system which will be used to deploy generated docu-
mentation. This defaults to "linux". This value must be one of those specified
in the os: section of the .travis.yml configuration file.
deps is the function used to install any dependencies needed to build the
documentation. By default this function installs pygments and mkdocs using
the Deps.pip function:
[] deps = Deps.pip(”pygments”, ”mkdocs”)
make is the function used to convert the markdown files to HTML. By default
this just runs mkdocs build which populates the target directory.
See Also
The Hosting Documentation section of the manual provides a step-by-step
guide to using the deploydocs function to automatically generate docs and
push them to GitHub.
source
20.2 Documenter.hide
Documenter.hide — Method.
[] hide(root, children)
Allows a subsection of pages to be hidden from the navigation menu. root
will be linked to in the navigation menu, with the title determined as usual.
children should be a list of pages (note that it can not be hierarchical).
Usage
[] makedocs( ..., pages = [ ..., hide(”Hidden section” =¿ ”hiddeni ndex.md”, [”hidden1.md”,”Hidden2”=>”hidde
source
20.3 Documenter.hide
Documenter.hide — Method.
[] hide(page)
Allows a page to be hidden in the navigation menu. It will only show up if
it happens to be the current page. The hidden page will still be present in the
linear page list that can be accessed via the previous and next page links. The
title of the hidden page can be overriden using the => operator as usual.
304 CHAPTER 20. DOCUMENTER
Usage
[] makedocs( ..., pages = [ ..., hide(”page1.md”), hide(”Title” =¿
”page2.md”) ] )
source
20.4 Documenter.makedocs
Documenter.makedocs — Method.
makedocs(
root = "<current-directory>",
source = "src",
build = "build",
clean = true,
doctest = true,
modules = Module[],
repo = "",
)
docs/
build/
src/
make.jl
Keywords
root is the directory from which makedocs should run. When run from a
make.jl file this keyword does not need to be set. It is, for the most part,
needed when repeatedly running makedocs from the Julia REPL like so:
source is the directory, relative to root, where the markdown source files
are read from. By convention this folder is called src. Note that any non-
markdown files stored in source are copied over to the build directory when
makedocs is run.
build is the directory, relative to root, into which generated files and folders
are written when makedocs is run. The name of the build directory is, by
convention, called build, though, like with source, users are free to change
this to anything else to better suit their project needs.
20.4. DOCUMENTER.MAKEDOCS 305
clean tells makedocs whether to remove all the content from the build
folder prior to generating new content from source. By default this is set to
true.
doctest instructs makedocs on whether to try to test Julia code blocks
that are encountered in the generated document. By default this keyword is
set to true. Doctesting should only ever be disabled when initially setting
up a newly developed package where the developer is just trying to get their
package and documentation structure correct. After that, it’s encouraged to
always make sure that documentation examples are runnable and produce the
expected results. See the Doctests manual section for details about running
doctests.
modules specifies a vector of modules that should be documented in source.
If any inline docstrings from those modules are seen to be missing from the
generated content then a warning will be printed during execution of makedocs.
By default no modules are passed to modules and so no warnings will appear.
This setting can be used as an indicator of the “coverage” of the generated
documentation. For example Documenter’s make.jl file contains:
[] makedocs( modules = [Documenter], ... )
and so any docstring from the module Documenter that is not spliced into
the generated documentation in build will raise a warning.
repo specifies a template for the “link to source” feature. If you are using
GitHub, this is automatically generated from the remote. If you are using a
different host, you can use this option to tell Documenter how URLs should be
generated. The following placeholders will be replaced with the respective value
of the generated link:
Experimental keywords
In addition to standard arguments there is a set of non-finalized experimental
keyword arguments. The behaviour of these may change or they may be removed
without deprecation when a minor version changes (i.e. except in patch releases).
checkdocs instructs makedocs to check whether all names within the mod-
ules defined in the modules keyword that have a docstring attached have the
docstring also listed in the manual (e.g. there’s a @docs blocks with that doc-
string). Possible values are :all (check all names) and :exports (check only
exported names). The default value is :none, in which case no checks are per-
formed. If strict is also enabled then the build will fail if any missing docstrings
are encountered.
306 CHAPTER 20. DOCUMENTER
linkcheck – if set to true makedocs uses curl to check the status codes of
external-pointing links, to make sure that they are up-to-date. The links and
their status codes are printed to the standard output. If strict is also enabled
then the build will fail if there are any broken (400+ status code) links. Default:
false.
linkcheck ignore allows certain URLs to be ignored in linkcheck. The
values should be a list of strings (which get matched exactly) or Regex objects.
By default nothing is ignored.
strict – makedocs fails the build right before rendering if it encountered
any errors with the document in the previous build phases.
Non-MkDocs builds
Documenter also has (experimental) support for native HTML and LaTeX
builds. These can be enabled using the format keyword and they generally re-
quire additional keywords be defined, depending on the format. These keywords
are also currently considered experimental.
format allows the output format to be specified. Possible values are :html,
:latex and :markdown (default).
Other keywords related to non-MkDocs builds (assets, sitename, analytics,
authors, pages, version) should be documented at the respective *Writer
modules (Writers.HTMLWriter, Writers.LaTeXWriter).
See Also
A guide detailing how to document a package using Documenter’s makedocs
is provided in the Usage section of the manual.
source
Chapter 21
ColorTypes
21.1 ColorTypes.alpha
ColorTypes.alpha — Method.
alpha(p) extracts the alpha component of a color. For a color without an
alpha channel, it will always return 1.
source
21.2 ColorTypes.alphacolor
ColorTypes.alphacolor — Function.
alphacolor(RGB) returns ARGB, i.e., the corresponding transparent color
type with storage order (alpha, color).
source
color_type(RGB{N0f8}) == RGB{N0f8}
base_color_type(RGB{N0f8}) == RGB
This can be very handy if you want to switch element types. For example:
c64 = base_color_type(c){Float64}(color(c))
307
308 CHAPTER 21. COLORTYPES
base_color_type(ARGB{N0f8}) == RGB
base_colorant_type(ARGB{N0f8}) == ARGB
If you just want to switch element types, this is the safest default and the
easiest to use:
c64 = base_colorant_type(c){Float64}(c)
source
21.5 ColorTypes.blue
ColorTypes.blue — Method.
blue(c) returns the blue component of an AbstractRGB opaque or trans-
parent color.
source
21.6 ColorTypes.ccolor
ColorTypes.ccolor — Method.
ccolor (“concrete color”) helps write flexible methods. The idea is that
users may write convert(HSV, c) or even convert(Array{HSV}, A) without
specifying the element type explicitly (e.g., convert(Array{HSV{Float32}},
A)). ccolor implements the logic “choose the user’s eltype if specified, otherwise
retain the eltype of the source object.” However, when the source object has
FixedPoint element type, and the destination only supports AbstractFloat, we
choose Float32.
Usage:
Example:
21.7 ColorTypes.color
ColorTypes.color — Method.
color(c) extracts the opaque color component from a Colorant (e.g., omits
the alpha channel, if present).
source
color_type(RGB) == RGB
color_type(RGB{Float32}) == RGB{Float32}
color_type(ARGB{N0f8}) == RGB{N0f8}
source
21.9 ColorTypes.coloralpha
ColorTypes.coloralpha — Function.
coloralpha(RGB) returns RGBA, i.e., the corresponding transparent color
type with storage order (color, alpha).
source
21.10 ColorTypes.comp1
ColorTypes.comp1 — Method.
comp1(c) extracts the first component you’d pass to the constructor of the
corresponding object. For most color types without an alpha channel, this is
just the first field, but for types like BGR that reverse the internal storage order
this provides the value that you’d use to reconstruct the color.
Specifically, for any Color{T,3},
returns true.
source
310 CHAPTER 21. COLORTYPES
21.11 ColorTypes.comp2
ColorTypes.comp2 — Method.
comp2(c) extracts the second constructor argument (see comp1).
source
21.12 ColorTypes.comp3
ColorTypes.comp3 — Method.
comp3(c) extracts the third constructor argument (see comp1).
source
21.13 ColorTypes.gray
ColorTypes.gray — Method.
gray(c) returns the gray component of a grayscale opaque or transparent
color.
source
21.14 ColorTypes.green
ColorTypes.green — Method.
green(c) returns the green component of an AbstractRGB opaque or trans-
parent color.
source
21.15 ColorTypes.mapc
ColorTypes.mapc — Method.
mapc(f, rgb) -> rgbf
mapc(f, rgb1, rgb2) -> rgbf
mapc applies the function f to each color channel of the input color(s), re-
turning an output color in the same colorspace.
Examples:
julia> mapc(x->clamp(x,0,1), RGB(-0.2,0.3,1.2))
RGB{Float64}(0.0,0.3,1.0)
source
21.16 ColorTypes.mapreducec
ColorTypes.mapreducec — Method.
Reduce across color channels of c with the binary operator op, first applying
f to each channel. v0 is the neutral element used to initiate the reduction. For
grayscale,
If c has an alpha channel, it is always the last one to be folded into the
reduction.
source
21.17 ColorTypes.red
ColorTypes.red — Method.
red(c) returns the red component of an AbstractRGB opaque or transparent
color.
source
21.18 ColorTypes.reducec
ColorTypes.reducec — Method.
reducec(op, v0, c)
Reduce across color channels of c with the binary operator op. v0 is the
neutral element used to initiate the reduction. For grayscale,
If c has an alpha channel, it is always the last one to be folded into the
reduction.
source
Chapter 22
FileIO
22.1 Base.info
Base.info — Method.
info(fmt) returns the magic bytes/extension information for DataFormat
fmt.
source
312
22.4. FILEIO.ADD SAVER 313
22.8 FileIO.filename
FileIO.filename — Method.
filename(file) returns the filename associated with File file.
source
22.9 FileIO.filename
FileIO.filename — Method.
filename(stream) returns a string of the filename associated with Stream
stream, or nothing if there is no file associated.
source
314 CHAPTER 22. FILEIO
22.10 FileIO.load
FileIO.load — Function.
source
22.11 FileIO.loadstreaming
FileIO.loadstreaming — Function.
Some packages may implement a streaming API, where the contents of the
file can be read in chunks and processed, rather than all at once. Reading from
these higher-level streams should return a formatted object, like an image or
chunk of video or audio.
the format from filename and/or magic bytes in the file. It returns a stream-
ing type that can be read from in chunks, rather than loading the whole contents
all at once
bypasses inference.
22.12. FILEIO.MAGIC 315
22.12 FileIO.magic
FileIO.magic — Method.
magic(fmt) returns the magic bytes of format fmt
source
22.13 FileIO.query
FileIO.query — Method.
query(filename) returns a File object with information about the format
inferred from the file’s extension and/or magic bytes.
source
22.14 FileIO.query
FileIO.query — Method.
query(io, [filename]) returns a Stream object with information about
the format inferred from the magic bytes.
source
22.15 FileIO.save
FileIO.save — Function.
• save(filename, data...) saves the contents of a formatted file,
trying to infer the format from filename.
• save(Stream(format"PNG",io), data...) specifies the format directly,
and bypasses inference.
• save(File(format"PNG",filename), data...) specifies the format di-
rectly, and bypasses inference.
• save(f, data...; options...) passes keyword arguments on to the
saver.
source
316 CHAPTER 22. FILEIO
22.16 FileIO.savestreaming
FileIO.savestreaming — Function.
Some packages may implement a streaming API, where the contents of the
file can be written in chunks, rather than all at once. These higher-level streams
should accept formatted objects, like an image or chunk of video or audio.
bypasses inference.
bypasses inference.
source
22.17 FileIO.skipmagic
FileIO.skipmagic — Method.
skipmagic(s) sets the position of Stream s to be just after the magic bytes.
For a plain IO object, you can use skipmagic(io, fmt).
source
22.18 FileIO.stream
FileIO.stream — Method.
stream(s) returns the stream associated with Stream s
source
22.19 FileIO.unknown
FileIO.unknown — Method.
unknown(f) returns true if the format of f is unknown.
source
Chapter 23
DataArrays
23.1 DataArrays.PooledDataVecs
DataArrays.PooledDataVecs — Method.
23.2 DataArrays.compact
DataArrays.compact — Method.
compact(d::PooledDataArray)
Return a PooledDataArray with the smallest possible reference type for the
data in d.
!!! note If the reference type is already the smallest possible for the data,
the input array is returned, i.e. the function aliases the input.
Examples
317
318 CHAPTER 23. DATAARRAYS
"B"
julia> compact(p) # second type parameter compacts to UInt8 (only need 2 unique values)
8-element DataArrays.PooledDataArray{String,UInt8,1}:
"A"
"B"
"A"
"B"
"A"
"B"
"A"
"B"
source
23.3 DataArrays.cut
DataArrays.cut — Method.
Divide the range of x into intervals based on the cut points specified in
breaks, or into ngroups intervals of approximately equal length.
Examples
source
23.4 DataArrays.data
DataArrays.data — Method.
Convert a to a DataArray.
Examples
23.5. DATAARRAYS.GETPOOLIDX 319
source
23.5 DataArrays.getpoolidx
DataArrays.getpoolidx — Method.
getpoolidx(pda::PooledDataArray, val)
Return the index of val in the value pool for pda. If val is not already in
the value pool, pda is modified to include it in the pool.
source
23.6 DataArrays.gl
DataArrays.gl — Method.
julia> gl(2, 1)
2-element DataArrays.PooledDataArray{Int64,UInt8,1}:
1
2
julia> gl(2, 1, 4)
4-element DataArrays.PooledDataArray{Int64,UInt8,1}:
1
2
1
2
source
320 CHAPTER 23. DATAARRAYS
23.7 DataArrays.padmissing
DataArrays.padmissing — Method.
source
23.8 DataArrays.reorder
DataArrays.reorder — Method.
Return a PooledDataArray containing the same data as x but with the value
pool sorted.
source
23.9 DataArrays.replace!
DataArrays.replace! — Method.
23.10 DataArrays.setlevels!
DataArrays.setlevels! — Method.
source
23.11 DataArrays.setlevels
DataArrays.setlevels — Method.
Create a new PooledDataArray based on x but with the new value pool
specified by newpool. The values can be replaced using a mapping specified in
a Dict or with an array, since the order of the levels is used to identify values.
The pool can be enlarged to contain values not present in the data, but it cannot
be reduced to exclude present values.
Examples
"A"
"B"
"B"
"B"
julia> p3.pool # the pool can contain values not in the array
3-element Array{String,1}:
"C"
"D"
"E"
source
23.12 Missings.ismissing
Missings.ismissing — Method.
ismissing(a::AbstractArray, i) -> Bool
Determine whether the element of a at index i is missing, i.e. missing.
Examples
julia> X = @data [1, 2, missing];
julia> ismissing(X, 2)
false
julia> ismissing(X, 3)
true
23.12. MISSINGS.ISMISSING 323
source
Chapter 24
Primes
24.1 Primes.factor
Primes.factor — Method.
24.2 Primes.factor
Primes.factor — Method.
324
24.3. PRIMES.ISMERSENNEPRIME 325
24.3 Primes.ismersenneprime
Primes.ismersenneprime — Method.
ismersenneprime(M::Integer; [check::Bool = true]) -> Bool
Lucas-Lehmer deterministic test for Mersenne primes. M must be a Mersenne
number, i.e. of the form M = 2^p - 1, where p is a prime number. Use the key-
word argument check to enable/disable checking whether M is a valid Mersenne
number; to be used with caution. Return true if the given Mersenne number
is prime, and false otherwise.
julia> ismersenneprime(2^11 - 1)
false
julia> ismersenneprime(2^13 - 1)
true
source
24.4 Primes.isprime
Primes.isprime — Function.
isprime(x::BigInt, [reps = 25]) -> Bool
Probabilistic primality test. Returns true if x is prime with high probability
(pseudoprime); and false if x is composite (not prime). The false positive rate
is about 0.25^reps. reps = 25 is considered safe for cryptographic applications
(Knuth, Seminumerical Algorithms).
[] julia¿ isprime(big(3)) true
source
24.5 Primes.isprime
Primes.isprime — Method.
isprime(n::Integer) -> Bool
Returns true if n is prime, and false otherwise.
[] julia¿ isprime(3) true
source
326 CHAPTER 24. PRIMES
24.6 Primes.isrieselprime
Primes.isrieselprime — Method.
source
24.7 Primes.nextprime
Primes.nextprime — Function.
nextprime(n::Integer, i::Integer=1)
The i-th smallest prime not less than n (in particular, nextprime(p) == p
if p is prime). If i < 0, this is equivalent to prevprime(n, -i). Note that for
n::BigInt, the returned number is only a pseudo-prime (the function isprime
is used internally). See also prevprime.
julia> nextprime(4)
5
julia> nextprime(5)
5
julia> nextprime(4, 2)
7
julia> nextprime(5, 2)
7
source
24.8. PRIMES.PREVPRIME 327
24.8 Primes.prevprime
Primes.prevprime — Function.
prevprime(n::Integer, i::Integer=1)
The i-th largest prime not greater than n (in particular prevprime(p) == p
if p is prime). If i < 0, this is equivalent to nextprime(n, -i). Note that for
n::BigInt, the returned number is only a pseudo-prime (the function isprime
is used internally). See also nextprime.
julia> prevprime(4)
3
julia> prevprime(5)
5
julia> prevprime(5, 2)
3
source
24.9 Primes.prime
Primes.prime — Method.
prime(::Type{<:Integer}=Int, i::Integer)
julia> prime(1)
2
julia> prime(3)
5
source
24.10 Primes.primes
Primes.primes — Method.
primes([lo,] hi)
24.11 Primes.primesmask
Primes.primesmask — Method.
primesmask([lo,] hi)
24.12 Primes.prodfactors
Primes.prodfactors — Function.
prodfactors(factors)
julia> prodfactors(factor(100))
100
source
24.13 Primes.radical
Primes.radical — Method.
radical(n::Integer)
julia> radical(2*2*3)
6
source
24.14. PRIMES.TOTIENT 329
24.14 Primes.totient
Primes.totient — Method.
Compute the Euler totient function (n), which counts the number of positive
integers less than or equal to n that are relatively prime to n (that is, the number
of positive integers m n with gcd(m, n) == 1). The totient function of n when
n is negative is defined to be totient(abs(n)).
source
24.15 Primes.totient
Primes.totient — Method.
totient(f::Factorization{T}) -> T
Compute the Euler totient function of the number whose prime factorization
is given by f. This method may be preferable to totient(::Integer) when
the factorization can be reused for other purposes.
source
Chapter 25
ImageTransformations
25.1 ImageTransformations.imresize
ImageTransformations.imresize — Method.
Change img to be of size sz (or to have indices inds). This interpolates the
values at sub-pixel locations. If you are shrinking the image, you risk aliasing
unless you low-pass filter img first. For example:
25.2 ImageTransformations.invwarpedview
ImageTransformations.invwarpedview — Method.
Create a view of img that lazily transforms any given index I passed to
wv[I] to correspond to img[inv(tinv)(I)]. While technically this approach
is known as backward mode warping, note that InvWarpedView is created by
supplying the forward transformation. The given transformation tinv must
accept a SVector as input and support inv(tinv). A useful package to create
a wide variety of such transformations is CoordinateTransformations.jl.
When invoking wv[I], values for img must be reconstructed at arbitrary lo-
cations inv(tinv)(I). InvWarpedView serves as a wrapper around WarpedView
330
25.3. IMAGETRANSFORMATIONS.RESTRICT 331
which takes care of interpolation and extrapolation. The parameters degree and
fill can be used to specify the b-spline degree and the extrapolation scheme
respectively.
The optional parameter indices can be used to specify the domain of the
resulting wv. By default the indices are computed in such a way that wv contains
all the original pixels in img.
source
25.3 ImageTransformations.restrict
ImageTransformations.restrict — Method.
Reduce the size of img by two-fold along the dimensions listed in region, or
all spatial coordinates if region is not specified. It anti-aliases the image as it
goes, so is better than a naive summation over 2x2 blocks.
See also imresize.
source
25.4 ImageTransformations.warp
ImageTransformations.warp — Method.
julia> indices(img)
(Base.OneTo(512),Base.OneTo(768))
julia> indices(imgw)
(-196:709,-68:837)
julia> indices(imgw)
(-293:612,-293:611)
julia> indices(imgr)
(Base.OneTo(906),Base.OneTo(905))
source
25.5 ImageTransformations.warpedview
ImageTransformations.warpedview — Method.
25.5. IMAGETRANSFORMATIONS.WARPEDVIEW 333
Create a view of img that lazily transforms any given index I passed to
wv[I] to correspond to img[tform(I)]. This approach is known as backward
mode warping. The given transformation tform must accept a SVector as
input. A useful package to create a wide variety of such transformations is
CoordinateTransformations.jl.
When invoking wv[I], values for img must be reconstructed at arbitrary
locations tform(I) which do not lie on to the lattice of pixels. How this re-
construction is done depends on the type of img and the optional parameter
degree. When img is a plain array, then on-grid b-spline interpolation will
be used, where the pixel of img will serve as the coeficients. It is possible to
configure what degree of b-spline to use with the parameter degree. The two
possible values are degree = Linear() for linear interpolation, or degree =
Constant() for nearest neighbor interpolation.
In the case tform(I) maps to indices outside the domain of img, those
locations are set to a value fill (which defaults to NaN if the element type
supports it, and 0 otherwise). Additionally, the parameter fill also accepts
extrapolation schemes, such as Flat(), Periodic() or Reflect().
The optional parameter indices can be used to specify the domain of the
resulting WarpedView. By default the indices are computed in such a way that
the resulting WarpedView contains all the original pixels in img. To do this
inv(tform) has to be computed. If the given transformation tform does not
support inv, then the parameter indices has to be specified manually.
warpedview is essentially a non-coping, lazy version of warp. As such,
the two functions share the same interface, with one important difference.
warpedview will insist that the resulting WarpedView will be a view of img
(i.e. parent(warpedview(img, ...)) === img). Consequently, warpedview
restricts the parameter degree to be either Linear() or Constant().
source
Chapter 26
StatsFuns
26.1 StatsFuns.log1mexp
StatsFuns.log1mexp — Method.
log1mexp(x::Real)
26.2 StatsFuns.log1pexp
StatsFuns.log1pexp — Method.
log1pexp(x::Real)
26.3 StatsFuns.log1pmx
StatsFuns.log1pmx — Method.
log1pmx(x::Float64)
334
26.4. STATSFUNS.LOG1PSQ 335
Return log(1 + x) - x
Use naive calculation or range reduction outside kernel range. Accurate
˜2ulps for all x.
source
26.4 StatsFuns.log1psq
StatsFuns.log1psq — Method.
log1psq(x::Real)
Return log(1+x^2) evaluated carefully for abs(x) very small or very large.
source
26.5 StatsFuns.log2mexp
StatsFuns.log2mexp — Method.
log2mexp(x::Real)
26.6 StatsFuns.logaddexp
StatsFuns.logaddexp — Method.
logaddexp(x::Real, y::Real)
26.7 StatsFuns.logexpm1
StatsFuns.logexpm1 — Method.
logexpm1(x::Real)
26.8 StatsFuns.logistic
StatsFuns.logistic — Method.
logistic(x::Real)
The logistic sigmoid function mapping a real number to a value in the interval
[0,1],
1 ex
σ(x) = = .
e−x + 1 1 + ex
Its inverse is the logit function.
source
26.9 StatsFuns.logit
StatsFuns.logit — Method.
logit(p::Real)
26.10 StatsFuns.logmvgamma
StatsFuns.logmvgamma — Method.
logmvgamma(p::Int, a::Real)
26.11 StatsFuns.logmxp1
StatsFuns.logmxp1 — Method.
logmxp1(x::Float64)
26.12 StatsFuns.logsumexp
StatsFuns.logsumexp — Method.
logsumexp(X)
lstirling_asym(x)
For sufficiently large x, this can be approximated using the asymptotic Stir-
ling’s series (DLMF 5.11.1):
1 1 1 1
− + − + ...
12x 360x3 1260x5 1680x7
The truncation error is bounded by the first omitted term, and is of the
same sign.
Relative error of approximation is bounded by (174611/125400 xˆ-19) /
(1/12 xˆ-1 - 1/360 xˆ-3) which is < 1/2 ulp for x >= 10.0, and total numeric
error appears to be < 2 ulps
References
source
338 CHAPTER 26. STATSFUNS
26.14 StatsFuns.softmax!
StatsFuns.softmax! — Method.
softmax(x::AbstractArray{<:Real})
26.15 StatsFuns.softmax!
StatsFuns.softmax! — Method.
softmax!(r::AbstractArray, x::AbstractArray)
26.16 StatsFuns.xlogx
StatsFuns.xlogx — Method.
xlogx(x::Real)
julia> StatsFuns.xlogx(0)
0.0
source
26.17 StatsFuns.xlogy
StatsFuns.xlogy — Method.
xlogy(x::Real, y::Real)
Gadfly
27.1 Compose.draw
Compose.draw — Method.
draw(backend::Compose.Backend, p::Plot)
source
27.2 Compose.hstack
Compose.hstack — Method.
hstack(ps::Union{Plot,Context}...)
hstack(ps::Vector)
339
340 CHAPTER 27. GADFLY
27.3 Compose.vstack
Compose.vstack — Method.
vstack(ps::Union{Plot,Context}...)
vstack(ps::Vector)
27.4 Gadfly.layer
Gadfly.layer — Method.
Returns
An array of layers
source
27.5 Gadfly.plot
Gadfly.plot — Method.
Returns:
A Plot object.
source
27.6 Gadfly.plot
Gadfly.plot — Method.
source
27.7 Gadfly.render
Gadfly.render — Method.
render(plot::Plot)
Returns
A Compose context containing the rendered plot.
source
342 CHAPTER 27. GADFLY
set_default_plot_format(fmt::Symbol)
set_default_plot_size(width::Compose.MeasureOrNumber, height::Compose.MeasureOrNumber)
Sets preferred canvas size when rendering a plot without an explicit call to
draw
source
27.10 Gadfly.spy
Gadfly.spy — Method.
• the axes run from 0.5 to N+0.5, because the first row/column is drawn to
• NaNs are not drawn. spy leaves “holes” instead into the heatmap.
Args:
• M: A matrix.
27.11. GADFLY.STYLE 343
Returns:
A plot object.
Known bugs:
source
27.11 Gadfly.style
Gadfly.style — Method.
Set some attributes in the current Theme. See Theme for available field.
source
27.12 Gadfly.title
Gadfly.title — Method.
Add a title string to a group of plots, typically created with vstack, hstack,
or gridstack.
Examples
source
Chapter 28
IterTools
28.1 IterTools.chain
IterTools.chain — Method.
chain(xs...)
source
28.2 IterTools.distinct
IterTools.distinct — Method.
distinct(xs)
344
28.3. ITERTOOLS.GROUPBY 345
i = 2
i = 4
i = 3
source
28.3 IterTools.groupby
IterTools.groupby — Method.
groupby(f, xs)
julia> for i in groupby(x -> x[1], ["face", "foo", "bar", "book", "baz", "zzz"])
@show i
end
i = String["face","foo"]
i = String["bar","book","baz"]
i = String["zzz"]
source
28.4 IterTools.imap
IterTools.imap — Method.
source
28.5 IterTools.iterate
IterTools.iterate — Method.
iterate(f, x)
346 CHAPTER 28. ITERTOOLS
source
28.6 IterTools.ncycle
IterTools.ncycle — Method.
ncycle(xs, n)
source
28.7. ITERTOOLS.NTH 347
28.7 IterTools.nth
IterTools.nth — Method.
nth(xs, n)
Return the nth element of xs. This is mostly useful for non-indexable col-
lections.
julia> nth(mersenne, 3)
3
source
28.8 IterTools.partition
IterTools.partition — Method.
partition(xs, n, [step])
i = (7,8,9)
source
28.9 IterTools.peekiter
IterTools.peekiter — Method.
peekiter(xs)
Lets you peek at the head element of an iterator without updating the state.
julia> s = start(it)
(2,Nullable{String}("face"))
julia> x, s = next(it, s)
("face",(3,Nullable{String}("foo"),false))
julia> @show x
x = "face"
"face"
source
28.10. ITERTOOLS.PRODUCT 349
28.10 IterTools.product
IterTools.product — Method.
product(xs...)
source
28.11 IterTools.repeatedly
IterTools.repeatedly — Method.
repeatedly(f, n)
28.12 IterTools.subsets
IterTools.subsets — Method.
subsets(xs)
subsets(xs, k)
Iterate over every subset of the collection xs. You can restrict the subsets
to a specific size k.
i = [2]
i = [1,2]
i = [3]
i = [1,3]
i = [2,3]
i = [1,2,3]
source
28.13 IterTools.takenth
IterTools.takenth — Method.
takenth(xs, n)
julia> collect(takenth(5:15,3))
3-element Array{Int64,1}:
7
10
13
source
28.14 IterTools.takestrict
IterTools.takestrict — Method.
takestrict(xs, n::Int)
Like take(), an iterator that generates at most the first n elements of xs,
but throws an exception if fewer than n items are encountered in xs.
28.14. ITERTOOLS.TAKESTRICT 351
julia> a = :1:2:11
1:2:11
source
Chapter 29
Polynomials
29.1 Polynomials.coeffs
Polynomials.coeffs — Method.
coeffs(p::Poly)
29.2 Polynomials.degree
Polynomials.degree — Method.
degree(p::Poly)
Return the degree of the polynomial p, i.e. the highest exponent in the
polynomial that has a nonzero coefficient. The degree of the zero polynomial is
defined to be -1.
source
29.3 Polynomials.poly
Polynomials.poly — Method.
poly(r)
Construct a polynomial from its roots. Compare this to the Poly type
constructor, which constructs a polynomial from its coefficients.
If r is a vector, the constructed polynomial is (x − r1 )(x − r2 ) · · · (x − rn ).
If r is a matrix, the constructed polynomial is (x − e1 ) · · · (x − en ), where ei is
the ith eigenvalue of r.
352
29.4. POLYNOMIALS.POLYDER 353
Examples
[] julia¿ poly([1, 2, 3]) The polynomial (x - 1)(x - 2)(x - 3) Poly(-6 + 11x -
6x2+x3)
julia¿ poly([1 2; 3 4]) The polynomial (x - 5.37228)(x + 0.37228) Poly(-
1.9999999999999998 - 5.0x + 1.0x2)
source
29.4 Polynomials.polyder
Polynomials.polyder — Method.
polyder(p::Poly, k=1)
29.5 Polynomials.polyfit
Polynomials.polyfit — Function.
29.6 Polynomials.polyint
Polynomials.polyint — Method.
Compute the definite integral of the polynomial p over the interval [a,b].
Examples
[] julia¿ polyint(Poly([1, 0, -1]), 0, 1) 0.6666666666666667
source
354 CHAPTER 29. POLYNOMIALS
29.7 Polynomials.polyint
Polynomials.polyint — Method.
polyint(p::Poly, k::Number=0)
29.8 Polynomials.polyval
Polynomials.polyval — Method.
polyval(p::Poly, x::Number)
29.9 Polynomials.printpoly
Polynomials.printpoly — Method.
source
29.10. POLYNOMIALS.ROOTS 355
29.10 Polynomials.roots
Polynomials.roots — Method.
roots(p::Poly)
Return the roots (zeros) of p, with multiplicity. The number of roots re-
turned is equal to the order of p. The returned roots may be real or complex.
Examples
[] julia¿ roots(Poly([1, 0, -1])) 2-element Array{Float64,1}: -1.0 1.0
julia¿ roots(Poly([1, 0, 1])) 2-element Array{Complex{Float64},1}: 0.0+1.0im
0.0-1.0im
julia¿ roots(Poly([0, 0, 1])) 2-element Array{Float64,1}: 0.0 0.0
julia¿ roots(poly([1,2,3,4])) 4-element Array{Float64,1}: 4.0 3.0 2.0 1.0
source
29.11 Polynomials.variable
Polynomials.variable — Method.
variable(p::Poly)
variable([T::Type,] var)
variable()
Colors
30.1 Base.hex
Base.hex — Method.
hex(c)
30.2 Colors.MSC
Colors.MSC — Method.
MSC(h)
MSC(h, l)
Calculates the most saturated color for any given hue h by finding the cor-
responding corner in LCHuv space. Optionally, the lightness l may also be
specified.
source
30.3 Colors.colordiff
Colors.colordiff — Method.
colordiff(a, b)
colordiff(a, b, metric)
356
30.4. COLORS.COLORMAP 357
30.4 Colors.colormap
Colors.colormap — Function.
30.5 Colors.colormatch
Colors.colormatch — Method.
colormatch(wavelength)
colormatch(matchingfunction, wavelength)
30.6 Colors.deuteranopic
Colors.deuteranopic — Method.
358 CHAPTER 30. COLORS
deuteranopic(c)
deuteranopic(c, p)
Convert a color to simulate deuteranopic color deficiency (lack of the middle-
wavelength photopigment). See the description of protanopic for detail about
the arguments.
source
30.8 Colors.protanopic
Colors.protanopic — Method.
protanopic(c)
protanopic(c, p)
Convert a color to simulate protanopic color deficiency (lack of the long-
wavelength photopigment). c is the input color; the optional argument p is the
fraction of photopigment loss, in the range 0 (no loss) to 1 (complete loss).
source
30.9. COLORS.TRITANOPIC 359
30.9 Colors.tritanopic
Colors.tritanopic — Method.
tritanopic(c)
tritanopic(c, p)
Returns the color w1*c1 + (1-w1)*c2 that is the weighted mean of c1 and
c2, where c1 has a weight 0 w1 1.
source
30.11 Colors.whitebalance
Colors.whitebalance — Method.
Whitebalance a color.
Input a source (adopted) and destination (reference) white. E.g., if you have
a photo taken under florencent lighting that you then want to appear correct
under regular sunlight, you might do something like whitebalance(c, WP F2,
WP D65).
Args:
• c: An observed color.
Interact
31.1 Interact.button
Interact.button — Method.
Create a push button. Optionally specify the label, the value emitted
when then button is clicked, and/or the (Reactive.jl) signal coupled to this
button.
source
31.2 Interact.checkbox
Interact.checkbox — Method.
31.3 Interact.dropdown
Interact.dropdown — Method.
360
31.4. INTERACT.RADIOBUTTONS 361
in choices, supply custom icons, provide tooltips, and/or specify the (Re-
active.jl) signal coupled to this widget.
Examples
source
31.4 Interact.radiobuttons
Interact.radiobuttons — Method.
radiobuttons: see the help for dropdown
source
31.5 Interact.selection
Interact.selection — Method.
selection: see the help for dropdown
source
31.7 Interact.set!
Interact.set! — Method.
set!(w::Widget, fld::Symbol, val)
Set the value of a widget property and update all displayed instances of the
widget. If val is a Signal, then updates to that signal will be reflected in
widget instances/views.
If fld is :value, val is also push!ed to signal(w)
source
362 CHAPTER 31. INTERACT
31.8 Interact.slider
Interact.slider — Method.
Create a slider widget with the specified range. Optionally specify the
starting value (defaults to the median of range), provide the (Reactive.jl)
signal coupled to this slider, and/or specify a string label for the widget.
source
31.9 Interact.textarea
Interact.textarea — Method.
31.10 Interact.textbox
Interact.textbox — Method.
Create a box for entering text. value is the starting value; if you don’t want
to provide an initial value, you can constrain the type with typ. Optionally pro-
vide a label, specify the allowed range (e.g., -10.0:10.0) for numeric entries,
and/or provide the (Reactive.jl) signal coupled to this text box.
source
31.11 Interact.togglebutton
Interact.togglebutton — Method.
Create a toggle button. Optionally specify the label, the initial state
(value=false is off, value=true is on), and/or provide the (Reactive.jl) signal
coupled to this button.
source
31.12. INTERACT.TOGGLEBUTTONS 363
31.12 Interact.togglebuttons
Interact.togglebuttons — Method.
togglebuttons: see the help for dropdown
source
31.13 Interact.update!
Interact.update! — Method.
Update output widgets
source
31.15 Interact.vslider
Interact.vslider — Method.
vslider(args...; kwargs...)
Shorthand for slider(args...; orientation="vertical", kwargs...)
source
Chapter 32
FFTW
32.1 Base.DFT.FFTW.dct
Base.DFT.FFTW.dct — Function.
dct(A [, dims])
32.2 Base.DFT.FFTW.dct!
Base.DFT.FFTW.dct! — Function.
dct!(A [, dims])
32.3 Base.DFT.FFTW.idct
Base.DFT.FFTW.idct — Function.
idct(A [, dims])
364
32.4. BASE.DFT.FFTW.IDCT! 365
32.4 Base.DFT.FFTW.idct!
Base.DFT.FFTW.idct! — Function.
idct!(A [, dims])
Same as idct!, but operates in-place on A.
source
Pre-plan an optimized r2r transform, similar to plan fft except that the
transforms (and the first three arguments) correspond to r2r and r2r!, respec-
tively.
source
32.11 Base.DFT.FFTW.r2r
Base.DFT.FFTW.r2r — Function.
32.12 Base.DFT.FFTW.r2r!
Base.DFT.FFTW.r2r! — Function.
WebSockets
33.1 Base.close
Base.close — Method.
close(ws::WebSocket)
close(ws::WebSocket, statusnumber = n)
close(ws::WebSocket, statusnumber = n, freereason = "my reason")
Send an OPCODE CLOSE frame, and wait for the same response or until
a reasonable amount of time, 10.0 s, has passed. Data received while closing is
dropped. Status number n according to RFC 6455 7.4.1 can be included, see
WebSockets.codeDesc
source
33.2 Base.read
Base.read — Method.
read(ws::WebSocket)
Typical use: msg = String(read(ws)) Read one non-control message from a
WebSocket. Any control messages that are read will be handled by the han-
dle control frame function. Only the data (contents/body/payload) of the mes-
sage will be returned as a Vector{UInt8}.
This function will not return until a full non-control message has been read.
source
33.3 Base.write
Base.write — Method.
Write binary data; will be sent as one frame.
source
368
33.4. BASE.WRITE 369
33.4 Base.write
Base.write — Method.
Write text data; will be sent as one frame.
source
33.5 WebSockets.origin
WebSockets.origin — Function.
origin(request) => String Convenience function for checking which server
/ port address the client claims its code was downloaded from. The resource
path can be found with target(req). E.g.
[] function gatekeeper(req, ws) orig = WebSockets.origin(req) if startswith(orig,
”http://localhost”) —— startswith(orig, ”http://127.0.0.1”) handlewebsocket(ws)
end end end
source
33.6 WebSockets.readguarded
WebSockets.readguarded — Method.
readguarded(websocket) => (Vector, Bool)
Return (data::Vector, true) or (Vector{UInt8}(), false)
The peer can potentially disconnect at any time, but no matter the cause
you will usually just want to exit your websocket handling function when you
can’t write to it.
E.g.
[] while true data, success = readguarded(websocket) !success break
println(String(data)) end
source
33.9 WebSockets.subprotocol
WebSockets.subprotocol — Function.
subprotocol(request) => String
Convenience function for reading upgrade request subprotocol. Acceptable
subprotocols need to be predefined using addsubproto(myprotocol). No other
subprotocols will pass the handshake. E.g.
[] WebSockets.addsubproto(”instructions”) WebSockets.addsubproto(”relayb ackend”)f unctiongateke
source
33.10 WebSockets.target
WebSockets.target — Function.
target(request) => String
Convenience function for reading upgrade request target. E.g.
[] function gatekeeper(req, ws) if target(req) == ”/gamepad” @spawnat 2
gamepad(ws) elseif target(req) == ”/console” @spawnat 3 console(ws) ... end
end
Then, in browser javascript (or equivalent with Julia WebSockets.open( , ))
[] function load(){ var wsuri = document.URL.replace(”http:”, ”ws:”); ws1
= new WebSocket(wsuri + ”/gamepad”); ws2 = new WebSocket(wsuri +
”/console”); ws3 = new WebSocket(wsuri + ”/graphics”); ws4 = new Web-
Socket(wsuri + ”/audiochat”); ws1.onmessage = function(e){vibrate(e.data)}
} // load
source
33.11 WebSockets.writeguarded
WebSockets.writeguarded — Method.
writeguarded(websocket, message) => Bool
Return true if write is successful, false if not. The peer can potentially
disconnect at any time, but no matter the cause you will usually just want to
exit your websocket handling function when you can’t write to it.
source
Chapter 34
AxisArrays
34.1 AxisArrays.axes
AxisArrays.axes — Method.
34.2 AxisArrays.axisdim
AxisArrays.axisdim — Method.
Given an AxisArray and an Axis, return the integer dimension of the Axis
within the array.
source
34.3 AxisArrays.axisnames
AxisArrays.axisnames — Method.
371
372 CHAPTER 34. AXISARRAYS
34.4 AxisArrays.axisvalues
AxisArrays.axisvalues — Method.
34.5 AxisArrays.collapse
AxisArrays.collapse — Method.
Collapses AxisArrays with N equal leading axes into a single AxisArray. All
additional axes in any of the arrays are collapsed into a single additional axis
of type Axis{:collapsed, CategoricalVector{Tuple}}.
Arguments
Examples
source
Chapter 35
BusinessDays
35.1 BusinessDays.advancebdays
BusinessDays.advancebdays — Method.
advancebdays(calendar, dt, bdays_count)
Increments given date dt by bdays count. Decrements it if bdays count is
negative. bdays count can be a Int, Vector{Int} or a UnitRange.
Computation starts by next Business Day if dt is not a Business Day.
source
35.2 BusinessDays.bdays
BusinessDays.bdays — Method.
bdays(calendar, dt0, dt1) :: Dates.Day
Counts the number of Business Days between dt0 and dt1. Returns in-
stances of Dates.Day.
Computation is always based on next Business Day if given dates are not
Business Days.
source
35.3 BusinessDays.bdayscount
BusinessDays.bdayscount — Method.
bdayscount(calendar, dt0, dt1) :: Int
Counts the number of Business Days between dt0 and dt1. Returns Int.
Computation is always based on next Business Day if given dates are not
Business Days.
source
375
376 CHAPTER 35. BUSINESSDAYS
35.4 BusinessDays.firstbdayofmonth
BusinessDays.firstbdayofmonth — Method.
firstbdayofmonth(calendar, dt)
firstbdayofmonth(calendar, yy, mm)
35.5 BusinessDays.isbday
BusinessDays.isbday — Method.
isbday(calendar, dt)
35.6 BusinessDays.isholiday
BusinessDays.isholiday — Method.
isholiday(calendar, dt)
35.7 BusinessDays.isweekday
BusinessDays.isweekday — Method.
isweekday(dt)
35.8 BusinessDays.isweekend
BusinessDays.isweekend — Method.
isweekend(dt)
35.9 BusinessDays.lastbdayofmonth
BusinessDays.lastbdayofmonth — Method.
lastbdayofmonth(calendar, dt)
lastbdayofmonth(calendar, yy, mm)
35.10 BusinessDays.listbdays
BusinessDays.listbdays — Method.
35.11 BusinessDays.listholidays
BusinessDays.listholidays — Method.
35.12 BusinessDays.tobday
BusinessDays.tobday — Method.
QuadGK
36.1 Base.quadgk
Base.quadgk — Method.
378
36.2. QUADGK.GAUSS 379
(often much better than simple nested 1d integrals) and the optimal choice
tends to be very problem-dependent. See the Julia external-package listing for
available algorithms for multidimensional integration or other specialized tasks
(such as integrals of highly oscillatory or singular functions).
The algorithm is an adaptive Gauss-Kronrod integration technique: the in-
tegral in each interval is estimated using a Kronrod rule (2*order+1 points) and
the error is estimated using an embedded Gauss rule (order points). The inter-
val with the largest error is then subdivided into two intervals and the process
is repeated until the desired error tolerance is achieved.
These quadrature rules work best for smooth functions within each interval,
so if your function has a known discontinuity or other singularity, it is best to
subdivide your interval to put the singularity at an endpoint. For example, if f
has a discontinuity at x=0.7 and you want to integrate from 0 to 1, you should
use quadgk(f, 0,0.7,1) to subdivide the interval at the point of discontinuity.
The integrand is never evaluated exactly at the endpoints of the intervals, so it
is possible to integrate functions that diverge at the endpoints as long as the
singularity is integrable (for example, a log(x) or 1/sqrt(x) singularity).
For real-valued endpoints, the starting and/or ending points may be infinite.
(A coordinate transformation is performed internally to map the infinite interval
to a finite one.)
source
36.2 QuadGK.gauss
QuadGK.gauss — Method.
gauss([T,] N)
36.3 QuadGK.kronrod
QuadGK.kronrod — Method.
kronrod([T,] n)
x, w, wg = kronrod(n)
fx = f(x[end]) # f(0)
x = x[1:end-1] # the x < 0 Kronrod points
fx = f.(x) .+ f.((-).(x)) # f(x < 0) + f(x > 0)
I = sum(fx .* w[1:end-1]) + fx * w[end]
if isodd(n)
E = abs(sum(fx[2:2:end] .* wg[1:end-1]) + fx*wg[end] - I)
else
E = abs(sum(fx[2:2:end] .* wg[1:end])- I)
end
source
Chapter 37
Dagger
37.1 Dagger.alignfirst
Dagger.alignfirst — Method.
alignfirst(a)
alignfirst(ArrayDomain(11:25, 21:100))
# => ArrayDomain((1:15), (1:80))
source
37.3 Dagger.compute
Dagger.compute — Method.
A DArray object may contain a thunk in it, in which case we first turn it
into a Thunk object and then compute it.
source
381
382 CHAPTER 37. DAGGER
37.4 Dagger.compute
Dagger.compute — Method.
Compute a Thunk - creates the DAG, assigns ranks to nodes for tie breaking
and runs the scheduler.
source
37.5 Dagger.domain
Dagger.domain — Function.
domain(x::T)
37.6 Dagger.domain
Dagger.domain — Method.
The domain of an array is a ArrayDomain
source
37.7 Dagger.domain
Dagger.domain — Method.
If no domain method is defined on an object, then we use the UnitDomain
on it. A UnitDomain is indivisible.
source
37.8 Dagger.load
Dagger.load — Method.
load(ctx, file_path)
37.9 Dagger.load
Dagger.load — Method.
Load a Chunk object from a file, the file path is required for creating a
FileReader object
source
37.10 Dagger.save
Dagger.save — Method.
save(io::IO, val)
Save a value into the IO buffer. In the case of arrays and sparse matrices,
this will save it in a memory-mappable way.
load(io::IO, t::Type, domain) will load the object given its domain
source
37.11 Dagger.save
Dagger.save — Method.
37.12 Dagger.save
Dagger.save — Method.
special case distmem writing - write to disk on the process with the chunk.
source
Chapter 38
NNlib
38.1 NNlib.elu
NNlib.elu — Function.
elu(x, = 1) =
x > 0 ? x : * (exp(x) - 1)
Exponential Linear Unit activation function. See Fast and Accurate Deep
Network Learning by Exponential Linear Units. You can also specify the coef-
ficient explicitly, e.g. elu(x, 1).
source
38.2 NNlib.leakyrelu
NNlib.leakyrelu — Function.
leakyrelu(x) = max(0.01x, x)
Leaky Rectified Linear Unit activation function. You can also specify the
coefficient explicitly, e.g. leakyrelu(x, 0.01).
source
38.3 NNlib.logsoftmax
NNlib.logsoftmax — Function.
384
38.4. NNLIB.LOG 385
38.4 NNlib.log
NNlib.log — Method.
log(x)
julia> log(0.)
-0.6931471805599453
julia> log.([-100, -10, 100.])
3-element Array{Float64,1}:
-100.0
-10.0
-0.0
source
38.5 NNlib.relu
NNlib.relu — Method.
relu(x) = max(0, x)
38.6 NNlib.selu
NNlib.selu — Method.
1.0507
1.6733
38.7 NNlib.softmax
NNlib.softmax — Function.
38.8 NNlib.softplus
NNlib.softplus — Method.
softplus(x) = log(exp(x) + 1)
See Deep Sparse Rectifier Neural Networks.
source
38.9 NNlib.softsign
NNlib.softsign — Method.
softsign(x) = x / (1 + |x|)
See Quadratic Polynomials Learn Better Image Features.
source
38.10 NNlib.swish
NNlib.swish — Method.
swish(x) = x * (x)
Self-gated actvation function. See Swish: a Self-Gated Activation Function.
source
38.11 NNlib.
NNlib. — Method.
(x) = 1 / (1 + exp(-x))
Classic sigmoid activation function.
source
Chapter 39
ShowItLikeYouBuildIt
39.1 ShowItLikeYouBuildIt.showarg
ShowItLikeYouBuildIt.showarg — Method.
showarg(stream::IO, x)
SubArray{Float64,2,Array{Float64,3},Tuple{Colon,Int64,UnitRange{Int64}},false}
and this type will be printed in the summary. To change the printing of this
object to
387
388 CHAPTER 39. SHOWITLIKEYOUBUILDIT
Note that we’re calling showarg recursively for the parent array type. Print-
ing the parent as ::Array{Float64,3} is the fallback behavior, assuming no
specialized method for Array has been defined. More generally, this would
display as
summary_build(A::AbstractArray, [cthresh])
Base.summary(v::SubArray) = summary_build(v)
This function goes hand-in-hand with showarg. If you have defined a showarg
method for SubArray as in the documentation for showarg, then the summary
of a SubArray might look like this:
instead of this:
34 SubArray{Float64,2,Array{Float64,3},Tuple{Colon,Int64,UnitRange{Int64}},false}
type_complexity(T::Type) -> c
# Array{Float64,2}
julia> a = rand(3,5);
julia> type_complexity(typeof(a))
3
julia> length(typeof(a).parameters)+1
3
julia> type_complexity(typeof(v))
15
julia> length(typeof(v).parameters)+1
6
The second example indicates that the total complexity of v’s type is con-
siderably higher than the complexity of just its “outer” SubArray type.
source
Chapter 40
CoordinateTransformations
40.1 CoordinateTransformations.cameramap
CoordinateTransformations.cameramap — Method.
cameramap()
cameramap(scale)
cameramap(scale, offset)
Create a transformation that takes points in real space (e.g. 3D) and projects
them through a perspective transformation onto the focal plane of an ideal
(pinhole) camera with the given properties.
The scale sets the scale of the screen. For a standard digital camera, this
would be scale = focal length / pixel size. Non-square pixels are sup-
ported by providing a pair of scales in a tuple, scale = (scale x, scale y).
Positive scales represent a camera looking in the +z axis with a virtual screen
in front of the camera (the x,y coordinates are not inverted compared to 3D
space). Note that points behind the camera (with negative z component) will
be projected (and inverted) onto the image coordinates and it is up to the user
to cull such points as necessary.
The offset = (offset x, offset y) is used to define the origin in the
imaging plane. For instance, you may wish to have the point (0,0) represent the
top-left corner of your imaging sensor. This measurement is in the units after
applying scale (e.g. pixels).
(see also PerspectiveMap)
source
40.2 CoordinateTransformations.compose
CoordinateTransformations.compose — Method.
compose(trans1, trans2)
390
40.3. COORDINATETRANSFORMATIONS.RECENTER 391
trans1 trans2
40.3 CoordinateTransformations.recenter
CoordinateTransformations.recenter — Method.
Return a new transformation ctrans such that point origin serves as the
origin-of-coordinates for trans. Translation by origin occurs both before and
after applying trans, so that if trans is linear we have
ctrans(origin) == origin
transform_deriv(trans::Transformation, x)
transform_deriv_params(trans::AbstractTransformation, x)
Graphics
41.2 Graphics.deform
Graphics.deform — Method.
deform(bb::BoundingBox, l, r, t, b) -> bbnew
Add l (left), r (right), t (top), and b (bottom) to the edges of a Bounding-
Box.
source
392
41.4. GRAPHICS.ISINSIDE 393
41.4 Graphics.isinside
Graphics.isinside — Method.
41.5 Graphics.rotate
Graphics.rotate — Method.
41.6 Graphics.rotate
Graphics.rotate — Method.
41.8 Graphics.shift
Graphics.shift — Method.
MacroTools
42.1 MacroTools.inexpr
MacroTools.inexpr — Method.
inexpr(expr, x)
Simple expression match; will return true if the expression x can be found
inside expr.
inexpr(:(2+2), 2) == true
source
42.2 MacroTools.isdef
MacroTools.isdef — Method.
Test for function definition expressions.
source
42.3 MacroTools.isexpr
MacroTools.isexpr — Method.
isexpr(x, ts...)
Convenient way to test the type of a Julia expression. Expression heads and
types are supported, so for example you can call
395
396 CHAPTER 42. MACROTOOLS
42.4 MacroTools.namify
MacroTools.namify — Method.
An easy way to get pull the (function/type) name out of expressions like
foo{T} or Bar{T} <: Vector{T}.
source
42.5 MacroTools.prettify
MacroTools.prettify — Method.
prettify(ex)
42.6 MacroTools.rmlines
MacroTools.rmlines — Method.
rmlines(x)
42.7 MacroTools.splitarg
MacroTools.splitarg — Method.
splitarg(arg)
42.8 MacroTools.splitdef
MacroTools.splitdef — Method.
splitdef(fdef)
source
42.9 MacroTools.unblock
MacroTools.unblock — Method.
unblock(expr)
ImageMorphology
43.1 ImageMorphology.bothat
ImageMorphology.bothat — Function.
imgbh = bothat(img, [region]) performs bottom hat of an image, which
is defined as its morphological closing minus the original image. region allows
you to control the dimensions over which this operation is performed.
source
43.2 ImageMorphology.closing
ImageMorphology.closing — Function.
imgc = closing(img, [region]) performs the closing morphology oper-
ation, equivalent to erode(dilate(img)). region allows you to control the
dimensions over which this operation is performed.
source
43.3 ImageMorphology.dilate
ImageMorphology.dilate — Function.
398
43.4. IMAGEMORPHOLOGY.ERODE 399
43.4 ImageMorphology.erode
ImageMorphology.erode — Function.
imge = erode(img, [region])
perform a min-filter over nearest-neighbors. The default is 8-connectivity in
2d, 27-connectivity in 3d, etc. You can specify the list of dimensions that you
want to include in the connectivity, e.g., region = [1,2] would exclude the
third dimension from filtering.
source
43.5 ImageMorphology.morphogradient
ImageMorphology.morphogradient — Function.
imgmg = morphogradient(img, [region]) returns morphological gradient
of the image, which is the difference between the dilation and the erosion of
a given image. region allows you to control the dimensions over which this
operation is performed.
source
43.6 ImageMorphology.morpholaplace
ImageMorphology.morpholaplace — Function.
imgml = morpholaplace(img, [region]) performs Morphological Laplacian
of an image, which is defined as the arithmetic difference between the internal
and the external gradient. region allows you to control the dimensions over
which this operation is performed.
source
43.7 ImageMorphology.opening
ImageMorphology.opening — Function.
imgo = opening(img, [region]) performs the opening morphology oper-
ation, equivalent to dilate(erode(img)). region allows you to control the
dimensions over which this operation is performed.
source
43.8 ImageMorphology.tophat
ImageMorphology.tophat — Function.
imgth = tophat(img, [region]) performs top hat of an image, which is
defined as the image minus its morphological opening. region allows you to
control the dimensions over which this operation is performed.
source
Chapter 44
NLSolversBase
44.1 Base.LinAlg.gradient
Base.LinAlg.gradient — Method.
Evaluates the gradient value at x
This does not update obj.DF or obj.x df.
source
44.2 Base.LinAlg.gradient
Base.LinAlg.gradient — Method.
Get the ith element of the most recently evaluated gradient of obj.
source
44.3 Base.LinAlg.gradient
Base.LinAlg.gradient — Method.
Get the most recently evaluated gradient of obj.
source
44.4 NLSolversBase.gradient!
NLSolversBase.gradient! — Method.
Evaluates the gradient value at x.
Stores the value in obj.DF.
source
400
44.5. NLSOLVERSBASE.HESSIAN 401
44.5 NLSolversBase.hessian
NLSolversBase.hessian — Method.
Get the most recently evaluated Hessian of obj
source
44.6 NLSolversBase.jacobian
NLSolversBase.jacobian — Method.
Get the most recently evaluated Jacobian of obj.
source
44.7 NLSolversBase.value!!
NLSolversBase.value!! — Method.
Force (re-)evaluation of the objective value at x.
Returns f(x) and stores the value in obj.F
source
44.8 NLSolversBase.value!
NLSolversBase.value! — Method.
Evaluates the objective value at x.
Returns f(x) and stores the value in obj.F
source
44.9 NLSolversBase.value
NLSolversBase.value — Method.
Evaluates the objective value at x.
Returns f(x), but does not store the value in obj.F
source
44.10 NLSolversBase.value
NLSolversBase.value — Method.
Get the most recently evaluated objective value of obj.
source
Chapter 45
Contour
45.1 Contour.contour
Contour.contour — Method.
contour(x, y, z, level::Number) Trace a single contour level, indicated
by the argument level.
You’ll usually call lines on the output of contour, and then iterate over
the result.
source
45.2 Contour.contours
Contour.contours — Method.
contours(x,y,z,levels) Trace the contour levels indicated by the levels
argument.
source
45.3 Contour.contours
Contour.contours — Method.
contours returns a set of isolines.
You’ll usually call levels on the output of contours.
source
45.4 Contour.contours
Contour.contours — Method.
contours(x,y,z,Nlevels::Integer) Trace Nlevels contour levels at heights
chosen by the library (using the contourlevels function).
source
402
45.5. CONTOUR.CONTOURS 403
45.5 Contour.contours
Contour.contours — Method.
contours(x,y,z) Trace 10 automatically chosen contour levels.
source
45.6 Contour.coordinates
Contour.coordinates — Method.
coordinates(c) Returns the coordinates of the vertices of the contour line
as a tuple of lists.
source
45.7 Contour.level
Contour.level — Method.
level(c) Indicates the z-value at which the contour level c was traced.
source
45.8 Contour.levels
Contour.levels — Method.
Turns the output of contours into an iterable with each of the traced contour
levels. Each of the objects support level and coordinates.
source
45.9 Contour.lines
Contour.lines — Method.
lines(c) Extracts an iterable collection of isolines from a contour level. Use
coordinates to get the coordinates of a line.
source
Chapter 46
Compose
46.1 Compose.circle
Compose.circle — Function.
circle(x, y, r)
46.2 Compose.circle
Compose.circle — Function.
46.3 Compose.circle
Compose.circle — Method.
circle()
Define a circle in the center of the current context with a diameter equal to
the width of the context.
source
404
46.4. COMPOSE.POLYGON 405
46.4 Compose.polygon
Compose.polygon — Method.
polygon(points)
Define a polygon. points is an array of (x,y) tuples that specify the corners
of the polygon.
source
46.5 Compose.rectangle
Compose.rectangle — Function.
rectangle(x0, y0, width, height)
Define a rectangle of size widthxheight with its top left corner at the point
(x, y).
source
46.6 Compose.rectangle
Compose.rectangle — Function.
rectangle(x0s, y0s, widths, heights)
Arguments can be passed in arrays in order to perform multiple drawing
operations at once.
source
46.7 Compose.rectangle
Compose.rectangle — Method.
rectangle()
Define a rectangle that fills the current context completely.
source
46.8 Compose.text
Compose.text — Function.
text(xs, ys, values [,haligns::HAlignment [,valigns::VAlignment [,rots::Rotation]]])
Arguments can be passed in arrays in order to perform multiple drawing
operations at once.
source
406 CHAPTER 46. COMPOSE
46.9 Compose.text
Compose.text — Function.
Draw the text value at the position (x,y) relative to the current context.
The default alignment of the text is hleft vbottom. The vertical and hor-
izontal alignment is specified by passing hleft, hcenter or hright and vtop,
vcenter or vbottom as values for halgin and valgin respectively.
source
Chapter 47
CoupledFields
47.1 CoupledFields.CVfn
CoupledFields.CVfn — Method.
Cross-validation function
source
Cross-validation metric
source
47.3 CoupledFields.bf
CoupledFields.bf — Method.
bf(x::Vector{Float64}, df::Int):
407
408 CHAPTER 47. COUPLEDFIELDS
47.4 CoupledFields.cca
CoupledFields.cca — Method.
cca{T<:Matrix{Float64}}(v::Array{Float64}, X::T,Y::T):
47.5 CoupledFields.gKCCA
CoupledFields.gKCCA — Method.
47.6 CoupledFields.gradvecfield
CoupledFields.gradvecfield — Method.
47.7 CoupledFields.whiten
CoupledFields.whiten — Method.
AxisAlgorithms
409
410 CHAPTER 48. AXISALGORITHMS
A mul B md(M, src, dim) computes M*x for slices x of src along dimension
dim, storing the resulting vector along the same dimension of the output. M
must be an AbstractMatrix. This uses an in-place naive algorithm.
source
Libz
49.1 Libz.ZlibDeflateInputStream
Libz.ZlibDeflateInputStream — Method.
source
49.2 Libz.ZlibDeflateOutputStream
Libz.ZlibDeflateOutputStream — Method.
411
412 CHAPTER 49. LIBZ
source
49.3 Libz.ZlibInflateInputStream
Libz.ZlibInflateInputStream — Method.
source
49.4 Libz.ZlibInflateOutputStream
Libz.ZlibInflateOutputStream — Method.
source
49.5 Libz.adler32
Libz.adler32 — Function.
adler32(data)
Compute the Adler-32 checksum over the data input. data can be BufferedInputStream
or Vector{UInt8}.
source
49.6 Libz.crc32
Libz.crc32 — Function.
crc32(data)
Compute the CRC-32 checksum over the data input. data can be BufferedInputStream
or Vector{UInt8}.
source
Chapter 50
ImageMetadata
50.1 ImageAxes.data
ImageAxes.data — Method.
data(img::ImageMeta) -> array
Extract the data from img, omitting the properties dictionary. array shares
storage with img, so changes to one affect the other.
See also: properties.
source
50.2 ImageMetadata.copyproperties
ImageMetadata.copyproperties — Method.
copyproperties(img::ImageMeta, data) -> imgnew
Create a new “image,” copying the properties dictionary of img but using the
data of the AbstractArray data. Note that changing the properties of imgnew
does not affect the properties of img.
See also: shareproperties.
source
50.3 ImageMetadata.properties
ImageMetadata.properties — Method.
properties(imgmeta) -> props
Extract the properties dictionary props for imgmeta. props shares storage
with img, so changes to one affect the other.
See also: data.
source
414
50.4. IMAGEMETADATA.SHAREPROPERTIES 415
50.4 ImageMetadata.shareproperties
ImageMetadata.shareproperties — Method.
Create a new “image,” reusing the properties dictionary of img but using the
data of the AbstractArray data. The two images have synchronized properties;
modifying one also affects the other.
See also: copyproperties.
source
50.5 ImageMetadata.spatialproperties
ImageMetadata.spatialproperties — Method.
spatialproperties(img)
Return a vector of strings, containing the names of properties that have been
declared “spatial” and hence should be permuted when calling permutedims.
Declare such properties like this:
img["spatialproperties"] = ["spacedirections"]
source
Chapter 51
LegacyStrings
51.1 LegacyStrings.utf16
LegacyStrings.utf16 — Function.
utf16(::Union{Ptr{UInt16},Ptr{Int16}} [, length])
51.2 LegacyStrings.utf16
LegacyStrings.utf16 — Method.
utf16(s)
Create a UTF-16 string from a byte array, array of UInt16, or any other
string type. (Data must be valid UTF-16. Conversions of byte arrays check for
a byte-order marker in the first two bytes, and do not include it in the resulting
string.)
Note that the resulting UTF16String data is terminated by the NUL code-
point (16-bit zero), which is not treated as a character in the string (so that
it is mostly invisible in Julia); this allows the string to be passed directly to
external functions requiring NUL-terminated data. This NUL is appended au-
tomatically by the utf16(s) conversion function. If you have a UInt16 array A
that is already NUL-terminated valid UTF-16 data, then you can instead use
UTF16String(A) to construct the string without making a copy of the data and
treating the NUL as a terminator rather than as part of the string.
source
416
51.3. LEGACYSTRINGS.UTF32 417
51.3 LegacyStrings.utf32
LegacyStrings.utf32 — Function.
utf32(::Union{Ptr{Char},Ptr{UInt32},Ptr{Int32}} [, length])
51.4 LegacyStrings.utf32
LegacyStrings.utf32 — Method.
utf32(s)
Create a UTF-32 string from a byte array, array of Char or UInt32, or any
other string type. (Conversions of byte arrays check for a byte-order marker in
the first four bytes, and do not include it in the resulting string.)
Note that the resulting UTF32String data is terminated by the NUL code-
point (32-bit zero), which is not treated as a character in the string (so that
it is mostly invisible in Julia); this allows the string to be passed directly to
external functions requiring NUL-terminated data. This NUL is appended au-
tomatically by the utf32(s) conversion function. If you have a Char or UInt32
array A that is already NUL-terminated UTF-32 data, then you can instead use
UTF32String(A) to construct the string without making a copy of the data and
treating the NUL as a terminator rather than as part of the string.
source
Chapter 52
BufferedStreams
52.1 BufferedStreams.anchor!
BufferedStreams.anchor! — Method.
Set the buffer’s anchor to its current position.
source
52.2 BufferedStreams.fillbuffer!
BufferedStreams.fillbuffer! — Method.
Refill the buffer, optionally moving and retaining part of the data.
source
52.3 BufferedStreams.isanchored
BufferedStreams.isanchored — Method.
Return true if the stream is anchored.
source
52.4 BufferedStreams.peek
BufferedStreams.peek — Method.
Return the next byte from the input stream without advancing the position.
source
52.5 BufferedStreams.peekbytes!
BufferedStreams.peekbytes! — Function.
Fills buffer with bytes from stream’s buffer without advancing the position.
418
52.6. BUFFEREDSTREAMS.TAKEANCHORED! 419
Unless the buffer is empty, we do not re-fill it. Therefore the number of bytes
read is limited to the minimum of nb and the remaining bytes in the buffer.
source
52.6 BufferedStreams.takeanchored!
BufferedStreams.takeanchored! — Method.
Copy and return a byte array from the anchor up to, but not including the
current position, also removing the anchor.
source
52.7 BufferedStreams.upanchor!
BufferedStreams.upanchor! — Method.
Remove and return a buffer’s anchor.
source
Chapter 53
MbedTLS
53.1 MbedTLS.decrypt
MbedTLS.decrypt — Function.
decrypt(cipher, key, msg, [iv]) -> Vector{UInt8}
Decrypt a message using the given cipher. The cipher can be specified as
• a Cipher object
key is the symmetric key used for cryptography, given as either a String or a
Vector{UInt8}. It must be the right length for the chosen cipher; for example,
CIPHER AES 256 CBC requires a 32-byte (256-bit) key.
msg is the message to be encoded. It should either be convertible to a String
or be a Vector{UInt8}.
iv is the initialization vector, whose size must match the block size of the
cipher (eg, 16 bytes for AES) and correspond to the iv used by the encryptor.
By default, it will be set to all zeros.
source
53.2 MbedTLS.digest
MbedTLS.digest — Function.
digest(kind::MDKind, msg::Vector{UInt8}, [key::Vector{UInt8}]) ->
Vector{UInt8}
Perform a digest of the given type on the given message (a byte array),
return a byte array with the digest.
If an optional key is given, perform an HMAC digest.
source
420
53.3. MBEDTLS.DIGEST! 421
53.3 MbedTLS.digest!
MbedTLS.digest! — Function.
digest!(kind::MDKind, msg::Vector{UInt8}, [key::Vector{UInt8}, ],
buffer::Vector{UInt8})
In-place version of digest that stores the digest to buffer.
It is the user’s responsibility to ensure that buffer is long enough to contain
the digest. get size(kind::MDKind) returns the appropriate size.
source
53.4 MbedTLS.encrypt
MbedTLS.encrypt — Function.
encrypt(cipher, key, msg, [iv]) -> Vector{UInt8}
Encrypt a message using the given cipher. The cipher can be specified as
key is the symmetric key used for cryptography, given as either a String or a
Vector{UInt8}. It must be the right length for the chosen cipher; for example,
CIPHER AES 256 CBC requires a 32-byte (256-bit) key.
msg is the message to be encoded. It should either be convertible to a String
or be a Vector{UInt8}.
iv is the initialization vector, whose size must match the block size of the
cipher (eg, 16 bytes for AES). By default, it will be set to all zeros, which is
not secure. For security reasons, it should be set to a different value for each
encryption operation.
source
Chapter 54
DataValues
54.1 DataValues.dropna!
DataValues.dropna! — Method.
dropna!(X::DataValueVector)
Remove missing entries of X in-place and return a Vector view of the un-
wrapped DataValue entries.
source
54.2 DataValues.dropna!
DataValues.dropna! — Method.
dropna!(X::AbstractVector)
Remove missing entries of X in-place and return a Vector view of the un-
wrapped DataValue entries. If no missing values are present, this is a no-op
and X is returned.
source
54.3 DataValues.dropna
DataValues.dropna — Method.
dropna(X::AbstractVector)
422
54.4. DATAVALUES.PADNA! 423
54.4 DataValues.padna!
DataValues.padna! — Method.
Insert front null entries at the beginning of X and add back null entries at
the end of X. Returns X.
source
54.5 DataValues.padna
DataValues.padna — Method.
return a copy of X with front null entries inserted at the beginning of the
copy and back null entries inserted at the end.
source
Chapter 55
NearestNeighbors
55.1 NearestNeighbors.injectdata
NearestNeighbors.injectdata — Method.
55.2 NearestNeighbors.inrange
NearestNeighbors.inrange — Method.
Find all the points in the tree which is closer than radius to points. If
sortres = true the resulting indices are sorted.
source
55.3 NearestNeighbors.knn
NearestNeighbors.knn — Method.
Performs a lookup of the k nearest neigbours to the points from the data
in the tree. If sortres = true the result is sorted such that the results are in
the order of increasing distance to the point. skip is an optional predicate to
determine if a point that would be returned should be skipped.
source
424
Chapter 56
IJulia
56.1 IJulia.installkernel
IJulia.installkernel — Method.
Install a new Julia kernel, where the given options are passed to the julia
executable, and the user-visible kernel name is given by name followed by the
Julia version.
Internally, the Jupyter name for the kernel (for the jupyter kernelspec
command is given by the optional keyword specname (which defaults to name,
converted to lowercase with spaces replaced by hyphens), followed by the Julia
version number.
Both the kernelspec command (a Cmd object) and the new kernel name are
returned by installkernel. For example:
creates a new Julia kernel in which julia is launched with the -O3 optimiza-
tion flag. The returned kernelspec command will be something like jupyter
kernelspec (perhaps with different path), and kernelname will be something
like julia-O3-0.6 (in Julia 0.6). You could uninstall the kernel by running e.g.
source
56.2 IJulia.notebook
IJulia.notebook — Method.
425
426 CHAPTER 56. IJULIA
HDF5
Get all the datasets in an hdf5 file without loading the data.
source
57.2 HDF5.h5open
HDF5.h5open — Function.
• “cw” read and write, create file if not existing, do not truncate
• “w” read and write, create a new file (destroys any existing contents)
427
428 CHAPTER 57. HDF5
57.3 HDF5.h5open
HDF5.h5open — Method.
h5open("foo.h5","w") do h5
h5["foo"]=[1,2,3]
end
source
57.4 HDF5.ishdf5
HDF5.ishdf5 — Method.
ishdf5(name::AbstractString)
set_dims!(dset::HDF5Dataset, new_dims::Dims)
Change the current dimensions of a dataset to new dims, limited by max dims
= get dims(dset)[2]. Reduction is possible and leads to loss of truncated
data.
source
Chapter 58
CUDAapi
find_binary(names; locations=String[])
find_libdevice(targets::Vector{VersionNumber}, toolkit_dirs::Vector{String})
Look for the CUDA device library supporting targets in any of the CUDA
toolkit directories toolkit dirs. On CUDA >= 9.0, a single library unified
library is discovered and returned as a string. On older toolkits, individual
libraries for each of the targets are returned as a vector of strings.
source
429
430 CHAPTER 58. CUDAAPI
find_toolkit()::Vector{String}
Look for directories where (parts of) the CUDA toolkit might be installed.
This returns a (possibly empty) list of paths that can be used as an argument
to other discovery functions.
The behavior of this function can be overridden by defining the CUDA PATH,
CUDA HOME or CUDA ROOT environment variables, which should point to the root
of the CUDA toolkit.
source
Chapter 59
AutoGrad
59.1 AutoGrad.getval
AutoGrad.getval — Method.
getval(x)
59.2 AutoGrad.grad
AutoGrad.grad — Function.
grad(fun, argnum=1)
59.3 AutoGrad.gradcheck
AutoGrad.gradcheck — Method.
431
432 CHAPTER 59. AUTOGRAD
source
59.4 AutoGrad.gradloss
AutoGrad.gradloss — Function.
gradloss(fun, argnum=1)
ComputationalResources
60.1 ComputationalResources.addresource
ComputationalResources.addresource — Method.
addresource(T)
60.2 ComputationalResources.haveresource
ComputationalResources.haveresource — Method.
haveresource(T)
source
60.3 ComputationalResources.rmresource
ComputationalResources.rmresource — Method.
rmresource(T)
433
434 CHAPTER 60. COMPUTATIONALRESOURCES
MicroLogging
configure_logging(args...; kwargs...)
Call configure logging with the current logger, and update cached log
filtering information.
source
current_logger()
Return the logger for the current task, or the global logger if none is is
attached to the task.
source
disable_logging(level)
Disable all log messages at log levels equal to or less than level. This is a
global setting, intended to make debug logging extremely cheap when disabled.
source
435
436 CHAPTER 61. MICROLOGGING
global_logger()
Return the global logger, used to receive messages when no specific logger
exists for the current task.
global_logger(logger)
with_logger(function, logger)
Clustering
62.1 Clustering.dbscan
Clustering.dbscan — Method.
Keyword Arguments
Output
Example:
[] points = randn(3, 10000) clusters = dbscan(points, 0.05, minn eighbors =
3, minc lusters ize =20)clusterswithlessthan20pointswillbediscarded
source
437
438 CHAPTER 62. CLUSTERING
62.2 Clustering.mcl
Clustering.mcl — Method.
• add loops::Bool: whether edges of weight 1.0 from the node to itself
should be appended to the graph (enabled by default)
• expansion::Number: MCL expansion constant (2)
• inflation::Number: MCL inflation constant (2.0)
• save final matrix::Bool: save final equilibrium state in the result, oth-
erwise leave it empty; disabled by default, could be useful if MCL doesn’t
converge
• max iter::Integer: max number of MCL iterations
JuliaWebAPI
63.1 JuliaWebAPI.apicall
JuliaWebAPI.apicall — Method.
Calls a remote api cmd with args... and data.... The response is format-
ted as specified by the formatter specified in conn.
source
63.2 JuliaWebAPI.fnresponse
JuliaWebAPI.fnresponse — Method.
extract and return the response data as a direct function call would have
returned but throw error if the call was not successful.
source
63.3 JuliaWebAPI.httpresponse
JuliaWebAPI.httpresponse — Method.
construct an HTTP Response object from the API response
source
63.4 JuliaWebAPI.process
JuliaWebAPI.process — Method.
start processing as a server
source
439
440 CHAPTER 63. JULIAWEBAPI
63.5 JuliaWebAPI.register
JuliaWebAPI.register — Method.
Register a function as API call. TODO: validate method belongs to module?
source
Chapter 64
DecisionTree
441
442 CHAPTER 64. DECISIONTREE
Parameters
65.1 Parameters.reconstruct
Parameters.reconstruct — Method.
Make a new instance of a type with the same values as the input type except
for the fields given in the AbstractDict second argument or as keywords. Works
for types, Dicts, and NamedTuples.
Note: this is not very performant. Check Setfield.jl for a faster & nicer
implementation.
julia> struct A
a
b
end
julia> a = A(3,4)
A(3, 4)
source
65.2 Parameters.type2dict
Parameters.type2dict — Method.
Transforms a type-instance into a dictionary.
julia> type T
a
b
end
443
444 CHAPTER 65. PARAMETERS
julia> type2dict(T(4,5))
Dict{Symbol,Any} with 2 entries:
:a => 4
:b => 5
source
65.3 Parameters.with kw
Parameters.with kw — Function.
This function is called by the @with kw macro and does the syntax transfor-
mation from:
[] @withk wstructM M {R}r :: R =1000.a :: Rend
into
[] struct MM{R} r::R a::R MM{R}(r,a) where {R} = new(r,a) MM{R}(;r=1000.,
a=error(”no default for a”)) where {R} = MM{R}(r,a) inner kw, type-paras
are required when calling end MM(r::R,a::R) where {R} = MM{R}(r,a) de-
fault outer positional constructor MM(;r=1000,a=error(”no default for a”)) =
MM(r,a) outer kw, so no type-paras are needed when calling MM(m::MM;
kws...) = reconstruct(mm,kws) MM(m::MM, di::Union{AbstractDict, Tuple{Symbol,Any}})
= reconstruct(mm, di) macro unpackM M (varname)esc(quoter = varname.ra = varname.aend)endmac
source
Chapter 66
Blosc
66.1 Blosc.compress
Blosc.compress — Function.
66.2 Blosc.compress!
Blosc.compress! — Function.
66.3 Blosc.decompress!
Blosc.decompress! — Method.
decompress!(dest::Vector{T}, src::Vector{UInt8})
445
446 CHAPTER 66. BLOSC
66.4 Blosc.decompress
Blosc.decompress — Method.
decompress(T::Type, src::Vector{UInt8})
Missings
67.1 Missings.allowmissing
Missings.allowmissing — Method.
allowmissing(x::AbstractArray)
Return an array equal to x allowing for missing values, i.e. with an element
type equal to Union{eltype(x), Missing}.
When possible, the result will share memory with x (as with convert).
See also: disallowmissing
source
67.2 Missings.disallowmissing
Missings.disallowmissing — Method.
disallowmissing(x::AbstractArray)
Return an array equal to x not allowing for missing values, i.e. with an
element type equal to Missings.T(eltype(x)).
When possible, the result will share memory with x (as with convert). If x
contains missing values, a MethodError is thrown.
See also: allowmissing
source
67.3 Missings.levels
Missings.levels — Method.
levels(x)
447
448 CHAPTER 67. MISSINGS
ProgressMeter
68.1 ProgressMeter.cancel
ProgressMeter.cancel — Function.
cancel(prog, [msg], [color=:red]) cancels the progress display before
all tasks were completed. Optionally you can specify the message printed and
its color.
See also finish!.
source
68.2 ProgressMeter.finish!
ProgressMeter.finish! — Method.
finish!(prog) indicates that all tasks have been completed.
See also cancel.
source
68.3 ProgressMeter.next!
ProgressMeter.next! — Method.
next!(prog, [color]) reports that one unit of progress has been made.
Depending on the time interval since the last update, this may or may not
result in a change to the display.
You may optionally change the color of the display. See also update!.
source
68.4 ProgressMeter.update!
ProgressMeter.update! — Method.
449
450 CHAPTER 68. PROGRESSMETER
HttpServer
69.1 Base.run
Base.run — Method.
run starts server
Functionality:
451
452 CHAPTER 69. HTTPSERVER
Example:
source
69.2 Base.write
Base.write — Method.
Converts a Response to an HTTP response string
source
69.3 HttpServer.setcookie!
HttpServer.setcookie! — Function.
Sets a cookie with the given name, value, and attributes on the given re-
sponse object.
source
Chapter 70
MappedArrays
70.1 MappedArrays.mappedarray
MappedArrays.mappedarray — Method.
mappedarray(f, A)
creates a view of the array A that applies f to every element of A. The view
is read-only (you can get values but not set them).
source
70.2 MappedArrays.mappedarray
MappedArrays.mappedarray — Method.
mappedarray((f, finv), A)
creates a view of the array A that applies f to every element of A. The inverse
function, finv, allows one to also set values of the view and, correspondingly,
the values in A.
source
of_eltype(T, A)
of_eltype(val::T, A)
453
Chapter 71
TextParse
71.1 TextParse.csvread
TextParse.csvread — Function.
Arguments:
454
71.1. TEXTPARSE.CSVREAD 455
source
Chapter 72
LossFunctions
72.1 LearnBase.scaled
LearnBase.scaled — Method.
scaled(loss::SupervisedLoss, K)
72.2 LossFunctions.weightedloss
LossFunctions.weightedloss — Method.
weightedloss(loss, weight)
Returns a weighted version of loss for which the value of the positive class
is changed to be weight times its original, and the negative class 1 - weight
times its original respectively.
Note: If typeof(weight) <: Number, then this method will poison the
type-inference of the calling scope. This is because weight will be promoted
to a type parameter. For a typestable version use the following signature:
weightedloss(loss, Val{weight})
source
456
Chapter 73
LearnBase
73.1 LearnBase.grad
LearnBase.grad — Function.
Return the gradient of the learnable parameters w.r.t. some objective
source
73.2 LearnBase.grad!
LearnBase.grad! — Function.
Do a backward pass, updating the gradients of learnable parameters and/or
inputs
source
73.3 LearnBase.inputdomain
LearnBase.inputdomain — Function.
Returns an AbstractSet representing valid input values
source
73.4 LearnBase.targetdomain
LearnBase.targetdomain — Function.
Returns an AbstractSet representing valid output/target values
source
73.5 LearnBase.transform!
LearnBase.transform! — Function.
457
458 CHAPTER 73. LEARNBASE
Juno
74.1 Juno.clearconsole
Juno.clearconsole — Method.
clearconsole()
74.2 Juno.input
Juno.input — Function.
Prompt the user to input some text, and return it. Optionally display a
prompt.
source
74.3 Juno.selector
Juno.selector — Method.
selector([xs...]) -> x
459
460 CHAPTER 74. JUNO
74.4 Juno.structure
Juno.structure — Method.
structure(x)
Display x’s underlying representation, rather than using its normal display
method.
For example, structure(:(2x+1)) displays the Expr object with its head
and args fields instead of printing the expression.
source
Chapter 75
StatsModels
75.1 StatsBase.coefnames
StatsBase.coefnames — Method.
coefnames(mf::ModelFrame)
Returns a vector of coefficient names constructed from the Terms member
and the types of the evaluation columns.
source
75.2 StatsModels.dropterm
StatsModels.dropterm — Method.
dropterm(f::Formula, trm::Symbol)
Return a copy of f without the term trm.
Examples
[] julia¿ dropterm(@formula(foo 1 + bar + baz), :bar) Formula: foo 1+
baz
julia¿ dropterm(@formula(foo 1 + bar + baz), 1) Formula: foo 0 + bar
+ baz
source
75.3 StatsModels.setcontrasts!
StatsModels.setcontrasts! — Method.
setcontrasts!(mf::ModelFrame, new_contrasts::Dict)
Modify the contrast coding system of a ModelFrame in place.
source
461
Chapter 76
InternedStrings
76.1 InternedStrings.intern
InternedStrings.intern — Method.
Substrings are interned as their parent string type
source
76.2 InternedStrings.intern
InternedStrings.intern — Method.
intern(::Type{T}, s)
Intern s as if it were type T, converting it if required. Note that this will lead
to unexpected behavour if the type of s, and T, do not have equivalent equality
and hash functions (i.e. this is not safe if hash(s) != hash(convert(T, s))).
source
76.3 InternedStrings.intern
InternedStrings.intern — Method.
intern(s::T)
462
Chapter 77
HttpParser
463
Chapter 78
ImageAxes
78.1 ImageAxes.istimeaxis
ImageAxes.istimeaxis — Method.
istimeaxis(ax)
78.2 ImageAxes.timeaxis
ImageAxes.timeaxis — Method.
timeaxis(A)
Return the time axis, if present, of the array A, and nothing otherwise.
source
78.3 ImageAxes.timedim
ImageAxes.timedim — Method.
Return the dimension of the array used for encoding time, or 0 if not using
an axis for this purpose.
Note: if you want to recover information about the time axis, it is generally
better to use timeaxis.
source
464
Chapter 79
Flux
79.1 Flux.GRU
Flux.GRU — Method.
Gated Recurrent Unit layer. Behaves like an RNN but generally exhibits a
longer memory span over sequences.
See this article for a good overview of the internals.
source
79.2 Flux.LSTM
Flux.LSTM — Method.
Long Short Term Memory recurrent layer. Behaves like an RNN but gener-
ally exhibits a longer memory span over sequences.
See this article for a good overview of the internals.
source
79.3 Flux.RNN
Flux.RNN — Method.
The most basic recurrent layer; essentially acts as a Dense layer, but with
the output fed back into the input each time step.
source
465
Chapter 80
OnlineStats
80.1 OnlineStats.eachcol
OnlineStats.eachcol — Method.
eachcol(x::AbstractMatrix)
80.2 OnlineStats.eachrow
OnlineStats.eachrow — Method.
eachrow(x::AbstractMatrix)
eachrow(x::AbstractMatrix, y::Vector)
80.3 StatsBase.confint
StatsBase.confint — Function.
466
Chapter 81
IntervalSets
81.1 IntervalSets.:..
IntervalSets.:.. — Method.
iv = l..r
81.2 IntervalSets.:
IntervalSets.: — Method.
iv = centerhalfwidth
81.3 IntervalSets.width
IntervalSets.width — Method.
w = width(iv)
Calculate the width (max-min) of interval iv. Note that for integers l and
r, width(l..r) = length(l:r) - 1.
source
467
Chapter 82
Media
82.1 Media.getdisplay
Media.getdisplay — Method.
getdisplay(T)
82.2 Media.media
Media.media — Method.
media(T) gives the media type of the type T. The default is Textual.
media(Gadfly.Plot) == Media.Plot
source
82.3 Media.setdisplay
Media.setdisplay — Method.
setdisplay([input], T, output)
source
468
Chapter 83
Rotations
83.1 Rotations.isrotation
Rotations.isrotation — Method.
isrotation(r)
isrotation(r, tol)
rotation_between(from, to)
Compute the quaternion that rotates vector from so that it aligns with vector
to, along the geodesic (shortest path).
source
469
Chapter 84
Mustache
84.1 Mustache.render
Mustache.render — Method.
Render a set of tokens with a view, using optional io object to print or store.
Arguments
source
470
Chapter 85
TiledIteration
471
Chapter 86
Distances
RenyiDivergence(::Real)
renyi_divergence(P, Q, ::Real)
julia> pairwise(RenyiDivergence(0), x, x)
22 Array{Float64,2}:
0.0 0.0
0.0 0.0
julia> pairwise(Euclidean(2), x, x)
22 Array{Float64,2}:
0.0 0.577315
0.655407 0.0
source
472
Chapter 87
VersionParsing
87.1 VersionParsing.vparse
VersionParsing.vparse — Method.
vparse(s::AbstractString)
• Non-numeric prefixes are stripped along with any invalid version charac-
ters. Commas are treated as decimal points.
• Text following whitespace after the version number is ignored.
• When all else fails, everything except the first major.minor.patch digits
found are ignored.
source
473
Chapter 88
HttpCommon
88.1 HttpCommon.escapeHTML
HttpCommon.escapeHTML — Method.
escapeHTML(i::String)
Returns a string with special HTML characters escaped: &, <, >, “, ’
source
88.2 HttpCommon.parsequerystring
HttpCommon.parsequerystring — Method.
parsequerystring(query::String)
Convert a valid querystring to a Dict:
q = "foo=bar&baz=%3Ca%20href%3D%27https%3A%2F%2Fptop.only.wip.la%3A443%2Fhttp%2Fwww.hackershool.com%27%3Ehello%20world%2
parsequerystring(q)
# Dict{String,String} with 2 entries:
# "baz" => "<a href=’http://www.hackershool.com’>hello world!</a>"
# "foo" => "bar"
source
474
Chapter 89
StaticArrays
similar_type(static_array)
similar_type(static_array, T)
similar_type(array, ::Size)
similar_type(array, T, ::Size)
475
Chapter 90
SweepOperator
90.1 SweepOperator.sweep!
SweepOperator.sweep! — Method.
Symmetric sweep operator
Symmetric sweep operator of the matrix A on element k. A is overwritten.
inv = true will perform the inverse sweep. Only the upper triangle is read and
swept.
sweep!(A, k, inv = false)
Providing a Range, rather than an Integer, sweeps on each element in the
range.
sweep!(A, first:last, inv = false)
Example:
[] x = randn(100, 10) xtx = x’x sweep!(xtx, 1) sweep!(xtx, 1, true)
source
476
Chapter 91
PaddedViews
91.1 PaddedViews.paddedviews
PaddedViews.paddedviews — Method.
Pad the arrays A1, A2, . . . , to a common size or set of axes, chosen as the
span of axes enclosing all of the input arrays.
Example:
[] julia¿ a1 = reshape([1,2], 2, 1) 21 Array{Int64,2}: 1 2
julia¿ a2 = [1.0,2.0]’ 12 Array{Float64,2}: 1.0 2.0
julia¿ a1p, a2p = paddedviews(0, a1, a2);
julia¿ a1p 22 PaddedViews.PaddedView{Int64,2,Tuple{Base.OneTo{Int64},Base.OneTo{Int64}},Array{Int64,2}}:
1020
julia¿ a2p 22 PaddedViews.PaddedView{Float64,2,Tuple{Base.OneTo{Int64},Base.OneTo{Int64}},Array{Float64
1.0 2.0 0.0 0.0
source
477
Chapter 92
Pidfile
92.1 Pidfile.mkpidlock
Pidfile.mkpidlock — Function.
Create a pidfile lock for the path “at” for the current process or the process
identified by pid or proc.
Optional keyword arguments:
source
478
Chapter 93
SpecialFunctions
93.1 SpecialFunctions.cosint
SpecialFunctions.cosint — Function.
cosint(x)
93.2 SpecialFunctions.sinint
SpecialFunctions.sinint — Function.
sinint(x)
Rx sin t
Compute the sine integral function of x, defined by Si(x) := 0 t dt for
real x.
source
479
Chapter 94
NamedTuples
94.1 NamedTuples.delete
NamedTuples.delete — Method.
Create a new NamedTuple with the specified element removed.
source
94.2 NamedTuples.setindex
NamedTuples.setindex — Method.
Create a new NamedTuple with the new value set on it, either overwriting
the old value or appending a new value. This copies the underlying data.
source
480
Chapter 95
OnlineStatsBase
95.1 LearnBase.value
LearnBase.value — Method.
value(o::OnlineStat)
95.2 StatsBase.fit!
StatsBase.fit! — Method.
fit!(o::OnlineStat, data)
481
Chapter 96
Loess
96.1 Loess.loess
Loess.loess — Method.
482
Chapter 97
WoodburyMatrices
97.1 WoodburyMatrices.liftFactor
WoodburyMatrices.liftFactor — Method.
liftFactor(A)
More stable version of inv(A). Returns a function which computs the inverse
on evaluation, i.e. liftFactor(A)(x) is the same as inv(A)*x.
source
483
Chapter 98
Lazy
98.1 Lazy.takeuntil
Lazy.takeuntil — Method.
takeuntil(pred, list)
Take the elements in list until the pred function return true. Notice that
the one which makes pred true is also taken. All elements will be taken if no
one satisfy the pred function.
source
484
Chapter 99
Requests
99.1 Requests.save
Requests.save — Function.
save(r::Response, path=".")
Saves the data in the response in the directory path. If the path is a direc-
tory, then the filename is automatically chosen based on the response headers.
Returns the full pathname of the saved file.
source
485
Chapter 100
LineSearches
100.1 LineSearches.Static
LineSearches.Static — Method.
Static: defines a static linesearch which returns the initial step length.
Static is intended for methods with well-scaled updates; i.e. Newton, on
well-behaved problems.
source
486
Chapter 101
MemPool
101.1 MemPool.savetodisk
MemPool.savetodisk — Method.
Allow users to specifically save something to disk. This does not free the
data from memory, nor does it affect size accounting.
source
487
Chapter 102
SimpleTraits
102.1 SimpleTraits.istrait
SimpleTraits.istrait — Method.
This function checks whether a trait is fulfilled by a specific set of types.
source
488
Chapter 103
BinDeps
glibc_version()
For Linux-based systems, return the version of glibc in use. For non-glibc
Linux and other platforms, returns nothing.
source
489
Chapter 104
LaTeXStrings
104.1 LaTeXStrings.latexstring
LaTeXStrings.latexstring — Method.
latexstring(args...)
490