Skip to content

Commit

Permalink
version bump fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
matbesancon committed Jul 30, 2019
2 parents 5bd3173 + b9454f9 commit 4d71fc7
Show file tree
Hide file tree
Showing 25 changed files with 731 additions and 274 deletions.
14 changes: 12 additions & 2 deletions .travis.yml
Expand Up @@ -3,8 +3,8 @@ os:
- linux
- osx
julia:
- 0.7
- 1.0
- 1.2
- nightly
notifications:
email: false
Expand All @@ -17,4 +17,14 @@ git:
# - julia -e 'Pkg.clone(pwd()); Pkg.build("StatsBase"); Pkg.test("StatsBase"; coverage=true)'
after_success:
- julia -e 'using Pkg; Pkg.add("Coverage"); using Coverage; Coveralls.submit(process_folder()); Codecov.submit(process_folder())';
- julia -e 'using Pkg; Pkg.add("Documenter"); include(joinpath("docs", "make.jl"))'
jobs:
include:
- stage: "Documentation"
julia: 1.0
os: linux
script:
- julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd()));
Pkg.instantiate()'
- julia --project=docs/ docs/make.jl
after_success: skip

13 changes: 9 additions & 4 deletions Project.toml
Expand Up @@ -4,18 +4,23 @@ authors = ["JuliaStats"]
version = "0.32.0"

[deps]
DataAPI = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a"
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Missings = "e1d29d7a-bbdc-5cf2-9ac0-f12de2c33e28"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
SortingAlgorithms = "a2af1166-a08f-5f64-846c-94a0d3cef48c"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"

[extras]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["DelimitedFiles", "LinearAlgebra", "Random", "SparseArrays", "Test"]
test = ["Dates", "DelimitedFiles", "Test"]

[compat]
julia = "1"
4 changes: 0 additions & 4 deletions REQUIRE

This file was deleted.

2 changes: 1 addition & 1 deletion appveyor.yml
@@ -1,7 +1,7 @@
environment:
matrix:
- julia_version: 0.7
- julia_version: 1.0
- julia_version: 1.2
- julia_version: nightly

platform:
Expand Down
5 changes: 5 additions & 0 deletions docs/Project.toml
@@ -0,0 +1,5 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"

[compat]
Documenter = "~0.22"
14 changes: 7 additions & 7 deletions docs/make.jl
@@ -1,7 +1,11 @@
using Documenter, StatsBase, Statistics, Random

# Workaround for JuliaLang/julia/pull/28625
if Base.HOME_PROJECT[] !== nothing
Base.HOME_PROJECT[] = abspath(Base.HOME_PROJECT[])
end

