Index
All structures and methods can be found in the Full Index with their accompanying docstrings in Documentation
Full Index
MetaICVI.MetaICVI
MetaICVI.MetaICVIModule
MetaICVI.MetaICVIModule
MetaICVI.MetaICVIModule
MetaICVI.MetaICVIOpts
MetaICVI.Rocket.RocketKernel
MetaICVI.Rocket.RocketModule
MetaICVI.Rocket.RocketModule
MetaICVI.Rocket.RocketModule
Base.show
MetaICVI.Rocket.apply_kernel
MetaICVI.Rocket.apply_kernels
MetaICVI.Rocket.load_rocket
MetaICVI.Rocket.save_rocket
MetaICVI.construct_classifier
MetaICVI.get_correlations
MetaICVI.get_cvi_data
MetaICVI.get_features
MetaICVI.get_icvis
MetaICVI.get_metaicvi
MetaICVI.get_probability
MetaICVI.get_rocket_features
MetaICVI.get_training_features
MetaICVI.is_pretrained
MetaICVI.load_classifier
MetaICVI.load_training_data
MetaICVI.safe_save_classifier
MetaICVI.safe_save_rocket
MetaICVI.save_classifier
MetaICVI.save_metaicvi
MetaICVI.serialize_data
MetaICVI.shuffle_x_y
MetaICVI.split_training_data
MetaICVI.split_x_y
MetaICVI.train_and_save
Documentation
MetaICVI.MetaICVI
— ModuleMain module for MetaICVI.jl
, a Julia package implementing the MetaICVI method.
This module exports all of the modules, options, and utilities used by the MetaICVI.jl package.
For full usage, see the official guide at https://ap6yc.github.io/MetaICVI.jl/dev/man/guide/.
Basic Usage
Install and import the package in a script with
using Pkg
Pkg.add("MetaICVI")
using MetaICVI
Next, create a MetaICVI module with some options
# Create the options
opts = MetaICVIOpts(
fail_on_missing = false
)
# Create a module
metaicvi = MetaICVIModule(opts)
Imports
The following names are imported by the package as dependencies:
Base
ClusterValidityIndices
Core
DocStringExtensions
JLD
JLD2
Logging
MetaICVI.Rocket
NumericalTypeAliases
Parameters
PyCall
PyCallJLD
Random
ScikitLearn
Exports
The following names are exported and available when using
the package:
MetaICVI.MetaICVIModule
— Typemutable struct MetaICVIModule
Summary
Stateful information for a single MetaICVI module.
Fields
opts::MetaICVIOpts
: Options for construction.
cvis::Vector{ClusterValidityIndices.CVI}
: List of cvis used for computing the CVIs.
criterion_values::Vector{Vector{Float64}}
: List of outputs of the cvis used for computing correlations.
correlations::Vector{Float64}
: List of outputs of the rank correlations.
features::Vector{Float64}
: List of outputs of the rocket feature kernels.
rocket::MetaICVI.Rocket.RocketModule
: Time-series random feature kernels module.
classifier::PyCall.PyObject
: ScikitLearn classifier.
performance::Float64
: Final output of the most recent the Meta-ICVI step.
probabilities::Vector{Float64}
: Final output of the most recent the Meta-ICVI step.
is_pretrained::Bool
: Internal flag for if the classifier is trained and ready for inference.
MetaICVI.MetaICVIModule
— MethodMetaICVIModule(opts::MetaICVIOpts) -> MetaICVIModule
Summary
Instantiate a MetaICVIModule with given options.
Arguments
opts::MetaICVIOpts
: options struct for the MetaICVI object.
Method List / Definition Locations
MetaICVIModule(opts)
defined at /home/runner/work/MetaICVI.jl/MetaICVI.jl/src/meta-icvi/meta-icvi.jl:144
.
MetaICVI.MetaICVIModule
— MethodMetaICVIModule() -> MetaICVIModule
Summary
Default constructor for the MetaICVIModule.
Method List / Definition Locations
MetaICVIModule()
defined at /home/runner/work/MetaICVI.jl/MetaICVI.jl/src/meta-icvi/meta-icvi.jl:224
.
MetaICVI.MetaICVIOpts
— Typemutable struct MetaICVIOpts
Summary
Meta-ICVI module options.
Examples
julia> MetaICVIOpts()
Fields
classifier_selection::Symbol
: Which scikitlearn classifier to load. Default: :SGDClassifierclassifier_opts::NamedTuple
: Scikitlearn classifier keyword arguments. Default: (loss = "log", max_iter = 30)icvi_window::Int64
: Size of ICVI window: [1, infty). Default: 5correlation_window::Int64
: Size of correlation window: [1, infty). Default: 5n_rocket::Int64
: Number of rocket kernels: [1, infty). Default: 5rocket_file::String
: Rocket file location. Default: module_dir("data", "models", "rocket.jld2")classifier_file::String
: Classifier file location. Default: module_dir("data", "models", "classifier.jld")display::Bool
: Display flag. Default: truefail_on_missing::Bool
: Flag to fail if any file is missing (rather than creating new objects). Default: false
Base.show
— Methodshow(io::IO, metaicvi::MetaICVIModule)
Summary
Display a metaicvi module to the command line.
Arguments
io::IO
: default io stream.metaicvi::MetaICVIModule
: metaicvi object about which to display info.
Method List / Definition Locations
show(io, metaicvi)
defined at /home/runner/work/MetaICVI.jl/MetaICVI.jl/src/meta-icvi/meta-icvi.jl:242
.
MetaICVI.construct_classifier
— Methodconstruct_classifier(opts::MetaICVIOpts) -> Any
Summary
Construct a new classifier for the MetaICVI module with metaprogramming.
Arguments
opts::MetaICVIOpts
: options containing the classifier type and options for instantiation.
Method List / Definition Locations
construct_classifier(opts)
defined at /home/runner/work/MetaICVI.jl/MetaICVI.jl/src/meta-icvi/meta-icvi.jl:278
.
MetaICVI.get_correlations
— Methodget_correlations(metaicvi::MetaICVIModule)
Summary
Compute and store the rank correlations from the cvi values.
Arguments
metaicvi::MetaICVIModule
: the Meta-ICVI module.
Method List / Definition Locations
get_correlations(metaicvi)
defined at /home/runner/work/MetaICVI.jl/MetaICVI.jl/src/meta-icvi/meta-icvi.jl:378
.
MetaICVI.get_cvi_data
— Methodget_cvi_data(data_file::AbstractString) -> Tuple{Any, Any}
Summary
Get the cvi data specified by the data_file path.
Arguments
data_file::String
: file containing clustered data for cvi processing.
Method List / Definition Locations
get_cvi_data(data_file)
defined at /home/runner/work/MetaICVI.jl/MetaICVI.jl/src/meta-icvi/meta-icvi.jl:493
.
MetaICVI.get_features
— Methodget_features(
metaicvi::MetaICVIModule,
sample::AbstractVector{T} where T<:Real,
label::Integer
) -> Vector{Float64}
Summary
Compute only the features on the sample and label without classifier inference.
Arguments
metaicvi::MetaICVIModule
: the Meta-ICVI module.sample::RealVector
: the sample used for clustering.label::Integer
: the label prescribed to the sample by the clustering algorithm.
Method List / Definition Locations
get_features(metaicvi, sample, label)
defined at /home/runner/work/MetaICVI.jl/MetaICVI.jl/src/meta-icvi/meta-icvi.jl:452
.
MetaICVI.get_icvis
— Methodget_icvis(
metaicvi::MetaICVIModule,
sample::AbstractVector{T} where T<:Real,
label::Integer
)
Summary
Compute and store the icvi criterion values.
Arguments
metaicvi::MetaICVIModule
: the Meta-ICVI module.sample::RealVector
: the sample used for clustering.label::Integer
: the label prescribed to the sample by the clustering algorithm.
Method List / Definition Locations
get_icvis(metaicvi, sample, label)
defined at /home/runner/work/MetaICVI.jl/MetaICVI.jl/src/meta-icvi/meta-icvi.jl:359
.
MetaICVI.get_metaicvi
— Methodget_metaicvi(
metaicvi::MetaICVIModule,
sample::AbstractVector{T} where T<:Real,
label::Integer
) -> Float64
Summary
Compute and return the meta-icvi value.
Arguments
metaicvi::MetaICVIModule
: the Meta-ICVI module.sample::RealVector
: the sample used for clustering.label::Integer
: the label prescribed to the sample by the clustering algorithm.
Method List / Definition Locations
get_metaicvi(metaicvi, sample, label)
defined at /home/runner/work/MetaICVI.jl/MetaICVI.jl/src/meta-icvi/meta-icvi.jl:471
.
MetaICVI.get_probability
— Methodget_probability(metaicvi::MetaICVIModule) -> Any
Summary
Compute and store the metaicvi value from the classifier.
Arguments
metaicvi::MetaICVIModule
: the Meta-ICVI module.
Method List / Definition Locations
get_probability(metaicvi)
defined at /home/runner/work/MetaICVI.jl/MetaICVI.jl/src/meta-icvi/meta-icvi.jl:428
.
MetaICVI.get_rocket_features
— Methodget_rocket_features(
metaicvi::MetaICVIModule
) -> Vector{Float64}
Summary
Compute and store the rocket features.
Arguments
metaicvi::MetaICVIModule
: the Meta-ICVI module.
Method List / Definition Locations
get_rocket_features(metaicvi)
defined at /home/runner/work/MetaICVI.jl/MetaICVI.jl/src/meta-icvi/meta-icvi.jl:399
.
MetaICVI.get_training_features
— Methodget_training_features(
metaicvi::MetaICVIModule,
data::Dict
) -> Tuple{Matrix{Float64}, Any}
Summary
Takes the MetaICVI data dictionary and computes the features for training the classifier.
Method List / Definition Locations
get_training_features(metaicvi, data)
defined at /home/runner/work/MetaICVI.jl/MetaICVI.jl/src/meta-icvi/meta-icvi.jl:610
.
MetaICVI.is_pretrained
— Methodis_pretrained(metaicvi::MetaICVIModule) -> Bool
Summary
Checks if the classifier is pretrained to permit inference.
Arguments
metaicvi::MetaICVIModule
: metaicvi module containing the classifier to check.
Method List / Definition Locations
is_pretrained(metaicvi)
defined at /home/runner/work/MetaICVI.jl/MetaICVI.jl/src/meta-icvi/meta-icvi.jl:416
.
MetaICVI.load_classifier
— Methodload_classifier(filepath::String) -> Any
Summary
Load the classifier at the filepath.
Arguments
filepath::String
: location of the classifier .jld file.
Method List / Definition Locations
load_classifier(filepath)
defined at /home/runner/work/MetaICVI.jl/MetaICVI.jl/src/meta-icvi/meta-icvi.jl:322
.
MetaICVI.load_training_data
— Methodload_training_data(data_path::AbstractString) -> Dict
Summary
Loads the MetaICVI training data from the provided directory.
Method List / Definition Locations
load_training_data(data_path)
defined at /home/runner/work/MetaICVI.jl/MetaICVI.jl/src/meta-icvi/meta-icvi.jl:506
.
MetaICVI.safe_save_classifier
— Methodsafe_save_classifier(metaicvi::MetaICVIModule) -> Any
Summary
Error handle saving of the metaicvi classifier.
Arguments
metaicvi::MetaICVIModule
: metaicvi module containing the classifier and path for saving.
Method List / Definition Locations
safe_save_classifier(metaicvi)
defined at /home/runner/work/MetaICVI.jl/MetaICVI.jl/src/meta-icvi/meta-icvi.jl:290
.
MetaICVI.safe_save_rocket
— Methodsafe_save_rocket(metaicvi::MetaICVIModule)
Summary
Error handle saving of the metaicvi rocket kernels.
Arguments
metaicvi::MetaICVIModule
: metaicvi module containing the classifier and path for saving.
Method List / Definition Locations
safe_save_rocket(metaicvi)
defined at /home/runner/work/MetaICVI.jl/MetaICVI.jl/src/meta-icvi/meta-icvi.jl:306
.
MetaICVI.save_classifier
— Methodsave_classifier(
classifier::PyCall.PyObject,
filepath::String
) -> Any
Summary
Save the classifier at the filepath.
Arguments
classifier::MetaICVIClassifier
: classifier object to save.filepath::String
: name/path to save the classifier .jld file.
Method List / Definition Locations
save_classifier(classifier, filepath)
defined at /home/runner/work/MetaICVI.jl/MetaICVI.jl/src/meta-icvi/meta-icvi.jl:335
.
MetaICVI.save_metaicvi
— Methodsave_metaicvi(metaicvi::MetaICVIModule) -> Any
Summary
Saves the MetaICVI object, including its rocket kernels and serialized classifier.
Method List / Definition Locations
save_metaicvi(metaicvi)
defined at /home/runner/work/MetaICVI.jl/MetaICVI.jl/src/meta-icvi/meta-icvi.jl:344
.
MetaICVI.serialize_data
— Methodserialize_data(data::Dict) -> Tuple{Any, Any}
Summary
Takes the MetaICVI data dictionary and creates a matrix of samples and vector of labels for all partition qualities.
Method List / Definition Locations
serialize_data(data)
defined at /home/runner/work/MetaICVI.jl/MetaICVI.jl/src/meta-icvi/meta-icvi.jl:600
.
MetaICVI.shuffle_x_y
— Methodshuffle_x_y(
x::AbstractMatrix{T} where T<:Real,
y::AbstractVector{T} where T<:Integer
) -> Tuple{Any, Any}
Summary
Shuffles a batch of samples and their corresponding integer labels.
Method List / Definition Locations
shuffle_x_y(x, y)
defined at /home/runner/work/MetaICVI.jl/MetaICVI.jl/src/meta-icvi/meta-icvi.jl:537
.
MetaICVI.split_training_data
— Methodsplit_training_data(
data::Dict;
split,
shuffle
) -> Tuple{Dict{Any, Any}, Dict{Any, Any}}
Summary
Splits the MetaICVI data dictionary into train and test data dictionaries.
Method List / Definition Locations
split_training_data(data; split, shuffle)
defined at /home/runner/work/MetaICVI.jl/MetaICVI.jl/src/meta-icvi/meta-icvi.jl:567
.
MetaICVI.split_x_y
— Methodsplit_x_y(
x::AbstractMatrix{T} where T<:Real,
y::AbstractVector{T} where T<:Integer;
split
) -> NTuple{4, Any}
Summary
Splits a batch of samples and their labels into train and test matrices.
Method List / Definition Locations
split_x_y(x, y; split)
defined at /home/runner/work/MetaICVI.jl/MetaICVI.jl/src/meta-icvi/meta-icvi.jl:549
.
MetaICVI.train_and_save
— Methodtrain_and_save(
metaicvi::MetaICVIModule,
x::AbstractMatrix{T} where T<:Real,
y::AbstractVector{T} where T<:Integer
) -> Any
Summary
Train the classifier on x/y and save the kernels and classifier.
Arguments
metaicvi::MetaICVIModule
: metaicvi module to save with.x::RealMatrix
: features to train on.y::IntegerVector
: correct/over/under partition targets.
Method List / Definition Locations
train_and_save(metaicvi, x, y)
defined at /home/runner/work/MetaICVI.jl/MetaICVI.jl/src/meta-icvi/meta-icvi.jl:662
.
MetaICVI.Rocket.RocketKernel
— TypeRocketKernel
Structure containing information about one rocket kernel.
MetaICVI.Rocket.RocketModule
— TypeRocketModule
Structure containing a vector of rocket kernels.
References
Authors
Angus Dempster, Francois Petitjean, Geoff Webb
Bibtex Entry
@article{dempsteretal2020, author = {Dempster, Angus and Petitjean, Francois and Webb, Geoffrey I}, title = {ROCKET: Exceptionally fast and accurate time classification using random convolutional kernels}, year = {2020}, journal = {Data Mining and Knowledge Discovery}, doi = {https://doi.org/10.1007/s10618-020-00701-z} }
Arxiv Preprint Link
https://arxiv.org/abs/1910.13051 (preprint)
MetaICVI.Rocket.RocketModule
— MethodRocketModule(input_length::Integer, n_kernels::Integer)
Create a new RocketModule structure, requiring feature length and the number of kernels.
MetaICVI.Rocket.RocketModule
— MethodRocketModule()
Default constructor for the RocketModule object.
MetaICVI.Rocket.apply_kernel
— Methodapply_kernel(kernel::RocketKernel, x::RealVector)
Apply a single RocketModule kernel to the sequence x.
Arguments
kernel::RocketKernel
: rocket kernel used for computing features.x::RealVector
: data sequence for computing rocket features.
MetaICVI.Rocket.apply_kernels
— Methodapply_kernels(rocket::RocketModule, x::RealVector)
Run a vector of rocket kernels along a sequence x.
Arguments
rocket::RocketModule
: rocket module containing many kernels for processing.x::RealVector
: data sequence for computing rocket features.
MetaICVI.Rocket.load_rocket
— Functionload_rocket(filepath::String="rocket.jld2")
Load and return a rocket module with existing parameters from a .jld2 file.
Arguments
filepath::String
: path to .jld2 containing rocket parameters. Defaults to rocket.jld2.
MetaICVI.Rocket.save_rocket
— Functionsave_rocket(rocket::RocketModule, filepath::String="rocket.jld2")
Save the rocket parameters to a .jld2 file.
Arguments
rocket::RocketModule
: rocket module to save. filepath::String
: path to .jld2 for saving rocket parameters. Defaults to rocket.jld2.