Comments (9)
I've become fond of wrapper types since you can compose them. At some point I should change FTSeries
to be FilterTransform
wrapper type.
How about something like this that tracks the CountMap
of exceptions you run into?
struct TryCatchStat{T, O<:OnlineStat{T}} <: OnlineStat{T}
stat::O
exceptions::CountMap{Exception}
end
TryCatchStat(stat::OnlineStat) = TryCatchStat(stat, CountMap(Exception))
nobs(o::TryCatchStat) = nobs(o.stat)
value(o::TryCatchStat) = value(o.stat)
function _fit!(o::TryCatchStat, y)
try
_fit!(o.stat, y)
catch ex
_fit!(o.exceptions, ex)
end
end
from onlinestatsbase.jl.
Doing a little bit of work on this and I'm liking how it's turning out:
julia> o = TryCatch(FilterTransform(Mean(), String; transform = x -> parse(Int, x)))
TryCatch(FilterTransform(Mean)): n=0 | value=0.0
julia> fit!(o, "1")
TryCatch(FilterTransform(Mean)): n=1 | value=1.0
julia> fit!(o, "1.5")
TryCatch(FilterTransform(Mean)): n=1 | errors=1 | value=1.0
julia> OnlineStatsBase.errors(o)
OrderedCollections.OrderedDict{DataType, Int64} with 1 entry:
ArgumentError => 1
from onlinestatsbase.jl.
Awesome, thanks for your input! I've incorporated most of your suggestions.
The only thing I left out was using Groupby
to organize error messages by Exception
for TryCatch
. I tried it out and the code started looking a little too gnarly for the added benefit.
from onlinestatsbase.jl.
oh, I think that's really smart!
With that proposal one would't just be keeping track of failed transformations like in my proposal, but also of any other possible exceptions. Following the FTSeries
example, these extra exceptions could be for instance errors in the filter function call, cases where the type of the transformed input does't correspond to the expected type, ....
And I agree, moving from FTSeries
to a FilterTransform
wrapper makes a lot of sense.
from onlinestatsbase.jl.
I had a quick look at the new commit and it looks awesome 🎉
Few comments came to mind, I'll leave few suggestions (even though the code is already merged) if I find some time later today.
from onlinestatsbase.jl.
Please do. I haven't tagged a new release yet.
from onlinestatsbase.jl.
Left few suggestions. Things are already looking great, so feel free to ignore them
from onlinestatsbase.jl.
awesome! Makes sense to leave out the GroupBy
suggestion... i liked the idea but it was a bit convoluted.
Did you push the changes?
from onlinestatsbase.jl.
Oops, they're pushed now
from onlinestatsbase.jl.
Related Issues (20)
- Enable precompilation HOT 4
- Move Series here from OnlineStats HOT 1
- error regarding NamedTuples for Julia 0.7 HOT 2
- Releases HOT 11
- GroupBy Group HOT 3
- Warning from Julia 1.1 on "eachcol" HOT 4
- OnlineStatsBase exports different `value` function than OnlineStats HOT 3
- Export Weight HOT 1
- Inefficient Mean()? HOT 1
- Extrema() only available for Date time types HOT 1
- Generalize `Extrema` to keep `k` most extreme values (feature request) HOT 4
- TagBot trigger issue HOT 11
- Fails to precompile on Julia 1.0 HOT 2
- Dispatch issue in 1.9. HOT 4
- Bug (or maybe 2) in v1.5.0 HOT 5
- Possible type instability with `Mean`, `Moments`, `Sum`, `Variance` HOT 3
- Improve doc ? value of type different from Float64 and from type of single observation value HOT 2
- Request for a new version to be tagged HOT 2
- Prod - Track the overall prod. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from onlinestatsbase.jl.