formulaic_contrasts.FactorMetadata#
- class formulaic_contrasts.FactorMetadata(name, reduced_rank, custom_encoder, categories, kind, drop_field=None, column_names=None, colname_format=None)#
Dataclass to hold metadata related to a factor from a formula.
Attributes table#
The base category for this categorical factor. |
|
A formattable string that can be used to generate the column name in the design matrix, e.g. |
|
The column names for this factor included in the design matrix. |
|
The category that is dropped. |
|
The unambiguous factor name as specified in the formula. |
|
Whether a column will be dropped because it is redundant |
|
Whether or not a custom encoder (e.g. |
|
The unique categories in this factor (after applying |
|
Type of the factor |
Methods table#
Attributes#
- FactorMetadata.base#
The base category for this categorical factor.
This is derived from
drop_field(for default encoding) or by comparing the column names in the design matrix with all categories (for custom encoding, e.g.C(...)).
-
FactorMetadata.colname_format:
str|None= None# A formattable string that can be used to generate the column name in the design matrix, e.g.
{name}[T.{field}]
-
FactorMetadata.column_names:
Sequence[str] |None= None# The column names for this factor included in the design matrix.
This may be the same as
categoriesif the default encoder is used, or categories without the base level if a custom encoder (e.g.C(...)) is used.
-
FactorMetadata.drop_field:
str|None= None# The category that is dropped.
- Note that
this may also be populated if
reduced_rank = Falsethis is only populated when no encoder was used (e.g.
~ donorbut NOT~ C(donor).
-
FactorMetadata.name:
str# The unambiguous factor name as specified in the formula. E.g.
donor, orC(donor, contr.treatment(base="A"))
-
FactorMetadata.categories:
Sequence[str]# The unique categories in this factor (after applying
drop_rows)
-
FactorMetadata.kind:
Kind# Type of the factor