Documentation | Build Status | Help |
---|---|---|
TSML is a package for time series data processing, classification, clustering, and prediction written in Julia.
The design/framework of this package is influenced heavily by Samuel Jenkins' Orchestra.jl and Paulito Palmes CombineML.jl packages.
- TS aggregation based on date-time interval
- TS imputation based on symmetric Nearest Neighbors
- TS statistical metrics for data quality assessment
- TS classification for automatic data discovery
- TS machine learning models with more than 100+ libraries from caret, scikitlearn, and julia
- TS date-value matrix conversion of 1-D TS using sliding windows for ML input
- Pipeline API for high-level workflow processing
- Easily extensible architecture relying on just two interfaces: fit and transform
- Common API wrappers for ML libs from JuliaML, PyCall, and RCall
TSML is in the Julia Official package registry. The latest release can be installed at the Julia prompt using Julia's package management which is triggered by pressing ]
at the julia prompt:
julia> ]
(v1.1) pkg> add TSML
Or, equivalently, via the Pkg
API:
julia> using Pkg
julia> Pkg.add("TSML")
- STABLE — documentation of the most recently tagged version.
- DEVEL — documentation of the in-development version.
TSML is tested and actively developed on Julia 1.0
and above for Linux and macOS.
There is no support for Julia versions 0.4
, 0.5
, 0.6
and 0.7
.
TSML (Time Series Machine Learning) is package for Time Series data processing, classification, and prediction. It combines ML libraries from Python's ScikitLearn, R's Caret, and Julia using a common API and allows seamless ensembling and integration of heterogenous ML libraries to create complex models for robust time-series prediction.
The package assumes a two-column table composed of Dates and Values. The first part of the workflow aggregates values based on the specified date/time interval which minimizes occurence of missing values and noise. The aggregated data is then left-joined to the complete sequence of dates in a specified date/time interval. Remaining missing values are replaced by k nearest neighbors where k is the symmetric distance from the location of missing value. This approach can be called several times until there are no more missing values.
The next part extracts the date features and convert the values into matrix form parameterized by the size and stride of the sliding window representing the dimension of the input for ML training and prediction.
The final part combines the date features and the matrix of values as input to the ML with the output representing the values of the time periods to be predicted ahead of time.
TSML uses a pipeline which iteratively calls the fit and transform families of functions relying on multiple dispatch to select the correct algorithm from the steps outlined above.
Machine learning functions in TSML are wrappers to the corresponding Scikit-learn, Caret, and native Julia ML libraries. There are more than hundred classifiers and regression functions available using a common API.
Generally, you will need the different transformers and utils in TSML for time-series processing. To use them, it is standard in TSML code to have the following declared at the topmost part of your application:
using TSML
using TSML.TSMLTransformers
using TSML.TSMLTypes
using TSML.Utils
using TSML: DataReader, DateValgator, DateValNNer
using TSML: Statifier, Monotonicer, Outliernicer
# Setup source data and filters to aggregate and impute hourly
fname = joinpath(dirname(pathof(TSML)),"../data/testdata.csv")
csvreader = DataReader(Dict(:filename=>fname,:dateformat=>"dd/mm/yyyy HH:MM"))
valgator = DateValgator(Dict(:dateinterval=>Dates.Hour(1))) # aggregator
valnner = DateValNNer(Dict(:dateinterval=>Dates.Hour(1))) # imputer
stfier = Statifier(Dict(:processmissing=>true)) # get statistics
mono = Monotonicer(Dict()) # normalize monotonic data
outnicer = Outliernicer(Dict(:dateinterval => Dates.Hour(1))) # normalize outliers
# Setup pipeline without imputation and run
mpipeline1 = Pipeline(Dict(
:transformers => [csvreader,valgator,stfier]
)
)
fit!(mpipeline1)
respipe1 = transform!(mpipeline1)
# Show statistics including blocks of missing data stats
@show respipe1
# Add imputation in the pipeline and rerun
mpipeline2 = Pipeline(Dict(
:transformers => [csvreader,valgator,valnner,stfier]
)
)
fit!(mpipeline2)
respipe2 = transform!(mpipeline2)
# Show statistics including blocks of missing data stats
@show respipe2
# Add imputation in the pipeline and rerun
mpipeline2 = Pipeline(Dict(
:transformers => [csvreader,valgator,valnner,outnicer]
)
)
fit!(mpipeline2)
respipe2 = transform!(mpipeline2)
# Show statistics including blocks of missing data stats
@show respipe2
# Add imputation in the pipeline and rerun
mpipeline2 = Pipeline(Dict(
:transformers => [csvreader,valgator,valnner,mono]
)
)
fit!(mpipeline2)
respipe2 = transform!(mpipeline2)
# Show statistics including blocks of missing data stats
@show respipe2
We welcome contributions, feature requests, and suggestions. Here is the link to open an issue for any problems you encounter. If you want to contribute, please follow the guidelines in contributors page.
Usage questions can be posted in: