(create-design-matrix ds targets-specs features-specs)Converts the given dataset into a full numeric dataset.
ds Is te tech.v3 dataset to transform
target-specs are the specifications how to transform the target variables
features-specs are the specifications how to transform the features
The 'spec' can express several types of dataset transformations in a compact way:
Function calls need to be given as lists (quoted by '), and can refer to column names. They get evaluated from top->bottom, and can refer to each other.
The followig aliases can be used as part of the spec. (Other functions need to be full qualified).
clojure.core can be used without full qailifying te symbols ds (tech.v3.dataset) tc (tablecloth.api) tcc (tablecloth.column.api)
Example:
(dm/create-design-matrix
ds
[:y]
[
[:sum '(+ :a :b :c)]
])
This will:
See design_matrix_test.clj for more examples.
Converts the given dataset into a full numeric dataset.
`ds` Is te tech.v3 dataset to transform
`target-specs` are the specifications how to transform the target variables
`features-specs` are the specifications how to transform the features
The 'spec' can express several types of dataset transformations in a compact way:
- add new derived columns
- remove columns
- rename columns
- convert columns to categorical
- set inference target
Function calls need to be given as lists (quoted by '), and can refer to column names.
They get evaluated from top->bottom, and can refer to each other.
The followig aliases can be used as part of the spec.
(Other functions need to be full qualified).
clojure.core can be used without full qailifying te symbols
ds (tech.v3.dataset)
tc (tablecloth.api)
tcc (tablecloth.column.api)
Example:
(dm/create-design-matrix
ds
[:y]
[
[:sum '(+ :a :b :c)]
])
This will:
- set inference target to y:
- create a new derived variables :sum
- remove all columns except :y and :sum
See `design_matrix_test.clj` for more examples.
(map-column->columns ds src-col)Expands a column containing maps into multiple separate columns.
ds - Dataset
src-col - Column name containing map values
Returns a new dataset where the map column is replaced with individual columns
for each map key. New column names are formed by combining the source column
name with each map key using dashes (e.g., :src-key1, :src-key2).
Example: Column :stats with {:mean 5 :std 2} becomes :stats-mean and
:stats-std columns.
Used for feature expansion in design matrix creation.
Expands a column containing maps into multiple separate columns.
`ds` - Dataset
`src-col` - Column name containing map values
Returns a new dataset where the map column is replaced with individual columns
for each map key. New column names are formed by combining the source column
name with each map key using dashes (e.g., `:src-key1`, `:src-key2`).
Example: Column `:stats` with `{:mean 5 :std 2}` becomes `:stats-mean` and
`:stats-std` columns.
Used for feature expansion in design matrix creation.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |