Library
Auxiliar Functions
NarmaxLasso.simulate — Function.simulate(u, f, yterms, uterms[, vterms][; σv=0.0, σw=0.0, seed=1] ) -> yBe u the input vector applied to a discrete system and y the correspondent output vector for a system described by the difference equations:
and
where yterms , uterms and vterms are vector containing dependencies on previous terms of $y$, $u$ and $v$; $v[k]$ and $w[k]$ are random variables with zero mean and standard deviation σv and σw, respectively. The random number generator is initialized with seed, during the generation. Furthermore, f is the function that describe the system dynamics: f(yvec, uvec, vvec) -> y.
simulate(u, mdl::NarmaxRegressors, β) -> yBe u the input vector applied to a discrete system and y the correspondent output vector for a system described by a basis expansion model mdl and the parameter vector β.
NarmaxLasso.generate_random_input — Function.generate_random_input(n [, nrep=5][; σ=1, seed=1]) -> uGenerate a vector $u$ containing a random signal. The values are draw from a zero-mean Gaussian distribution with standard deviation σ and held for nrep samples. The random number generator is initialized with seed, during the generation.
Basis Expansion
NarmaxLasso.Basis — Type.BasisA basis function is an element of a particular basis for a function space. Every continuous function in the function space can be represented as a linear combination of basis functions:
So far the only implemented basis is Monomial.
NarmaxLasso.Monomial — Type.Monomial(exponents)A Monomial function is a product of powers of variables with nonnegative integer exponents.
The Monomial is defined using a vector of integers exponents. This vector contains the correspondent exponents $p$ for all the inputs from 1 to n.
Regressors
NarmaxLasso.NarmaxRegressors — Type.NarmaxRegressors{T<:Basis}(basis::Vector{T}, yterms, uterms[, vterms])Describe regressors to be used on a NARMAX estimation problem.
NarmaxLasso.generate_all — Function.generate_all(::Type{NarmaxRegressors}, ::Type{Monomials}, ny, nu, nv, order)Generate a set of regressors containing all monomials:
for which: $1\le q_i \le n_y$; $1 \le t_i \le n_u$; $1 \le w_i \le n_e$; and, $l_i + r_i + s_i = \text{order}[i]$.
LassoEstimation
NarmaxLasso.narmax_lasso — Function.narmax_lasso(y, u, mdl::NarmaxRegressors[; use_glmnet]) -> r::LassoResultGiven input and output signals u and y, and a structure mdl specifying the regressors through a structure NarmaxRegressors. Find the solution of the lasso problem:
for a grid of values of the regularization parameter $\lambda$. Return a LassoResult structure containing the obtained values. The option use_glmnet=true changes the internal solver to GLMNet (only available when no noise term is present).
NarmaxLasso.LassoResult — Type.LassoResultResult of lasso estimation for a grid of values of regularization parameter. Contains:
| Atributes | Type | Brief Description |
|---|---|---|
| mdl | NarmaxRegressors | Regressors |
| λ | Matrix{Float64} | Sequence of regularization parameters λ |
| β | Matrix{Float64} | Parameter vectors arranged columnwise, for the sequence of λ |
| df | Matrix{Int} | Number of nonzero terms for the sequence of λ |
| time | Float64 | Execution time |
| total_iter | Int | Total number of internal iterations |