-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
190 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
[deps] | ||
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" | ||
Folds = "41a02a25-b8f0-4f67-bc48-60067656b558" | ||
OnlineStats = "a15396b6-48d5-5d58-9928-6d29437db91e" | ||
StructArrays = "09ab397b-f2b6-538f-b94a-2f83cf4a842a" | ||
Transducers = "28d57a85-8fef-5791-bfe6-a80928e7c999" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
function Folds.reduce(stat::OnlineStatsBase.OnlineStat, itr, ex::Executor; init = FoldsInit) | ||
ex isa SequentialEx || validate_reduce_ostat(stat) | ||
return Folds.reduce(reducingfunction(stat), itr, ex; init = init) | ||
end | ||
|
||
const OSNonZeroNObsError = ArgumentError( | ||
"An `OnlineStat` with one or more observations cannot be used with " * | ||
"non-`SequentialEx` executor.", | ||
) | ||
|
||
function validate_reduce_ostat(stat) | ||
if OnlineStatsBase.nobs(stat) != 0 | ||
throw(OSNonZeroNObsError) | ||
end | ||
return stat | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,31 @@ | ||
module TestWithSequential | ||
|
||
using Transducers: DistributedEx, SequentialEx, ThreadedEx | ||
using Folds.Testing: test_with_sequential | ||
using Folds.Testing: test_with_sequential, eval_call_data | ||
|
||
test_with_sequential([ | ||
executors = [ | ||
SequentialEx(), | ||
ThreadedEx(), | ||
ThreadedEx(basesize = 1), | ||
DistributedEx(), | ||
DistributedEx(basesize = 1), | ||
]) | ||
] | ||
|
||
test_with_sequential(executors) | ||
|
||
|
||
raw_extra_testdata = """ | ||
reduce(Mean(), 1:10) | ||
reduce(Mean(), (x for x in 1:10 if isodd(x))) | ||
reduce(KHist(25), 1.0:10.0) | ||
""" | ||
|
||
preamble = quote | ||
using OnlineStats | ||
end | ||
|
||
extra_testdata = eval_call_data(raw_extra_testdata, preamble) | ||
|
||
test_with_sequential(extra_testdata, executors) | ||
|
||
end |