1.2.1. patsy.ContrastMatrix¶
-
class
patsy.
ContrastMatrix
(matrix, column_suffixes)[source]¶ A simple container for a matrix used for coding categorical factors.
Attributes:
-
matrix
¶ A 2d ndarray, where each column corresponds to one column of the resulting design matrix, and each row contains the entries for a single categorical variable level. Usually n-by-n for a full rank coding or n-by-(n-1) for a reduced rank coding, though other options are possible.
-
column_suffixes
¶ A list of strings to be appended to the factor name, to produce the final column names. E.g. for treatment coding the entries will look like
"[T.level1]"
.
-