Giter Site home page Giter Site logo

Comments (9)

ppalmes avatar ppalmes commented on June 29, 2024

thanks for the feedback. which do you think is practical? absolute range or still a factor of IQR?

from tsml.jl.

ppalmes avatar ppalmes commented on June 29, 2024

is this ok? let scale=1.5, then range is (median - scale x iqr, median + scale x iqr)

scale will be passed as an argument.

from tsml.jl.

ppalmes avatar ppalmes commented on June 29, 2024

as a temporary solution, you can overwrite the transform! function.

using TSML
using Dates
using DataFrames
using Statistics
using StatsBase: iqr, quantile, sample

import TSML.transform! ## to override transform!

function transform!(st::Outliernicer, features::DataFrame)
             features != DataFrame() || return DataFrame()
             ncol(features) == 2 || error("dataframe must have 2 columns: Date, Val")
             sum(names(features) .== ("Date","Value"))  == 2 || error("wrong column names")
             mfeatures=deepcopy(features)
             rvals = mfeatures.Value
             # compute the outlier range
             # setup to store both missing and numbers
             mvals = Array{Union{Missing,eltype(rvals)},1}(missing,length(rvals))
             mvals .= rvals
             crvals = skipmissing(rvals) # stat of non-missing
             miqr = iqr(crvals)
             m  = quantile(crvals,0.5) ##median
             scale = 1.5 ## scale factor of iqr
             lower=m-scale*miqr; upper=m+scale*miqr
             missindx = findall(x -> !ismissing(x) && (x > upper || x < lower),rvals)
             mvals[missindx] .= missing
             mfeatures.Value = mvals
             # use ValNNer to replace missings
             valnner = DateValNNer(st.args)
             fit!(valnner,mfeatures)
             resdf = transform!(valnner,mfeatures)
             resdf.Value = collect(skipmissing(resdf.Value))
             resdf
end

from tsml.jl.

rustyconover avatar rustyconover commented on June 29, 2024

Personally I like using IQR but I'm far from an expert.

I really like this package because I've been using it to replace missing values in some time series I've been working with. It makes it so simple. @ppalmes Thank you for creating it!

The Readme.md mentions:

TS ML wrapper with more than 100+ libraries from caret, scikitlearn, and julia

Are these examples of using that wrapper?

Rusty

from tsml.jl.

ppalmes avatar ppalmes commented on June 29, 2024

Thanks for the nice feedback!

The latest master branch now contains the option to pass the scale factor:

    Outliernicer(Dict(
       :dateinterval => Dates.Hour(1),
       :nnsize => 1,
       :missdirection => :symmetric,
       :scale => 1.25
    ))

I refactor TSML and placed the ML part to AutoMLPipeline (https://github.com/IBM/AutoMLPipeline.jl). The moment the time-series is matrified using Matrifier and Dateifier (https://ibm.github.io/TSML.jl/dev/man/valueproc/), you can use the AutoMLPipeline to do the machine learning using ScikitLearn. Caret is problematic to be added because I want to support Windows/Linus/Mac. I highly recommend you to try AutoMLPipeline.

from tsml.jl.

ppalmes avatar ppalmes commented on June 29, 2024

it will use the scale factor: (median - scale * IQR, median + scale * IQR)

after all test passes, I will register a new version with these changes.

from tsml.jl.

ppalmes avatar ppalmes commented on June 29, 2024

PR #166

from tsml.jl.

ppalmes avatar ppalmes commented on June 29, 2024

I just registered a new version. you can update your TSML copy once it's accepted in General registry.

from tsml.jl.

rustyconover avatar rustyconover commented on June 29, 2024

@ppalmes thank you! :)

from tsml.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.