Skip to content

Commit

Permalink
Merge branch 'gio/refractoring' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
giopaglia committed Nov 8, 2024
2 parents e8db8e2 + d95bb76 commit 58f6bc5
Showing 1 changed file with 28 additions and 8 deletions.
36 changes: 28 additions & 8 deletions src/types/model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,20 @@ Symbolic models can wrap other `AbstractModel`s, and use them to compute the out
As such, an `AbstractModel` can actually be the result of a composition of many models,
and enclose a *tree* of `AbstractModel`s (with `LeafModel`s at the leaves).
# TODO - bring missing dispatches here (do the same for other model types)
# Interface
- `apply(m::AbstractModel, i::AbstractInterpretation; kwargs...)`
- `iscomplete(m::AbstractModel)::Bool`
- `iscomplete(m::AbstractModel)`
- `outcometype(m::AbstractModel)`
- `outputtype(m::AbstractModel)`
- `immediatesubmodels(m::AbstractModel)`
- `nimmediatesubmodels(m::AbstractModel)`
- `leafmodels(m::AbstractModel)`
- `nleafmodels(m::AbstractModel)`
- `listimmediaterules(m::AbstractModel)`
- `info(m::AbstractModel, [key, [defaultval]])`
- `info!(m::AbstractModel, key, value)`
- `hasinfo(m::AbstractModel, key)`
Expand All @@ -36,6 +45,24 @@ and enclose a *tree* of `AbstractModel`s (with `LeafModel`s at the leaves).
- `apply(m::AbstractModel, i::AbstractInterpretationSet; kwargs...)`
- See AbstractTrees...
# Utility functions
- `apply(m::AbstractModel, d::AbstractInterpretationSet, i_instance::Integer; kwargs...)
- `submodels(m::AbstractModel)`(fallback of the general
`AbstractTrees.children(m::AbstractModel)`)
- `nsubmodels(m::AbstractModel)`
- `subtreeheight(m::AbstractModel)`
- `listrules(
m::AbstractModel;
use_shortforms::Bool=true,
use_leftmostlinearform::Union{Nothing,Bool}=nothing,
normalize::Bool=false,
force_syntaxtree::Bool=false,
)`
- `joinrules(m::AbstractModel, silent=false; kwargs...)`
# Examples
TODO
Expand Down Expand Up @@ -99,13 +126,6 @@ end
kwargs...
)::AbstractVector{<:outputtype(m)}
apply(
m::AbstractModel,
d::AbstractInterpretationSet,
i_instance::Integer;
kwargs...
)::outputtype(m)
Return the output prediction of a model `m` on a logical interpretation `i`,
on the `i_instance` of a dataset `d`, or on all instances of a dataset `d`.
Note that predictions can be `nothing` if the model is *incomplete* (e.g., if the model is a `Rule`).
Expand Down

0 comments on commit 58f6bc5

Please sign in to comment.