From 612e96def1f486a6d533974c0c7133e2eb39d96a Mon Sep 17 00:00:00 2001 From: Paulito Palmes Date: Fri, 7 Apr 2023 10:24:05 +0100 Subject: [PATCH 1/6] Update README.md --- README.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3114af9..eef44a6 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,22 @@ -
+ +
+alt="TSML Logo" width="250"> + -![Overall Stats](https://github-readme-stats.vercel.app/api?username=ppalmes&count_private=true&show_icons=true&hide=contribs) +
[![OpenSSF Best Practices](https://bestpractices.coreinfrastructure.org/projects/7094/badge)](https://bestpractices.coreinfrastructure.org/projects/7094) +![Overall Stats](https://github-readme-stats.vercel.app/api?username=ppalmes&count_private=true&show_icons=true&hide=contribs) + | **Documentation** | **Build Status** | **Help** | |:---:|:---:|:---:| | [![][docs-dev-img]][docs-dev-url] [![][docs-stable-img]][docs-stable-url] | [![][travis-img]][travis-url] | [![][slack-img]][slack-url] [![][gitter-img]][gitter-url] | +
+ #### Stargazers over time [![Stargazers over time](https://starchart.cc/IBM/TSML.jl.svg)](https://starchart.cc/IBM/TSML.jl) From a9eb0d3f1bb7475403bb720a855a123617d3a614 Mon Sep 17 00:00:00 2001 From: Paulito Palmes Date: Fri, 7 Apr 2023 10:27:19 +0100 Subject: [PATCH 2/6] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index eef44a6..9107611 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@
+![Visitor](https://visitor-badge.laobi.icu/badge?page_id=ppalmes.TSML.jl) + TSML Logo From 1b0333980b5a2835329ad709d1fc2b368f9371af Mon Sep 17 00:00:00 2001 From: Paulito Palmes Date: Fri, 7 Apr 2023 10:30:25 +0100 Subject: [PATCH 3/6] Update README.md --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 9107611..0f00d44 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,6 @@ src="https://ibm.github.io/TSML.jl/tsmllogo/tsmllogo13.png" alt="TSML Logo" width="250"> -
- [![OpenSSF Best Practices](https://bestpractices.coreinfrastructure.org/projects/7094/badge)](https://bestpractices.coreinfrastructure.org/projects/7094) ![Overall Stats](https://github-readme-stats.vercel.app/api?username=ppalmes&count_private=true&show_icons=true&hide=contribs) From ca5e9496ec03646ab2f7b67b3776439cf16ebb45 Mon Sep 17 00:00:00 2001 From: Paulito Palmes Date: Fri, 7 Apr 2023 10:33:53 +0100 Subject: [PATCH 4/6] Update README.md --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0f00d44..17dbaae 100644 --- a/README.md +++ b/README.md @@ -148,7 +148,7 @@ chkoutlier = Outliernicer(Dict(:dateinterval => Dates.Hour(1))) # normalize ou - ##### Pipeline to load csv data ```julia -pipexpr = @pipeline csvread +pipexpr = csvread data = fit_transform!(pipexpr) first(data,5) @@ -165,7 +165,7 @@ first(data,5) - ##### Pipeline to aggregate and check statistics ```julia -pipexpr = @pipeline csvread |> aggregate |> chkstats +pipexpr = csvread |> aggregate |> chkstats stats = fit_transform!(pipexpr) 1×26 DataFrame. Omitted printing of 19 columns @@ -178,7 +178,7 @@ Note: `fit_transform!` is equivalent to calling in sequence `fit!` and `transfor - ##### Pipeline to aggregate, impute, and check stats ```julia -pipexpr = @pipeline csvread |> aggregate |> impute |> chkstats +pipexpr = csvread |> aggregate |> impute |> chkstats stats2 = fit_transform!(pipexpr) 1×26 DataFrame. Omitted printing of 19 columns @@ -190,7 +190,7 @@ stats2 = fit_transform!(pipexpr) - ##### Pipeline to aggregate, impute, and normalize monotonic data ```julia -pipexpr = @pipeline csvread |> aggregate |> impute |> normtonic +pipexpr = csvread |> aggregate |> impute |> normtonic fit_transform!(pipexpr) 8761×2 DataFrame @@ -231,7 +231,7 @@ ts = DataFrame(Date=datets,Value=valuets) args = Dict(:ahead => 24,:size => 24,:stride => 5) datemtr = Dateifier(args) valuemtr = Matrifier(args) -ppl = @pipeline datemtr + valuemtr +ppl = datemtr + valuemtr dateval = fit_transform!(ppl,ts) first(dateval,5) From 3255e3dccdaf372183e7839bc9acad496e9e93b7 Mon Sep 17 00:00:00 2001 From: "Paulito Palmes, PhD" Date: Fri, 7 Apr 2023 16:00:34 +0100 Subject: [PATCH 5/6] make plotting as default output Signed-off-by: Paulito Palmes, PhD --- Project.toml | 4 +- docs/notebooks/JuliaCon2019.jl.ipynb | 2 +- docs/notebooks/StaticPlotting.jl.ipynb | 964 +++++++++--------- docs/src/man/dateproc.md | 2 +- docs/src/tutorial/monotonic_plotting.md | 54 +- ...ting_pdf.md => monotonic_plotting_pdf.md1} | 52 +- docs/src/tutorial/pipeline.md | 6 +- docs/src/tutorial/statistics.md | 8 +- docs/src/tutorial/tsclassifier.md | 2 +- src/plotter.jl | 54 +- test/test_plotter.jl | 4 +- 11 files changed, 572 insertions(+), 580 deletions(-) rename docs/src/tutorial/{monotonic_plotting_pdf.md => monotonic_plotting_pdf.md1} (80%) diff --git a/Project.toml b/Project.toml index dc50313..75b5216 100644 --- a/Project.toml +++ b/Project.toml @@ -9,12 +9,13 @@ ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63" CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b" DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" +GR = "28b8d3ca-fb5f-59d9-8090-bfdbd6d07a71" Impute = "f7bf1975-0170-51b9-8c5f-a992d46b9575" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" MLDataUtils = "cc2ba9b6-d476-5e6d-8eaf-a92d5412d41d" MultivariateStats = "6f286f6a-111f-5878-ab1e-185364afe411" +Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" -RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01" Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b" Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" @@ -27,7 +28,6 @@ DataFrames = "0.17, 0.18, 0.19, 0.20, 0.21, 0.22, 1.0, 1.1, 1.2" Impute = "0.5, 0.6" MLDataUtils = "0.2, 0.3, 0.4, 0.5" MultivariateStats = "0.5, 0.6, 0.7, 0.8, 0.9, 0.10" -RecipesBase = "1.1" StatsBase = "0.29, 0.30, 0.31, 0.32, 0.33" julia = "1" diff --git a/docs/notebooks/JuliaCon2019.jl.ipynb b/docs/notebooks/JuliaCon2019.jl.ipynb index dfc107a..13693f7 100644 --- a/docs/notebooks/JuliaCon2019.jl.ipynb +++ b/docs/notebooks/JuliaCon2019.jl.ipynb @@ -304,7 +304,7 @@ } ], "source": [ - "pltr=Plotter(Dict(:interactive => true))\n", + "pltr=Plotter(Dict(:pdfoutput => true))\n", "\n", "mypipeline = pltr\n", "\n", diff --git a/docs/notebooks/StaticPlotting.jl.ipynb b/docs/notebooks/StaticPlotting.jl.ipynb index 858064d..f1ee4b3 100644 --- a/docs/notebooks/StaticPlotting.jl.ipynb +++ b/docs/notebooks/StaticPlotting.jl.ipynb @@ -9,7 +9,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ @@ -44,7 +44,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 5, "metadata": {}, "outputs": [ { @@ -87,7 +87,7 @@ " 10 │ 2014-01-01T02:15:00 0.125287" ] }, - "execution_count": 7, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -106,122 +106,119 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "\n", - "\n", + "\n", "\n", - " \n", - " \n", + " \n", + " \n", " \n", "\n", - "\n", + "\n", "\n", - " \n", - " \n", + " \n", + " \n", " \n", "\n", - "\n", + "\n", "\n", - " \n", - " \n", + " \n", + " \n", " \n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n" + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n" ] }, "metadata": {}, @@ -229,7 +226,7 @@ } ], "source": [ - "pltr=Plotter(Dict(:interactive => false))\n", + "pltr=Plotter()\n", "\n", "mypipeline = pltr\n", "\n", @@ -246,7 +243,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 7, "metadata": {}, "outputs": [ { @@ -271,7 +268,7 @@ " 1 │ 2014-01-01T00:00:00 2014-01-05T00:00:00 0.249351 270 0.999721 0.000981938 0.47879 0.481656 0.0787459 0.157719 0.230357 0.728315 0.778832 0.883753 -1.22101 0.0106693 0.602218 67.6642 0.25577 0.275333 1.0 1.30682 1.0 1.25 1.0 4.0" ] }, - "execution_count": 9, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } @@ -294,58 +291,55 @@ }, { "cell_type": "code", - "execution_count": 93, + "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "\n", - "\n", + "\n", "\n", - " \n", - " \n", + " \n", + " \n", " \n", "\n", - "\n", + "\n", "\n", - " \n", - " \n", + " \n", + " \n", " \n", "\n", - "\n", + "\n", "\n", - " \n", - " \n", + " \n", + " \n", " \n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n" + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n" ] }, "metadata": {}, @@ -371,7 +365,7 @@ }, { "cell_type": "code", - "execution_count": 94, + "execution_count": 9, "metadata": {}, "outputs": [], "source": [ @@ -395,58 +389,55 @@ }, { "cell_type": "code", - "execution_count": 98, + "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "\n", - "\n", + "\n", "\n", - " \n", - " \n", + " \n", + " \n", " \n", "\n", - "\n", + "\n", "\n", - " \n", - " \n", + " \n", + " \n", " \n", "\n", - "\n", + "\n", "\n", - " \n", - " \n", + " \n", + " \n", " \n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n" + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n" ] }, "metadata": {}, @@ -469,7 +460,7 @@ }, { "cell_type": "code", - "execution_count": 99, + "execution_count": 11, "metadata": {}, "outputs": [ { @@ -494,7 +485,7 @@ " 1 │ 2014-01-01T00:00:00 2014-12-31T15:00:00 0.998859 3830 18.8 8.5 10.35 11.557 9.9 10.0 10.0 12.3 13.0 16.0 0.730635 1.41283 0.200055 -1.09145e5 4.39315 1.04644 4931.0 4931.0 4931.0 4931.0 4931.0 4931.0" ] }, - "execution_count": 99, + "execution_count": 11, "metadata": {}, "output_type": "execute_result" } @@ -514,7 +505,7 @@ }, { "cell_type": "code", - "execution_count": 100, + "execution_count": 12, "metadata": {}, "outputs": [ { @@ -539,7 +530,7 @@ " 1 │ 2014-01-01T00:00:00 2014-12-31T15:00:00 0.998859 8761 18.8 8.5 9.9 10.6244 9.9 9.9 9.9 10.0 10.5 12.5 6.67036 2.7373 0.163356 -2.21059e5 4.50868 1.05318 NaN NaN NaN NaN NaN NaN" ] }, - "execution_count": 100, + "execution_count": 12, "metadata": {}, "output_type": "execute_result" } @@ -559,58 +550,55 @@ }, { "cell_type": "code", - "execution_count": 101, + "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "\n", - "\n", + "\n", "\n", - " \n", - " \n", + " \n", + " \n", " \n", "\n", - "\n", + "\n", "\n", - " \n", - " \n", + " \n", + " \n", " \n", "\n", - "\n", + "\n", "\n", - " \n", - " \n", + " \n", + " \n", " \n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n" + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n" ] }, "metadata": {}, @@ -632,7 +620,7 @@ }, { "cell_type": "code", - "execution_count": 102, + "execution_count": 14, "metadata": {}, "outputs": [], "source": [ @@ -661,56 +649,53 @@ }, { "cell_type": "code", - "execution_count": 103, + "execution_count": 18, "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "\n", - "\n", + "\n", "\n", - " \n", - " \n", + " \n", + " \n", " \n", "\n", - "\n", + "\n", "\n", - " \n", - " \n", + " \n", + " \n", " \n", "\n", - "\n", + "\n", "\n", - " \n", - " \n", + " \n", + " \n", " \n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n" + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n" ] }, "metadata": {}, @@ -732,56 +717,53 @@ }, { "cell_type": "code", - "execution_count": 104, + "execution_count": 19, "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "\n", - "\n", + "\n", "\n", - " \n", - " \n", + " \n", + " \n", " \n", "\n", - "\n", + "\n", "\n", - " \n", - " \n", + " \n", + " \n", " \n", "\n", - "\n", + "\n", "\n", - " \n", - " \n", + " \n", + " \n", " \n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n" + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n" ] }, "metadata": {}, @@ -802,60 +784,57 @@ }, { "cell_type": "code", - "execution_count": 107, + "execution_count": 20, "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "\n", - "\n", + "\n", "\n", - " \n", - " \n", + " \n", + " \n", " \n", "\n", - "\n", + "\n", "\n", - " \n", - " \n", + " \n", + " \n", " \n", "\n", - "\n", + "\n", "\n", - " \n", - " \n", + " \n", + " \n", " \n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n" + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n" ] }, "metadata": {}, @@ -877,50 +856,47 @@ }, { "cell_type": "code", - "execution_count": 108, + "execution_count": 21, "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "\n", - "\n", + "\n", "\n", - " \n", - " \n", + " \n", + " \n", " \n", "\n", - "\n", + "\n", "\n", - " \n", - " \n", + " \n", + " \n", " \n", "\n", - "\n", + "\n", "\n", - " \n", - " \n", + " \n", + " \n", " \n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n" + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n" ] }, "metadata": {}, @@ -942,52 +918,49 @@ }, { "cell_type": "code", - "execution_count": 109, + "execution_count": 22, "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "\n", - "\n", + "\n", "\n", - " \n", - " \n", + " \n", + " \n", " \n", "\n", - "\n", + "\n", "\n", - " \n", - " \n", + " \n", + " \n", " \n", "\n", - "\n", + "\n", "\n", - " \n", - " \n", + " \n", + " \n", " \n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n" + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n" ] }, "metadata": {}, @@ -1011,52 +984,49 @@ }, { "cell_type": "code", - "execution_count": 112, + "execution_count": 23, "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "\n", - "\n", + "\n", "\n", - " \n", - " \n", + " \n", + " \n", " \n", "\n", - "\n", + "\n", "\n", - " \n", - " \n", + " \n", + " \n", " \n", "\n", - "\n", + "\n", "\n", - " \n", - " \n", + " \n", + " \n", " \n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n" + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n" ] }, "metadata": {}, @@ -1079,56 +1049,53 @@ }, { "cell_type": "code", - "execution_count": 113, + "execution_count": 24, "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "\n", - "\n", + "\n", "\n", - " \n", - " \n", + " \n", + " \n", " \n", "\n", - "\n", + "\n", "\n", - " \n", - " \n", + " \n", + " \n", " \n", "\n", - "\n", + "\n", "\n", - " \n", - " \n", + " \n", + " \n", " \n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n" + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n" ] }, "metadata": {}, @@ -1151,58 +1118,55 @@ }, { "cell_type": "code", - "execution_count": 114, + "execution_count": 25, "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "\n", - "\n", + "\n", "\n", - " \n", - " \n", + " \n", + " \n", " \n", "\n", - "\n", + "\n", "\n", - " \n", - " \n", + " \n", + " \n", " \n", "\n", - "\n", + "\n", "\n", - " \n", - " \n", + " \n", + " \n", " \n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n" + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n" ] }, "metadata": {}, @@ -1224,7 +1188,7 @@ }, { "cell_type": "code", - "execution_count": 115, + "execution_count": 26, "metadata": {}, "outputs": [ { @@ -1287,7 +1251,7 @@ " 4 │ Pressure5.csv Pressure" ] }, - "execution_count": 115, + "execution_count": 26, "metadata": {}, "output_type": "execute_result" } @@ -1313,7 +1277,7 @@ }, { "cell_type": "code", - "execution_count": 116, + "execution_count": 27, "metadata": {}, "outputs": [ { @@ -1322,7 +1286,7 @@ "75.0" ] }, - "execution_count": 116, + "execution_count": 27, "metadata": {}, "output_type": "execute_result" } diff --git a/docs/src/man/dateproc.md b/docs/src/man/dateproc.md index b04d857..24e6237 100644 --- a/docs/src/man/dateproc.md +++ b/docs/src/man/dateproc.md @@ -79,7 +79,7 @@ Another way is to use the symbolic pipeline to describe the transformation and concatenation in just one line of expression. ```@example dateifier -ppl = @pipeline dtr + mtr +ppl = dtr + mtr features = fit_transform!(ppl,X) nothing #hide ``` diff --git a/docs/src/tutorial/monotonic_plotting.md b/docs/src/tutorial/monotonic_plotting.md index 42aed1a..7ff4e83 100644 --- a/docs/src/tutorial/monotonic_plotting.md +++ b/docs/src/tutorial/monotonic_plotting.md @@ -17,11 +17,12 @@ We can use the `Plotter` filter to visualize the generated data. using TSML Random.seed!(123) -pltr = Plotter(Dict(:interactive => false,:pdfoutput => false)) +pltr = Plotter(Dict(:pdfoutput => false)) mdates = DateTime(2017,12,1,1):Dates.Hour(1):DateTime(2017,12,31,10) |> collect mvals = rand(length(mdates)) |> cumsum df = DataFrame(Date=mdates ,Value = mvals) -fit_transform!(pltr,df) +fit_transform!(pltr,df); +nothing #hide ``` Now that we have a monotonic data, let's use the `Monotonicer` to normalize and plot the result: @@ -31,9 +32,10 @@ using TSML mono = Monotonicer(Dict()) -pipeline = @pipeline mono |> pltr +pipeline = mono |> pltr -res=fit_transform!(pipeline,df) +res=fit_transform!(pipeline,df); +nothing #hide ``` ## Real Data Example @@ -61,10 +63,10 @@ monofilecsv = CSVDateValReader(Dict(:filename=>monofile,:dateformat=>"dd/mm/yyyy dailymonofilecsv = CSVDateValReader(Dict(:filename=>dailymonofile,:dateformat=>"dd/mm/yyyy HH:MM")) valgator = DateValgator(Dict(:dateinterval=>Dates.Hour(1))) -valnner = DateValNNer(Dict(:dateinterval=>Dates.Hour(1))) +valnner = DateValLinearImputer(Dict(:dateinterval=>Dates.Hour(1))) stfier = Statifier(Dict(:processmissing=>true)) mono = Monotonicer(Dict()) -pltr = Plotter(Dict(:interactive => false)) +pltr = Plotter(Dict(:pdfoutput => false)) nothing #hide ``` @@ -75,16 +77,18 @@ Let's test by feeding the regular time series type to the pipeline. We expect th - Pipeline with `Monotonicer`: regular time series ```@example mono -pipeline = @pipeline regularfilecsv |> valgator |> valnner |> mono |> pltr +pipeline = regularfilecsv |> valgator |> valnner |> mono |> pltr -fit_transform!(pipeline) +fit_transform!(pipeline); +nothing #hide ``` - Pipeline without `Monotonicer`: regular time series ```@example mono -pipeline = @pipeline regularfilecsv |> valgator |> valnner |> pltr +pipeline = regularfilecsv |> valgator |> valnner |> pltr -fit_transform!(pipeline) +fit_transform!(pipeline); +nothing #hide ``` Notice that the plots are the same with or without the `Monotonicer` instance. @@ -94,16 +98,18 @@ Let's now feed the same pipeline with a monotonic csv data. - Pipeline without `Monotonicer`: monotonic time series ```@example mono -pipeline = @pipeline monofilecsv |> valgator |> valnner |> pltr +pipeline = monofilecsv |> valgator |> valnner |> pltr -fit_transform!(pipeline) +fit_transform!(pipeline); +nothing #hide ``` - Pipeline with `Monotonicer`: monotonic time series ```@example mono -pipeline = @pipeline monofilecsv |> valgator |> valnner |> mono |> pltr +pipeline = monofilecsv |> valgator |> valnner |> mono |> pltr -fit_transform!(pipeline) +fit_transform!(pipeline); +nothing #hide ``` Notice that without the `Monotonicer` instance, the data is monotonic. Applying @@ -118,8 +124,9 @@ We can use the `Outliernicer` filter to remove outliers. Let's apply this filter using TSML: Outliernicer outliernicer = Outliernicer(Dict(:dateinterval=>Dates.Hour(1))); -pipeline = @pipeline monofilecsv |> valgator |> valnner |> mono |> outliernicer |> pltr -fit_transform!(pipeline) +pipeline = monofilecsv |> valgator |> valnner |> mono |> outliernicer |> pltr +fit_transform!(pipeline); +nothing #hide ``` ## Daily Monotonic TS Processing @@ -127,8 +134,9 @@ Lastly, let's feed the daily monotonic data using similar pipeline and examine i - Pipeline without `Monotonicer`: daily monotonic time series ```@example mono -pipeline = @pipeline dailymonofilecsv |> valgator |> valnner |> pltr -fit_transform!(pipeline) +pipeline = dailymonofilecsv |> valgator |> valnner |> pltr +fit_transform!(pipeline); +nothing #hide ``` This plot is characterized by monotonically increasing trend but resets to certain baseline value @@ -138,8 +146,9 @@ the correct normalization. - Pipeline with `Monotonicer`: daily monotonic time series ```@example mono -pipeline = @pipeline dailymonofilecsv |> valgator |> valnner |> mono |> pltr -fit_transform!(pipeline) +pipeline = dailymonofilecsv |> valgator |> valnner |> mono |> pltr +fit_transform!(pipeline); +nothing #hide ``` While the `Monotonicer` filter is able to transform the data into a regular time series, @@ -149,8 +158,9 @@ Let's remove the outliers by applying the `Outliernicer` filter and examine the - Pipeline with `Monotonicer` and `Outliernicer`: daily monotonic time series ```@example mono -pipeline = @pipeline dailymonofilecsv |> valgator |> valnner |> mono |> outliernicer |> pltr -fit_transform!(pipeline) +pipeline = dailymonofilecsv |> valgator |> valnner |> mono |> outliernicer |> pltr +fit_transform!(pipeline); +nothing #hide ``` The `Outliernicer` filter effectively removed the outliers as shown in the plot. diff --git a/docs/src/tutorial/monotonic_plotting_pdf.md b/docs/src/tutorial/monotonic_plotting_pdf.md1 similarity index 80% rename from docs/src/tutorial/monotonic_plotting_pdf.md rename to docs/src/tutorial/monotonic_plotting_pdf.md1 index 64e945f..13d9713 100644 --- a/docs/src/tutorial/monotonic_plotting_pdf.md +++ b/docs/src/tutorial/monotonic_plotting_pdf.md1 @@ -17,11 +17,12 @@ We can use the `Plotter` filter to visualize the generated data. using TSML Random.seed!(123) -pltr = Plotter(Dict(:interactive => false,:pdfoutput => true)) +pltr = Plotter(Dict(:pdfoutput => true)) mdates = DateTime(2017,12,1,1):Dates.Hour(1):DateTime(2017,12,31,10) |> collect mvals = rand(length(mdates)) |> cumsum df = DataFrame(Date=mdates ,Value = mvals) -fit_transform!(pltr,df) +fit_transform!(pltr,df); +nothing #hide ``` Now that we have a monotonic data, let's use the `Monotonicer` to normalize and plot the result: @@ -31,9 +32,10 @@ using TSML mono = Monotonicer(Dict()) -pipeline = @pipeline mono |> pltr +pipeline = mono |> pltr res=fit_transform!(pipeline,df) +nothing #hide ``` ## Real Data Example @@ -61,10 +63,10 @@ monofilecsv = CSVDateValReader(Dict(:filename=>monofile,:dateformat=>"dd/mm/yyyy dailymonofilecsv = CSVDateValReader(Dict(:filename=>dailymonofile,:dateformat=>"dd/mm/yyyy HH:MM")) valgator = DateValgator(Dict(:dateinterval=>Dates.Hour(1))) -valnner = DateValNNer(Dict(:dateinterval=>Dates.Hour(1))) +valnner = DateValLinearImputer(Dict(:dateinterval=>Dates.Hour(1))) stfier = Statifier(Dict(:processmissing=>true)) mono = Monotonicer(Dict()) -pltr = Plotter(Dict(:interactive => false)) +pltr = Plotter(Dict(:pdfoutput => true)) nothing #hide ``` @@ -75,16 +77,18 @@ Let's test by feeding the regular time series type to the pipeline. We expect th - Pipeline with `Monotonicer`: regular time series ```@example mono -pipeline = @pipeline regularfilecsv |> valgator |> valnner |> mono |> pltr +pipeline = regularfilecsv |> valgator |> valnner |> mono |> pltr -fit_transform!(pipeline) +fit_transform!(pipeline); +nothing #hide ``` - Pipeline without `Monotonicer`: regular time series ```@example mono -pipeline = @pipeline regularfilecsv |> valgator |> valnner |> pltr +pipeline = regularfilecsv |> valgator |> valnner |> pltr -fit_transform!(pipeline) +fit_transform!(pipeline); +nothing #hide ``` Notice that the plots are the same with or without the `Monotonicer` instance. @@ -94,16 +98,18 @@ Let's now feed the same pipeline with a monotonic csv data. - Pipeline without `Monotonicer`: monotonic time series ```@example mono -pipeline = @pipeline monofilecsv |> valgator |> valnner |> pltr +pipeline = monofilecsv |> valgator |> valnner |> pltr -fit_transform!(pipeline) +fit_transform!(pipeline); +nothing #hide ``` - Pipeline with `Monotonicer`: monotonic time series ```@example mono -pipeline = @pipeline monofilecsv |> valgator |> valnner |> mono |> pltr +pipeline = monofilecsv |> valgator |> valnner |> mono |> pltr -fit_transform!(pipeline) +fit_transform!(pipeline); +nothing #hide ``` Notice that without the `Monotonicer` instance, the data is monotonic. Applying @@ -118,8 +124,9 @@ We can use the `Outliernicer` filter to remove outliers. Let's apply this filter using TSML: Outliernicer outliernicer = Outliernicer(Dict(:dateinterval=>Dates.Hour(1))); -pipeline = @pipeline monofilecsv |> valgator |> valnner |> mono |> outliernicer |> pltr -fit_transform!(pipeline) +pipeline = monofilecsv |> valgator |> valnner |> mono |> outliernicer |> pltr +fit_transform!(pipeline); +nothing #hide ``` ## Daily Monotonic TS Processing @@ -127,8 +134,9 @@ Lastly, let's feed the daily monotonic data using similar pipeline and examine i - Pipeline without `Monotonicer`: daily monotonic time series ```@example mono -pipeline = @pipeline dailymonofilecsv |> valgator |> valnner |> pltr -fit_transform!(pipeline) +pipeline = dailymonofilecsv |> valgator |> valnner |> pltr +fit_transform!(pipeline); +nothing #hide ``` This plot is characterized by monotonically increasing trend but resets to certain baseline value @@ -138,8 +146,9 @@ the correct normalization. - Pipeline with `Monotonicer`: daily monotonic time series ```@example mono -pipeline = @pipeline dailymonofilecsv |> valgator |> valnner |> mono |> pltr -fit_transform!(pipeline) +pipeline = dailymonofilecsv |> valgator |> valnner |> mono |> pltr +fit_transform!(pipeline); +nothing #hide ``` While the `Monotonicer` filter is able to transform the data into a regular time series, @@ -149,8 +158,9 @@ Let's remove the outliers by applying the `Outliernicer` filter and examine the - Pipeline with `Monotonicer` and `Outliernicer`: daily monotonic time series ```@example mono -pipeline = @pipeline dailymonofilecsv |> valgator |> valnner |> mono |> outliernicer |> pltr -fit_transform!(pipeline) +pipeline = dailymonofilecsv |> valgator |> valnner |> mono |> outliernicer |> pltr +fit_transform!(pipeline); +nothing #hide ``` The `Outliernicer` filter effectively removed the outliers as shown in the plot. diff --git a/docs/src/tutorial/pipeline.md b/docs/src/tutorial/pipeline.md index effeaf2..3e67d7a 100644 --- a/docs/src/tutorial/pipeline.md +++ b/docs/src/tutorial/pipeline.md @@ -37,9 +37,9 @@ Let's use the pipeline transformer to aggregate and impute: using TSML dtvalgator = DateValgator(Dict(:dateinterval => Dates.Hour(1))) -dtvalnner = DateValNNer(Dict(:dateinterval => Dates.Hour(1))) +dtvalnner = DateValLinearImputer(Dict(:dateinterval => Dates.Hour(1))) -mypipeline = @pipeline dtvalgator |> dtvalnner +mypipeline = dtvalgator |> dtvalnner results = fit_transform!(mypipeline,X) nothing #hide @@ -120,7 +120,7 @@ and process it by aggregation and imputation. ```@example pipeline -mypipeline = @pipeline csvreader |> dtvalgator |> dtvalnner +mypipeline = csvreader |> dtvalgator |> dtvalnner results = fit_transform!(mypipeline) nothing #hide diff --git a/docs/src/tutorial/statistics.md b/docs/src/tutorial/statistics.md index c41c505..80f45bb 100644 --- a/docs/src/tutorial/statistics.md +++ b/docs/src/tutorial/statistics.md @@ -52,7 +52,7 @@ dtvalnner = DateValNNer(Dict(:dateinterval => Dates.Hour(1))) dtvalizer = DateValizer(Dict(:dateinterval => Dates.Hour(1))) stfier = Statifier(Dict(:processmissing => true)) -mypipeline = @pipeline dtvalgator |> stfier +mypipeline = dtvalgator |> stfier results = fit_transform!(mypipeline,X) nothing #hide @@ -70,7 +70,7 @@ blocks stat summary by indicating `:processmissing => false` in the instance arg ```@example stat stfier = Statifier(Dict(:processmissing=>false)) -mypipeline = @pipeline dtvalgator |> stfier +mypipeline = dtvalgator |> stfier results = fit_transform!(mypipeline,X) nothing #hide @@ -89,7 +89,7 @@ the stats for missing blocks will all be NaN because stats of empty set is an Na ```@example stat stfier = Statifier(Dict(:processmissing=>true)) -mypipeline = @pipeline dtvalgator |> dtvalnner |> stfier +mypipeline = dtvalgator |> dtvalnner |> stfier results = fit_transform!(mypipeline,X) nothing #hide @@ -108,7 +108,7 @@ missing values based on the stats. ```@example stat stfier = Statifier(Dict(:processmissing=>true)) -mypipeline = @pipeline dtvalgator |> dtvalizer |> stfier +mypipeline = dtvalgator |> dtvalizer |> stfier results = fit_transform!(mypipeline,X) nothing #hide diff --git a/docs/src/tutorial/tsclassifier.md b/docs/src/tutorial/tsclassifier.md index 2f659ac..d452987 100644 --- a/docs/src/tutorial/tsclassifier.md +++ b/docs/src/tutorial/tsclassifier.md @@ -87,7 +87,7 @@ mdirname = tscl.model[:modeldirectory] modelfname=tscl.model[:juliarfmodelname] trstatfname = joinpath(mdirname,modelfname*".csv") -res = CSV.read(trstatfname) |> DataFrame +res = CSV.read(trstatfname,DataFrame) nothing #hide ``` diff --git a/src/plotter.jl b/src/plotter.jl index d8569e2..c170014 100644 --- a/src/plotter.jl +++ b/src/plotter.jl @@ -2,9 +2,10 @@ module Plotters #using Interact using Random -using RecipesBase using DataFrames using Dates +using Plots +using GR using ..AbsTypes using ..Utils @@ -15,18 +16,18 @@ export fit, fit!, transform, transform! export Plotter ## setup plotting for publication -#function setupplot(pdfoutput::Bool) -# Plots.gr(); -# fntsm = Plots.font("sans-serif", 8); -# fntlg = Plots.font("sans-serif", 8); -# Plots.default(titlefont=fntlg, guidefont=fntlg, tickfont=fntsm, legendfont=fntsm); -# if pdfoutput == true -# Plots.default(size=(390,200)); #Plot canvas size -# else -# Plots.default(size=(500,300)); #Plot canvas size -# end -# return nothing -#end +function setupplot(pdfoutput::Bool) + Plots.gr(); + fntsm = Plots.font("sans-serif", 8); + fntlg = Plots.font("sans-serif", 8); + Plots.default(titlefont=fntlg, guidefont=fntlg, tickfont=fntsm, legendfont=fntsm); + if pdfoutput == true + Plots.default(size=(390,200)); #Plot canvas size + else + Plots.default(size=(500,300)); #Plot canvas size + end + return nothing +end struct DateVal{D<:DateTime,V<:Union{Missing,<:Number}} dtime::Vector{D} @@ -47,7 +48,7 @@ end Plotter( Dict( :interactive => false, - :pdfoutput => false + :pdfoutput => true ) ) @@ -73,11 +74,11 @@ mutable struct Plotter <: Transformer default_args = Dict( :name => "pltr", :interactive => false, - :pdfoutput => false + :pdfoutput => true ) - #setupplot(margs[:pdfoutput]) cargs=nested_dict_merge(default_args,args) cargs[:name] = cargs[:name]*"_"*randstring(3) + setupplot(cargs[:pdfoutput]) new(cargs[:name],cargs) end end @@ -112,22 +113,29 @@ function transform!(pltr::Plotter, features::DataFrame)::DataFrame df[:,:Value] .= features.Value ndxmissing = findall(x->ismissing(x),df.Value) df.Value[ndxmissing] .= NaN - #setupplot(pltr.model[:pdfoutput]) + setupplot(pltr.model[:pdfoutput]) #if pltr.model[:interactive] == true && pltr.model[:pdfoutput] == false # # disable interactive plot due to Knockout.jl badly maintained (Interact.jl deps) # #interactiveplot(df) # pl=Plots.plot(df.Date,df.Value,xlabel="Date",ylabel="Value",legend=false,show=false); - # return pl + # #return pl #else # pl=Plots.plot(df.Date,df.Value,xlabel="Date",ylabel="Value",legend=false,show=false); - # return pl + # #return pl #end - sz = (500,300) # default if pltr.model[:pdfoutput] == true - sz = (390,200) + plt=Plots.plot(df.Date,df.Value,xlabel="Date",ylabel="Value",legend=false); + display(plt) end - dtval = DateVal(df.Date,df.Value) - display(RecipesBase.plot(dtval,sz)) + # for Plot recipes block + # -------- + #sz = (500,300) # default + #if pltr.model[:pdfoutput] == true + # sz = (390,200) + #end + #dtval = DateVal(df.Date,df.Value) + #RecipesBase.plot(dtval,sz) + # -------- return features end diff --git a/test/test_plotter.jl b/test/test_plotter.jl index 0b11ffb..40a5e69 100644 --- a/test/test_plotter.jl +++ b/test/test_plotter.jl @@ -28,7 +28,7 @@ function test_artificialdataplotter() soutndx = sample(1:length(mdates),length(soutliers)) mvals[soutndx] = soutliers df = DataFrame(Date=mdates,Value=mvals) - pltr = TSML.Plotter(Dict(:interactive => false)) + pltr = TSML.Plotter(Dict(:pdfoutput=>false)) fit!(pltr,df) myplot=transform!(pltr,df); @test nrow(myplot) == nrow(df); @@ -51,7 +51,7 @@ function test_realdataplotter() Random.seed!(123) fname = joinpath(dirname(pathof(TSML)),"../data/testdata.csv") csvfilter = CSVDateValReader(Dict(:filename=>fname,:dateformat=>"dd/mm/yyyy HH:MM")) - pltr = TSML.Plotter(Dict(:interactive => false)) + pltr = TSML.Plotter(Dict(:pdfoutput=>false)) mpipeline1 = csvfilter |> pltr myplot = fit_transform!(mpipeline1); @test nrow(myplot) > 0; From b16a87db087e61220d4b2fc71d766fe326c183de Mon Sep 17 00:00:00 2001 From: "Paulito Palmes, PhD" Date: Fri, 7 Apr 2023 16:01:28 +0100 Subject: [PATCH 6/6] bump version Signed-off-by: Paulito Palmes, PhD --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 75b5216..c4681e6 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "TSML" uuid = "198dc43e-9e51-5cd7-9d40-d9794d335912" authors = ["Paulito Palmes "] -version = "2.7.4" +version = "2.7.5" [deps] AMLPipelineBase = "e3c3008a-8869-4d53-9f34-c96f99c8a2b6"