Liking cljdoc? Tell your friends :D

svm-techml-smile.preprocessing

Cross-sectional model spec + data preparation pipeline (jasmine-style SVR).

A cross-sectional model spec is a map with: :type — :svr (SVR regressor) or :ols (OLS — host project must supply OLS training) :dataset — tech.ml.dataset holding all observations :id-name — column keyword used as row identifier (excluded from feature matrix) :y — {:column <kw> :predict-fn <fn>} — target column + inverse transform :removals — seq of column keywords to drop before building the feature matrix :transformations — seq of feature specs (build-column DSL) applied first :one-hot — {:columns [<kw> ...] :removals [<kw> ...]} — categorical encoding config :std-scale — {:columns [<kw> ...] :scaler nil} — columns to standardise; scaler is filled in by prepare-svr-data

After prepare-svr-data, the map gains: :std-scale — with :scaler filled in (use transform-scale for new data) :features-cols — ordered column names of the feature matrix :sigma — estimated RBF bandwidth :features-array — double[][] ready for Smile SVR fit / predict :y-array — double[] target values (raw, before :predict-fn)

Cross-sectional model spec + data preparation pipeline (jasmine-style SVR).

A cross-sectional model spec is a map with:
  :type            — :svr (SVR regressor) or :ols (OLS — host project must supply OLS training)
  :dataset         — tech.ml.dataset holding all observations
  :id-name         — column keyword used as row identifier (excluded from feature matrix)
  :y               — {:column <kw> :predict-fn <fn>} — target column + inverse transform
  :removals        — seq of column keywords to drop before building the feature matrix
  :transformations — seq of feature specs (build-column DSL) applied first
  :one-hot         — {:columns [<kw> ...] :removals [<kw> ...]} — categorical encoding config
  :std-scale       — {:columns [<kw> ...] :scaler nil} — columns to standardise; scaler is
                      filled in by prepare-svr-data

After prepare-svr-data, the map gains:
  :std-scale       — with :scaler filled in (use transform-scale for new data)
  :features-cols   — ordered column names of the feature matrix
  :sigma           — estimated RBF bandwidth
  :features-array  — double[][] ready for Smile SVR fit / predict
  :y-array         — double[]  target values (raw, before :predict-fn)
raw docstring

one-hot-reducerclj

(one-hot-reducer dataset cols removals)

One-hot encode each column in cols, then drop any columns listed in removals. removals is only needed for OLS models (to avoid perfect collinearity); SVR models should pass [] for removals.

One-hot encode each column in cols, then drop any columns listed in removals.
removals is only needed for OLS models (to avoid perfect collinearity);
SVR models should pass [] for removals.
sourceraw docstring

prepare-svr-dataclj

(prepare-svr-data spec)

Apply the model spec pipeline and return the spec augmented with Smile-ready arrays.

Steps:

  1. apply :transformations (build-many-columns DSL)
  2. fit std-scaler on :std-scale columns
  3. drop :removals columns
  4. one-hot encode :one-hot columns (dropping :one-hot :removals)
  5. apply the std-scaler
  6. split into feature matrix (everything except :id-name and :y column)
  7. compute sigma, features-array (double[][]), y-array (double[])

The returned spec has :std-scale :scaler filled in — pass it to svm-techml-smile.kernel/transform-scale to normalise new observations.

Apply the model spec pipeline and return the spec augmented with Smile-ready arrays.

Steps:
  1. apply :transformations (build-many-columns DSL)
  2. fit std-scaler on :std-scale columns
  3. drop :removals columns
  4. one-hot encode :one-hot columns (dropping :one-hot :removals)
  5. apply the std-scaler
  6. split into feature matrix (everything except :id-name and :y column)
  7. compute sigma, features-array (double[][]), y-array (double[])

The returned spec has :std-scale :scaler filled in — pass it to
svm-techml-smile.kernel/transform-scale to normalise new observations.
sourceraw docstring

svr-model-specclj

(svr-model-spec dataset
                id-col
                y-col
                std-scale-cols
                &
                {:keys [type predict-fn removals transformations one-hot-cols
                        one-hot-removals]
                 :or {type :svr
                      predict-fn identity
                      removals []
                      transformations nil
                      one-hot-cols []
                      one-hot-removals []}})

Build a base cross-sectional SVR model spec.

Required args: dataset — tech.ml.dataset id-col — keyword identifying the row-ID column (e.g. :Bond, :ISIN) y-col — keyword naming the target column std-scale-cols — seq of columns to standardise

Optional kwargs: :type — :svr (default) or :ols :predict-fn — inverse-transform for y (default identity) :removals — extra columns to drop before the feature matrix (default []) :transformations — feature-spec DSL steps to apply first (default nil) :one-hot-cols — columns to one-hot encode (default []) :one-hot-removals— one-hot columns to drop after encoding (default [])

Build a base cross-sectional SVR model spec.

Required args:
  dataset          — tech.ml.dataset
  id-col           — keyword identifying the row-ID column (e.g. :Bond, :ISIN)
  y-col            — keyword naming the target column
  std-scale-cols   — seq of columns to standardise

Optional kwargs:
  :type            — :svr (default) or :ols
  :predict-fn      — inverse-transform for y (default identity)
  :removals        — extra columns to drop before the feature matrix (default [])
  :transformations — feature-spec DSL steps to apply first (default nil)
  :one-hot-cols    — columns to one-hot encode (default [])
  :one-hot-removals— one-hot columns to drop after encoding (default [])
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close