Skip to content

Latest commit

 

History

History
35 lines (26 loc) · 1016 Bytes

File metadata and controls

35 lines (26 loc) · 1016 Bytes

Custom observed types

The implementation of new observed types is very similar to loss functions, so we will just go over it briefly (for additional information, revisit Custom loss functions).

First, we need to define a new struct that is a subtype of SemObserved:

struct MyObserved <: SemObserved
    ...
end

Additionally, we can write an outer constructor that will typically depend on the keyword argument data = ...:

function MyObserved(;data, kwargs...)
    ...
    return MyObserved(...)
end

To compute some fit indices, you need to provide methods for

# Number of samples (observations) in the dataset
nsamples(observed::MyObserved) = ...
# Number of observed variables
nobserved_vars(observed::MyObserved) = ...

As always, you can add additional methods for properties that implied types and loss function want to access, for example (from the SemObservedData implementation):

obs_cov(observed::SemObservedData) = observed.obs_cov