f_dmss_dW: Calculate Derivative of Cost Function wrt W

Description Usage Arguments Details Value See Also Examples

Description

Calculate the first derivative of objective function with respect to W, given data and requisite model parameter values.

Usage

1
f_dmss_dW(U, Xstar, W, yerrs, cc)

Arguments

U

Numeric matrix, N x d_u of activation inputs.

Xstar

Numeric matrix, N x m. The “new” polynomial inputs created by applying the activation layer, W, to U. Accomplished computationally with fun f_mactivate.

W

Numeric matrix, d_u x m, the multiplicative activation layer.

yerrs

Numeric vector of length N. y minus yhat.

cc

Numeric vector of length m. Coefficients for Xstar.

Details

There is really no need for user to call this function directly; this function is called by the fitting functions in this library. Important. Computationally there are (at least) two ways to solve this derivative, one is O(Nd), the other is O(Nd^2) (d is the number of columns in U). This function uses the first, computationally less expensive method. It is not an approximation; the simplification occurs simply by dividing out the appropriate partial term rather than taking the full product of terms across U. This has a very important implication of which we must be aware: zeros in U may result in division by zero! This function will handle the errors, but the ultimate consequence of zeros in U is that the derivative returned by this function may not be accurate. We should eliminate zeros in U. Standardizing U is one good solution. If zeros are only present because of “one-hot” indicators (dummies), another possible solution is to substitute -1 for 0 (actually not a bad practice anyway).

Value

Numeric matrix, d_u x m.

See Also

f_mactivate

Examples

1
#######

mactivate documentation built on Aug. 2, 2021, 5:07 p.m.