### 25.5 Linear regression ¶

The linear regression model takes models built from some external package and finds coefficients based on the features and weights. A model consists of a list of features. The first should be the atom `Intercept` plus a value. The following in the list should consist of a feature (see Features) followed by a weight. An optional third element may be a list of atomic values. If the result of the feature is a member of this list the feature’s value is treated as 1 else it is 0. This third argument allows an efficient way to map categorical values into numeric values. For example, from the F0 prediction model in `lib/f2bf0lr.scm`. The first few parameters are

    (set! f2b_f0_lr_start
    '(
       ( Intercept 160.584956 )
       ( Word.Token.EMPH 36.0 )
       ( pp.tobi_accent 10.081770 (H*) )
       ( pp.tobi_accent 3.358613 (!H*) )
       ( pp.tobi_accent 4.144342 (*? X*? H*!H* * L+H* L+!H*) )
       ( pp.tobi_accent -1.111794 (L*) )
       ...
    )

Note the feature `pp.tobi_accent` returns an atom, and is hence tested with the map groups specified as third arguments.

Models may be built from feature data (in the same format as `wagon` using the `ols` program distributed with the speech tools library.