makedocs(
format = :html,
sitename = "StatsBase.jl",
modules = [StatsBase],
pages = ["index.md",
Expand All @@ -23,9 +27,5 @@ makedocs(
)

deploydocs(
repo = "github.com/JuliaStats/StatsBase.jl.git",
target = "build",
julia = "1.0",
deps = nothing,
make = nothing
)
repo = "github.com/JuliaStats/StatsBase.jl.git"
)
5 changes: 5 additions & 0 deletions docs/src/cov.md
Expand Up @@ -5,8 +5,13 @@ This package implements functions for computing scatter matrix, as well as weigh
```@docs
scattermat
cov
cov(::CovarianceEstimator, ::AbstractVector)
cov(::CovarianceEstimator, ::AbstractVector, ::AbstractVector)
cov(::CovarianceEstimator, ::AbstractMatrix)
cor
mean_and_cov
cov2cor
cor2cov
CovarianceEstimator
SimpleCovariance
```
68 changes: 67 additions & 1 deletion docs/src/weights.md
Expand Up @@ -50,6 +50,71 @@ w = Weights([1., 2., 3.])
w = weights([1., 2., 3.])
```

### Exponential weights: `eweights`

Exponential weights are a common form of temporal weights which assign exponentially decreasing
weights to past observations.

If `t` is a vector of temporal indices then for each index `i` we compute the weight as:

``λ (1 - λ)^{1 - i}``

``λ`` is a smoothing factor or rate parameter such that ``0 < λ ≤ 1``.
As this value approaches 0, the resulting weights will be almost equal,
while values closer to 1 will put greater weight on the tail elements of the vector.

For example, the following call generates exponential weights for ten observations with ``λ = 0.3``.
```julia-repl
julia> eweights(1:10, 0.3)
10-element Weights{Float64,Float64,Array{Float64,1}}:
0.3
0.42857142857142855
0.6122448979591837
0.8746355685131197
1.249479383590171
1.7849705479859588
2.549957925694227
3.642797036706039
5.203995766722913
7.434279666747019
```

Simply passing the number of observations `n` is equivalent to passing in `1:n`.

```julia-repl
julia> eweights(10, 0.3)
10-element Weights{Float64,Float64,Array{Float64,1}}:
0.3
0.42857142857142855
0.6122448979591837
0.8746355685131197
1.249479383590171
1.7849705479859588
2.549957925694227
3.642797036706039
5.203995766722913
7.434279666747019
```

Finally, you can construct exponential weights from an arbitrary subset of timestamps within a larger range.

```julia-repl
julia> t
2019-01-01T01:00:00:2 hours:2019-01-01T05:00:00
julia> r
2019-01-01T01:00:00:1 hour:2019-01-02T01:00:00
julia> eweights(t, r, 0.3)
3-element Weights{Float64,Float64,Array{Float64,1}}:
0.3
0.6122448979591837
1.249479383590171
```

NOTE: This is equivalent to `eweights(something.(indexin(t, r)), 0.3)`, which is saying that for each value in `t` return the corresponding index for that value in `r`.
Since `indexin` returns `nothing` if there is no corresponding value from `t` in `r` we use `something` to eliminate that possibility.

## Methods

`AbstractWeights` implements the following methods:
Expand All @@ -70,5 +135,6 @@ Weights
aweights
fweights
pweights
eweights
weights
```
```
94 changes: 49 additions & 45 deletions src/StatsBase.jl
@@ -1,27 +1,28 @@
__precompile__()

module StatsBase
import Base: length, isempty, eltype, values, sum, show, maximum, minimum, extrema
import Base.Cartesian: @nloops, @nref, @nextract
using Base: @irrational, @propagate_inbounds
import DataStructures: heapify!, heappop!, percolate_down!
using SortingAlgorithms
using Missings

using Statistics
using LinearAlgebra
using Random
using Printf
using SparseArrays
import Random: rand, rand!
import LinearAlgebra: BlasReal, BlasFloat
import Statistics: mean, mean!, var, varm, varm!, std, stdm, cov, covm,
cor, corm, cov2cor!, unscaled_covzm, quantile, sqrt!,
median, middle

import Base: length, isempty, eltype, values, sum, show, maximum, minimum, extrema
import Base.Cartesian: @nloops, @nref, @nextract
using Base: @irrational, @propagate_inbounds
using DataAPI
import DataAPI: describe
import DataStructures: heapify!, heappop!, percolate_down!
using SortingAlgorithms
using Missings

using Statistics
using LinearAlgebra
using Random
using Printf
using SparseArrays
import Random: rand, rand!
import LinearAlgebra: BlasReal, BlasFloat
import Statistics: mean, mean!, var, varm, varm!, std, stdm, cov, covm,
cor, corm, cov2cor!, unscaled_covzm, quantile, sqrt!,
median, middle

## tackle compatibility issues

export
export

## weights
AbstractWeights, # abstract type to represent any weight vector
Expand All @@ -33,6 +34,7 @@ module StatsBase
aweights, # construct an AnalyticWeights vector
fweights, # construct a FrequencyWeights vector
pweights, # construct a ProbabilityWeights vector
eweights, # construct an exponential Weights vector
wsum, # weighted sum with vector as second argument
wsum!, # weighted sum across dimensions with provided storage
wmean, # weighted mean
Expand Down Expand Up @@ -97,6 +99,8 @@ module StatsBase
scattermat, # scatter matrix (i.e. unnormalized covariance)
cov2cor, # converts a covariance matrix to a correlation matrix
cor2cov, # converts a correlation matrix to a covariance matrix
CovarianceEstimator, # abstract type for covariance estimators
SimpleCovariance, # simple covariance estimator

## counts
addcounts!, # add counts to an accumulating array or map
Expand Down Expand Up @@ -207,30 +211,30 @@ module StatsBase
ZScoreTransform, # the type to represent a z-score data transformation
UnitRangeTransform # the type to represent a 0-1 data transformation

# source files

include("common.jl")
include("weights.jl")
include("moments.jl")
include("scalarstats.jl")
include("robust.jl")
include("deviation.jl")
include("cov.jl")
include("counts.jl")
include("ranking.jl")
include("toeplitzsolvers.jl")
include("rankcorr.jl")
include("signalcorr.jl")
include("partialcor.jl")
include("empirical.jl")
include("hist.jl")
include("misc.jl")

include("sampling.jl")
include("statmodels.jl")

include("transformations.jl")

include("deprecates.jl")
# source files

include("common.jl")
include("weights.jl")
include("moments.jl")
include("scalarstats.jl")
include("robust.jl")
include("deviation.jl")
include("cov.jl")
include("counts.jl")
include("ranking.jl")
include("toeplitzsolvers.jl")
include("rankcorr.jl")
include("signalcorr.jl")
include("partialcor.jl")
include("empirical.jl")
include("hist.jl")
include("misc.jl")

include("sampling.jl")
include("statmodels.jl")

include("transformations.jl")

include("deprecates.jl")

end # module

0 comments on commit 4d71fc7

Please sign in to comment.