lace.Codebook

class lace.Codebook(codebook: Codebook)

Stores metadata about the lace Engine.

The codebook stores information about the CRP priors on columns-to-views (state_crp_alpha) and rows-to-categories (view_crp_alpha), the row names, and how to model each column including the type, the prior, and the hyper prior.

codebook

A reference to the underlying rust data structure

Type:

core.Codebook

__init__(codebook: Codebook)

Properties

column_metadata

Get/set a column metadata.

column_names

Contains the name of each column.

row_names

Contains the name of each row.

shape

A (n_rows, n_cols) tuple.

codebook

Methods

append_column_metadata(col_metadata)

Append new columns to the codebook.

empty(name)

Create an empty codebook with a given name.

from_df(name, df[, cat_cutoff, no_hypers])

Infer a codebook from a DataFrame.

json()

Return the codebook as a JSON string.

rename(name)

Return a copy of the codebook with a new name.

set_row_names(row_names)

Return a copy of the codebook with new row_names.

set_state_alpha_prior([shape, rate])

Return a copy of the codebook with a new state CRP alpha prior.

set_view_alpha_prior([shape, rate])

Return a copy of the codebook with a new view CRP alpha prior.

value_map(col)

Get the value map for a Categorical column if it exists.