SoleBase

Documentation for SoleBase.

SoleBase._groupbyMethod
group items of list l according to the corresponding values in list v

julia> _groupby([31,28,31,30,31,30,31,31,30,31,30,31],
       [:Jan,:Feb,:Mar,:Apr,:May,:Jun,:Jul,:Aug,:Sep,:Oct,:Nov,:Dec])
Dict{Int64,Array{Symbol,1}} with 3 entries:
    31 => Symbol[:Jan, :Mar, :May, :Jul, :Aug, :Oct, :Dec]
    28 => Symbol[:Feb]
    30 => Symbol[:Apr, :Jun, :Sep, :Nov]
source
SoleBase._groupbyMethod
group items of list l according to the values taken by function f on them

julia> _groupby(iseven,1:10)
Dict{Bool,Array{Int64,1}} with 2 entries:
    false => [1, 3, 5, 7, 9]
    true  => [2, 4, 6, 8, 10]

Note:in this version l is required to be non-empty since I do not know how to access the return type of a function

source
SoleBase.instancesMethod
slicedataset(
    dataset::D,
    dataset_slice::AbstractVector{<:Integer};
    allow_no_instances = false,
    return_view = false,
    kwargs...,
) where {D<:AbstractDataset}

Return a machine learning dataset with a subset of the instances.

Implementation

In order to use slicedataset on a custom dataset representation, provide the following method: instances( dataset::D, datasetslice::AbstractVector{<:Integer}, returnview::Union{Val{true},Val{false}}; kwargs... ) where {D<:AbstractDataset}

source
SoleBase.movingwindowMethod
movingwindow(vec::AbstractVector; kwargs...)::AbstractVector{UnitRange{Int}}
movingwindow(npoints::Integer; kwargs...)::AbstractVector{UnitRange{Int}}

Return a certain number of equally-spaced windows (i.e., vector of integer indices), used for slicing a vector vec (or a vector of npoints values).

movingwindow(f::Base.Callable, vec::AbstractVector; kwargs...)::AbstractVector

Return the map of f over the window slicing of vec.

As for the keyword arguments, different flavors of this function are available, according to different use cases.

Fixed-size windows

function movingwindow(
    npoints::Integer;
    window_size::Union{Nothing,Real} = nothing,
    window_step::Union{Nothing,Real} = nothing,
    # Optional arguments
    landmark::Union{Integer,Nothing} = nothing,
    allow_landmark_position::Tuple{<:AbstractFloat,<:AbstractFloat} = (0.0, 1.0),
    kwargs...
)::AbstractVector{UnitRange{Int}}

Return windows of length window_size, with a step between consecutive windows of window_step. When the window_step is a floating point number, the step within the returned windows is not constant, but fluctuates around window_step.

When a landmark::Integer point is specified to the function, only windows containing the landmark will be returned. For example, with npoints=100 and landmark=50, all the windows will contain 50. It is also possible to specify the range for the relative position of the landmark within the windows using allow_landmark_position.

Fixed number of windows

function movingwindow(
    npoints::Integer;
    nwindows::Union{Nothing,Integer} = nothing,
    relative_overlap::Union{Nothing,AbstractFloat} = nothing,
    kwargs...
)::AbstractVector{UnitRange{Int}}

Compute nwindows windows, with consecutive windows overlapping by a portion equal to relative_overlap.

Fixed number of fixed-sized windows

function movingwindow(
    npoints::Integer;
    nwindows::Union{Nothing,Integer} = nothing,
    window_size::Union{Nothing,Real} = nothing,
    kwargs...
)::AbstractVector{UnitRange{Int}}

Compute nwindows windows of length window_size.

Examples

TODO

Compute windows of length window_size, with consecutive windows being shifted by window_step units.

source
SoleBase.nat_sortMethod
nat_sort(x, y)

"Little than" function implementing natural sort. It is meant to be used with Base.Sort functions as in sort(..., lt=nat_sort).

source
SoleBase.slicedatasetMethod
slicedataset(
    dataset::D,
    dataset_slice::AbstractVector{<:Integer};
    allow_no_instances = false,
    return_view = false,
    kwargs...,
) where {D<:AbstractDataset}

Return a machine learning dataset with a subset of the instances.

Implementation

In order to use slicedataset on a custom dataset representation, provide the following method: instances( dataset::D, datasetslice::AbstractVector{<:Integer}, returnview::Union{Val{true},Val{false}}; kwargs... ) where {D<:AbstractDataset}

source
SoleBase.spawnMethod

Spawns a MersenneTwister seeded using a number peeled from another rng. Useful for reproducibility.

source
SoleBase.throw_n_logFunction
throw_n_log(str::AbstractString, err_type = ErrorException)

Logs string str with @error and throw error of type err_type.

source