Dataset
Type definition
InferenceObjects.Dataset — TypeDataset{L} <: DimensionalData.AbstractDimStack{L}Container of dimensional arrays sharing some dimensions.
This type is an DimensionalData.AbstractDimStack that implements the same interface as DimensionalData.DimStack and has identical usage.
When a Dataset is passed to Python, it is converted to an xarray.Dataset without copying the data. That is, the Python object shares the same memory as the Julia object. However, if an xarray.Dataset is passed to Julia, its data must be copied.
Constructors
Dataset(data::DimensionalData.AbstractDimArray...)
Dataset(data::Tuple{Vararg{<:DimensionalData.AbstractDimArray}})
Dataset(data::NamedTuple{Keys,Vararg{<:DimensionalData.AbstractDimArray}})
Dataset(
data::NamedTuple,
dims::Tuple{Vararg{DimensionalData.Dimension}};
metadata=DimensionalData.NoMetadata(),
)In most cases, use convert_to_dataset to create a Dataset instead of directly using a constructor.
General conversion
InferenceObjects.convert_to_dataset — Functionconvert_to_dataset(obj; group = :posterior, kwargs...) -> DatasetConvert a supported object to a Dataset.
In most cases, this function calls convert_to_inference_data and returns the corresponding group.
InferenceObjects.namedtuple_to_dataset — Functionnamedtuple_to_dataset(data; kwargs...) -> DatasetConvert NamedTuple mapping variable names to arrays to a Dataset.
Any non-array values will be converted to a 0-dimensional array.
Keywords
attrs::AbstractDict{<:AbstractString}: a collection of metadata to attach to the dataset, in addition to defaults. Values should be JSON serializable.library::Union{String,Module}: library used for performing inference. Will be attached to theattrsmetadata.dims: a collection mapping variable names to collections of objects containing dimension names. Acceptable such objects are:Symbol: dimension nameType{<:DimensionsionalData.Dimension}: dimension typeDimensionsionalData.Dimension: dimension, potentially with indicesNothing: no dimension name provided, dimension name is automatically generated
coords: a collection indexable by dimension name specifying the indices of the given dimension. If indices for a dimension indimsare provided, they are used even if the dimension contains its own indices. If a dimension is missing, its indices are automatically generated.
DimensionalData
As a DimensionalData.AbstractDimStack, Dataset also implements the AbstractDimStack API and can be used like a DimStack. See DimensionalData's documentation for example usage.
Tables inteface
Dataset implements the Tables interface. This allows Datasets to be used as sources for any function that can accept a table. For example, it's straightforward to:
- write to CSV with CSV.jl
- flatten to a DataFrame with DataFrames.jl
- plot with StatsPlots.jl
- plot with AlgebraOfGraphics.jl