-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add fold! method #22
add fold! method #22
Conversation
Looks good to me. The old travis setup no longer works, I'll just update it and then merge this. Thank you for the contribution! |
Cool. I think, I will also work on porting some designs from pyDOE2 to julia soon, I started with BB already. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Target only
PlackettBurman
designs, as done before, because the current implementation does not generalize forFactorialDesigns
, for example (see discussion in comments below) -
(up for discussion) Rename the method tomirror!
, seems like a better verb thanfold!
for this purpose
Current method on a FactorialDesign
:
julia> b = FullFactorial(([1, 2, 4], [:a, :b], [1.0, -1.0]))
FullFactorial
Dimension: (12, 3)
Factors: (factor1 = [1, 2, 4], factor2 = [:a, :b], factor3 = [1.0, -1.0])
Formula: 0 ~ factor1 + factor2 + factor3
Design Matrix:
12×3 DataFrame
│ Row │ factor1 │ factor2 │ factor3 │
│ │ Any │ Any │ Any │
├─────┼─────────┼─────────┼─────────┤
│ 1 │ 1 │ a │ 1.0 │
│ 2 │ 2 │ a │ 1.0 │
│ 3 │ 4 │ a │ 1.0 │
│ 4 │ 1 │ b │ 1.0 │
│ 5 │ 2 │ b │ 1.0 │
│ 6 │ 4 │ b │ 1.0 │
│ 7 │ 1 │ a │ -1.0 │
│ 8 │ 2 │ a │ -1.0 │
│ 9 │ 4 │ a │ -1.0 │
│ 10 │ 1 │ b │ -1.0 │
│ 11 │ 2 │ b │ -1.0 │
│ 12 │ 4 │ b │ -1.0 │
julia> fold!(b)
24×3 DataFrame
│ Row │ factor1 │ factor2 │ factor3 │
│ │ Any │ Any │ Any │
├─────┼─────────┼─────────┼─────────┤
│ 1 │ 1 │ a │ 1.0 │
│ 2 │ 2 │ a │ 1.0 │
│ 3 │ 4 │ a │ 1.0 │
│ 4 │ 1 │ b │ 1.0 │
│ 5 │ 2 │ b │ 1.0 │
│ 6 │ 4 │ b │ 1.0 │
│ 7 │ 1 │ a │ -1.0 │
│ 8 │ 2 │ a │ -1.0 │
│ 9 │ 4 │ a │ -1.0 │
│ 10 │ 1 │ b │ -1.0 │
│ 11 │ 2 │ b │ -1.0 │
│ 12 │ 4 │ b │ -1.0 │
│ 13 │ -1 │ a │ -1 │
│ 14 │ 2 │ a │ -1 │
│ 15 │ 4 │ a │ -1 │
│ 16 │ -1 │ b │ -1 │
│ 17 │ 2 │ b │ -1 │
│ 18 │ 4 │ b │ -1 │
│ 19 │ -1 │ a │ 1 │
│ 20 │ 2 │ a │ 1 │
│ 21 │ 4 │ a │ 1 │
│ 22 │ -1 │ b │ 1 │
│ 23 │ 2 │ b │ 1 │
│ 24 │ 4 │ b │ 1 │
src/design.jl
Outdated
|
||
``` | ||
""" | ||
function fold!(design::AbstractDesign) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the best solution would be to implement a mirror!
method for PlackettBurman
designs like you did before, and then adding specific methods of mirror!
for different designs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The thing is, I was working already on 2-level fractional factorial designs (https://github.com/joergbuchwald/ExperimentalDesign.jl/tree/fractfact) and just saw that the same function could be used for fractional factorial design as well.
My suggestion would be to construct an abstract type that contains PlackettBurman as well as fractional factorial designs. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's broader, but it would still be applicable only to 2-level designs with the current function.
I would prefer using multiple dispatch here to target different design types with different methods.
A "2-level abstract" type would also fix this, but I don't think it would be a good idea, because we can have fractional factorial designs with more than 2 levels, and they would be of different types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also have a "fold.jl" file, with all implementations for different types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is not wrong to call both screening designs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good idea, I think. AbstractScreeningDesign
would require extra subtypes such as AbstractMultilevelScreening
though, otherwise we would get the same problem with this implementation being used on 3-level designs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From an implementation point of view, how do you suggest we treat 2- and 3-+, and mixed-level designs differently?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course, theoretically, there can be a fractional factorial design with more than two levels, however, they are not very common.
(E.g. wikipedia states "In practice, one rarely encounters l > 2 levels in fractional factorial designs, since response surface methodology is a much more experimentally efficient way to determine the relationship between the experimental response and factors at multiple levels. In addition, the methodology to generate such designs for more than two levels is much more cumbersome.")
So thinking about implementation, I'm not sure whether it is worth to think about multilevel screening designs right now.
So if you think, it makes sense to consider them in the future, it would be enough from my perspective to create some abstract types for now.
Looking at other codes, it is quite common to distinguish between two-level and multilevel for factorial designs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good plan. We can add a type for multi-level screening designs later if we need it.
939216b
to
5310a67
Compare
5310a67
to
54324c8
Compare
@joergbuchwald I've updated tests and docs to use GitHub actions. |
54324c8
to
0a060b4
Compare
I don't know if you can see the build report, but it's just a DataFrames syntax error: ERROR: ArgumentError: syntax df[column] is not supported use df[!, column] instead
│ Stacktrace:
│ [1] getindex(#unused#::DataFrame, #unused#::String)
│ @ DataFrames ~/.julia/packages/DataFrames/vQokV/src/abstractdataframe/abstractdataframe.jl:2161
│ [2] fold!(design::PlackettBurman)
│ @ ExperimentalDesign ~/work/ExperimentalDesign.jl/ExperimentalDesign.jl/src/fold.jl:29
│ [3] top-level scope
│ @ none:1 |
0a060b4
to
19738c3
Compare
I'll merge this, it's just a difference due to the test seed. I'll regenerate the golden output with the right seed later. |
Add a folding method for the PlackettBurman design.