Skip to content

Commit

Permalink
Merge branch 'master' into compathelper/new_version/2023-05-02-00-39-…
Browse files Browse the repository at this point in the history
…03-640-03241771099
  • Loading branch information
baggepinnen authored Nov 13, 2023
2 parents 79b6b36 + 9c7c56f commit 5ecb1ce
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 12 deletions.
14 changes: 9 additions & 5 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "DynamicAxisWarping"
uuid = "aaaaaaaa-4a10-5553-b683-e707b00e83ce"
authors = ["Fredrik Bagge Carlson <[email protected]>"]
version = "0.4.15"
version = "0.4.18"

[deps]
BinDeps = "9e28174c-4ba2-5203-b857-d8d62c4213ee"
Expand All @@ -11,34 +11,38 @@ Distances = "b4f34e82-e78d-54a5-968a-f98e89d6e8f7"
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
LoopVectorization = "bdcacae8-1622-11e9-2a5c-532679323890"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
SlidingDistancesBase = "25b0cc0c-38e4-462f-a11d-8564868c562d"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
UnPack = "3a884ed6-31ef-47d7-9d2a-63182c4928ed"

[compat]
BinDeps = "1.0"
DataStructures = "0.17, 0.18"
DelimitedFiles = "1"
Distances = "0.8, 0.9, 0.10"
FillArrays = "1"
LoopVectorization = "0.9, 0.10, 0.11, 0.12"
Plots = "1.0"
ProgressMeter = "1.2"
RecipesBase = "1.0"
Requires = "1.0"
SlidingDistancesBase = "0.2, 0.3"
Statistics = "1"
StatsBase = "0.32, 0.33, 0.34"
UnPack = "0.1, 1"
julia = "1"
LinearAlgebra = "<0.0.1, 1"

[extras]
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
LightGraphs = "093fc24a-ae57-5d10-9952-331d41423f4d"
MatrixProfile = "24e37439-14ec-4097-bda3-6a65822e2305"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
QuadGK = "1fd47b50-473d-5c70-9696-f719f8f3bcdc"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["MatrixProfile", "LightGraphs", "QuadGK", "ForwardDiff"]
test = ["Test", "MatrixProfile", "LightGraphs", "QuadGK", "ForwardDiff", "Plots"]
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ plot(mp1, mp2)
The function `dtwnn` searches for a pattern in a long time series. By default, it *does not normalize* the data over each window, to do this, pass, e.g., `ZNormalizer` as the fifth argument.

```julia
using DynamicAxisWarping, Distances
using DynamicAxisWarping, Distances, Plots
radius = 5
a = sin.(0.1 .* (1:100)) .+ 0.1 .* randn.()
b = sin.(0.1 .* (1:100_000)) .+ 0.1 .* randn.()
Expand Down Expand Up @@ -216,6 +216,7 @@ profile = matrix_profile(y, m, DTW(radius, [transportcost]))
## `transportcost`
`transportcost` adds an additional penalty multiplier for "transporting", i.e., deviations from the Euclidean matching. The standard DTW distance does not consider this added cost and the default is 1. A value greater than 1 multiplies the cost of moving horizontally or vertically in the coupling matrix, promoting a diagonal move, corresponding to the standard Euclidean matching. The influence of the transport cost can be visualized with
```julia
using DynamicAxisWarping, Plots
a = sin.(1:100); b = sin.(1:100) .+ randn.();
dtwplot(a,b, transportcost=1) # Default
dtwplot(a,b, transportcost=1.01) # Should be "more diagonal"
Expand Down
2 changes: 1 addition & 1 deletion src/DynamicAxisWarping.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ using DataStructures
using SlidingDistancesBase
import SlidingDistancesBase: floattype, lastlength, setup_normalizer
using LoopVectorization
using Plots, Plots.PlotMeasures # Plots required both for @layout and for the margins
using RecipesBase
using Requires
using UnPack

Expand Down
2 changes: 1 addition & 1 deletion src/distance_interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Base.@kwdef struct FastDTW{D} <: DTWDistance{D}
FastDTW(r, dist=SqEuclidean()) = new{typeof(dist)}(r, dist)
end


Distances.result_type(::DTWDistance,::Type{T1},::Type{T2}) where {T1,T2} = float(promote_type(T1,T2))

function Distances.evaluate(d::DTW{<:Any,N}, x, y; kwargs...) where N
if lastlength(x) == lastlength(y)
Expand Down
11 changes: 7 additions & 4 deletions src/plots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,13 @@ handleargs(h; kwargs...) = handleargs(h.args...; kwargs...)
layout --> 1
end

left_margin --> 0mm
bottom_margin --> 0mm
top_margin --> 0mm
right_margin --> 0mm
plots_id = Base.PkgId(Base.UUID("91a5bcdd-55d7-5caf-9e0b-520d859cae80"), "Plots")
Plots = Base.loaded_modules[plots_id]

left_margin --> 0Plots.mm
bottom_margin --> 0Plots.mm
top_margin --> 0Plots.mm
right_margin --> 0Plots.mm

# heatmap
@series begin
Expand Down

0 comments on commit 5ecb1ce

Please sign in to comment.