@@ -200,18 +200,18 @@ is_counting_based(o::AmplitudeAwareOrdinalPatterns) = false
200
200
function OrdinalPatterns {m} (τ = 1 , lt = isless_rand; kwargs... ) where {m}
201
201
if haskey (kwargs, :τ )
202
202
msg = " Keyword argument `τ` to `OrdinalPatterns` is deprecated. " *
203
- " The signature is now " *
204
- " `OrdinalPatterns{m}(τ = 1, lt::Function = ComplexityMeasures.isless_rand)`" *
205
- " , so provide `τ` as a positional argument instead. " *
203
+ " The signature is now " *
204
+ " `OrdinalPatterns{m}(τ = 1, lt::Function = ComplexityMeasures.isless_rand)`" *
205
+ " , so provide `τ` as a positional argument instead. " *
206
206
" In this call, the given keyword `τ` is used instead of the positional `τ`."
207
207
@warn msg
208
208
τ = kwargs[:τ ]
209
209
end
210
210
if haskey (kwargs, :lt )
211
211
msg = " Keyword argument `lt` to `OrdinalPatterns` is deprecated. " *
212
- " The signature is now " *
213
- " `OrdinalPatterns{m}(τ = 1, lt::Function = ComplexityMeasures.isless_rand)`" *
214
- " , so provide `lt` as a positional argument instead. " *
212
+ " The signature is now " *
213
+ " `OrdinalPatterns{m}(τ = 1, lt::Function = ComplexityMeasures.isless_rand)`" *
214
+ " , so provide `lt` as a positional argument instead. " *
215
215
" In this call, the given keyword `lt` is used instead of the positional `lt`."
216
216
@warn msg
217
217
lt = kwargs[:lt ]
@@ -225,18 +225,18 @@ end
225
225
function WeightedOrdinalPatterns {m} (τ = 1 , lt = isless_rand; kwargs... ) where {m}
226
226
if haskey (kwargs, :τ )
227
227
msg = " Keyword argument `τ` to `WeightedOrdinalPatterns` is deprecated. " *
228
- " The signature is now " *
229
- " `WeightedOrdinalPatterns{m}(τ::Int = 1, lt::F=ComplexityMeasures.isless_rand)`" *
230
- " , so provide `τ` as a positional argument instead. " *
228
+ " The signature is now " *
229
+ " `WeightedOrdinalPatterns{m}(τ::Int = 1, lt::F=ComplexityMeasures.isless_rand)`" *
230
+ " , so provide `τ` as a positional argument instead. " *
231
231
" In this call, the given keyword `τ` is used instead of the positional `τ`."
232
232
@warn msg
233
233
τ = kwargs[:τ ]
234
234
end
235
235
if haskey (kwargs, :lt )
236
236
msg = " Keyword argument `lt` to `WeightedOrdinalPatterns` is deprecated. " *
237
- " The signature is now " *
238
- " `WeightedOrdinalPatterns{m}(τ = 1, lt::Function = ComplexityMeasures.isless_rand)`" *
239
- " , so provide `lt` as a positional argument instead. " *
237
+ " The signature is now " *
238
+ " `WeightedOrdinalPatterns{m}(τ = 1, lt::Function = ComplexityMeasures.isless_rand)`" *
239
+ " , so provide `lt` as a positional argument instead. " *
240
240
" In this call, the given keyword `lt` is used instead of the positional `lt`."
241
241
@warn msg
242
242
lt = kwargs[:lt ]
@@ -248,38 +248,38 @@ function WeightedOrdinalPatterns{m}(τ = 1, lt = isless_rand; kwargs...) where {
248
248
return WeightedOrdinalPatterns {m, F, I} (OrdinalPatternEncoding {m} (lt), τ)
249
249
end
250
250
251
- function AmplitudeAwareOrdinalPatterns {m} (τ = 1 , A = 0.5 , lt = isless_rand;
251
+ function AmplitudeAwareOrdinalPatterns {m} (τ = 1 , A = 0.5 , lt = isless_rand;
252
252
kwargs... ) where {m}
253
253
# because the order of the arguments is different from the other ordinal outcome spaces
254
254
if A isa Function
255
255
msg = " Second argument to `AmplitudeAwareOrdinalPatterns` must be a function. " *
256
256
" Got a $(typeof (A)) ." ;
257
257
throw (ArgumentError (msg))
258
258
end
259
-
259
+
260
260
if haskey (kwargs, :τ )
261
261
msg = " Keyword argument `τ` to `AmplitudeAwareOrdinalPatterns` is deprecated. " *
262
- " The signature is now " *
263
- " `AmplitudeAwareOrdinalPatterns{m}(τ::Int = 1, A = 0.5, lt::F=isless_rand)`" *
264
- " , so provide `τ` as a positional argument instead. " *
262
+ " The signature is now " *
263
+ " `AmplitudeAwareOrdinalPatterns{m}(τ::Int = 1, A = 0.5, lt::F=isless_rand)`" *
264
+ " , so provide `τ` as a positional argument instead. " *
265
265
" In this call, the given keyword `τ` is used instead of the positional `τ`."
266
266
@warn msg
267
267
τ = kwargs[:τ ]
268
268
end
269
269
if haskey (kwargs, :lt )
270
270
msg = " Keyword argument `lt` to `AmplitudeAwareOrdinalPatterns` is deprecated. " *
271
- " The signature is now " *
272
- " `AmplitudeAwareOrdinalPatterns{m}(τ::Int = 1, A = 0.5, lt::F=isless_rand)`" *
273
- " , so provide `lt` as a positional argument instead. " *
271
+ " The signature is now " *
272
+ " `AmplitudeAwareOrdinalPatterns{m}(τ::Int = 1, A = 0.5, lt::F=isless_rand)`" *
273
+ " , so provide `lt` as a positional argument instead. " *
274
274
" In this call, the given keyword `lt` is used instead of the positional `lt`."
275
275
@warn msg
276
276
lt = kwargs[:lt ]
277
277
end
278
278
if haskey (kwargs, :A )
279
279
msg = " Keyword argument `A` to `AmplitudeAwareOrdinalPatterns` is deprecated. " *
280
- " The signature is now " *
281
- " `AmplitudeAwareOrdinalPatterns{m}(τ::Int = 1, A = 0.5, lt::F=isless_rand)`" *
282
- " , so provide `A` as a positional argument instead. " *
280
+ " The signature is now " *
281
+ " `AmplitudeAwareOrdinalPatterns{m}(τ::Int = 1, A = 0.5, lt::F=isless_rand)`" *
282
+ " , so provide `A` as a positional argument instead. " *
283
283
" In this call, the given keyword `A` is used instead of the positional `A`."
284
284
@warn msg
285
285
A = kwargs[:A ]
@@ -335,25 +335,9 @@ function fasthist!(πs::Vector{Int}, est::OrdinalOutcomeSpace{m}, x::AbstractSta
335
335
return cts
336
336
end
337
337
338
- function codify (est:: OrdinalOutcomeSpace{m} , x) where m
339
- if x isa AbstractVector
340
- dataset = embed (x, m, est. τ)
341
- elseif x isa AbstractStateSpaceSet && dimension (x) == 1
342
- err = " Convert your univariate time series to a subtype of `AbstractVector` to " *
343
- " codify with ordinal patterns! A `StateSpaceSet` input is assumed to be " *
344
- " already embedded in D = m >= 2 dimensional space."
345
- throw (ArgumentError (err))
346
- else
347
- dataset = x
348
- end
349
- m != dimension (dataset) && throw (ArgumentError (
350
- " Order of ordinal patterns and dimension of `StateSpaceSet` must match!"
351
- ))
352
- πs = zeros (Int, length (dataset))
353
- @inbounds for (i, χ) in enumerate (dataset)
354
- πs[i] = encode (est. encoding, χ)
355
- end
356
- return πs
338
+ function codify (o:: OrdinalOutcomeSpace{m} , x:: AbstractVector{<:Real} ) where {m}
339
+ emb = embed (x, m, o. τ). data
340
+ return encode .(Ref (o. encoding), emb)
357
341
end
358
342
359
343
# Special treatment for counting-based
@@ -448,8 +432,3 @@ Encode relative amplitude information of the elements of `a`.
448
432
function AAPE (x, A:: Real = 0.5 , m:: Int = length (x))
449
433
(A/ m)* sum (abs .(x)) + (1 - A)/ (m- 1 )* sum (abs .(diff (x)))
450
434
end
451
-
452
- function codify (o:: OrdinalPatterns{m} , x:: AbstractVector ) where {m}
453
- emb = embed (x, m, o. τ). data
454
- return encode .(Ref (o. encoding), emb)
455
- end
0 commit comments