Skip to contents

VGAM::vglm Multinomial Learner

Usage

lnr_multinomial_vglm(data, formula, ...)

Arguments

data

A dataframe to train a learner / learners on.

formula

A regression formula to use inside this learner.

...

Any extra arguments that should be passed to the internal model for model fitting purposes.

Value

A prediction function that accepts newdata, which returns predictions (a numeric vector of density prediction values at the outcome value observed in the newdata conditioning on the predictor variables in newdata).

Examples

df <- mtcars
df$cyl <- as.factor(df$cyl)
lnr_multinomial_vglm(df, cyl ~ hp + mpg)(df)
#> Warning: 6 diagonal elements of the working weights variable 'wz' have been replaced by 1.819e-12
#> Warning: 8 diagonal elements of the working weights variable 'wz' have been replaced by 1.819e-12
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: 13 diagonal elements of the working weights variable 'wz' have been replaced by 1.819e-12
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: 19 diagonal elements of the working weights variable 'wz' have been replaced by 1.819e-12
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: 20 diagonal elements of the working weights variable 'wz' have been replaced by 1.819e-12
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: 22 diagonal elements of the working weights variable 'wz' have been replaced by 1.819e-12
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: 22 diagonal elements of the working weights variable 'wz' have been replaced by 1.819e-12
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: 22 diagonal elements of the working weights variable 'wz' have been replaced by 1.819e-12
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: 22 diagonal elements of the working weights variable 'wz' have been replaced by 1.819e-12
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: 22 diagonal elements of the working weights variable 'wz' have been replaced by 1.819e-12
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: 22 diagonal elements of the working weights variable 'wz' have been replaced by 1.819e-12
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: 22 diagonal elements of the working weights variable 'wz' have been replaced by 1.819e-12
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: iterations terminated because half-step sizes are very small
#> Warning: some quantities such as z, residuals, SEs may be inaccurate due to convergence at a half-step
#> Warning: fitted probabilities numerically 0 or 1 occurred
#>  [1] 0.8207630 0.8207630 0.9963843 0.6849419 0.8914861 0.9962009 1.0000000
#>  [8] 0.9999998 0.9943654 0.9988847 0.9715516 0.9998795 0.9986678 0.9999951
#> [15] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 0.9094081
#> [22] 0.9988749 0.9994949 1.0000000 0.6835611 1.0000000 0.9999940 0.9999998
#> [29] 1.0000000 0.6377564 1.0000000 0.3649949
lnr_multinomial_vglm(iris, Species ~ .)(iris)
#> Warning: 2 diagonal elements of the working weights variable 'wz' have been replaced by 1.819e-12
#> Warning: 13 diagonal elements of the working weights variable 'wz' have been replaced by 1.819e-12
#> Warning: 22 diagonal elements of the working weights variable 'wz' have been replaced by 1.819e-12
#> Warning: 34 diagonal elements of the working weights variable 'wz' have been replaced by 1.819e-12
#> Warning: 39 diagonal elements of the working weights variable 'wz' have been replaced by 1.819e-12
#> Warning: 41 diagonal elements of the working weights variable 'wz' have been replaced by 1.819e-12
#> Warning: 47 diagonal elements of the working weights variable 'wz' have been replaced by 1.819e-12
#> Warning: 50 diagonal elements of the working weights variable 'wz' have been replaced by 1.819e-12
#> Warning: 54 diagonal elements of the working weights variable 'wz' have been replaced by 1.819e-12
#> Warning: 59 diagonal elements of the working weights variable 'wz' have been replaced by 1.819e-12
#> Warning: 63 diagonal elements of the working weights variable 'wz' have been replaced by 1.819e-12
#> Warning: 78 diagonal elements of the working weights variable 'wz' have been replaced by 1.819e-12
#> Warning: 91 diagonal elements of the working weights variable 'wz' have been replaced by 1.819e-12
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: 96 diagonal elements of the working weights variable 'wz' have been replaced by 1.819e-12
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: 97 diagonal elements of the working weights variable 'wz' have been replaced by 1.819e-12
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: fitted probabilities numerically 0 or 1 occurred
#> Warning: fitted values close to 0 or 1
#> Warning: some quantities such as z, residuals, SEs may be inaccurate due to convergence at a half-step
#>   [1] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
#>   [8] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
#>  [15] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
#>  [22] 1.0000000 1.0000000 0.9999999 1.0000000 1.0000000 1.0000000 1.0000000
#>  [29] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
#>  [36] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 0.9999997
#>  [43] 1.0000000 0.9999999 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
#>  [50] 1.0000000 0.9999883 0.9999514 0.9988014 0.9999578 0.9985915 0.9998981
#>  [57] 0.9986943 1.0000000 0.9999854 0.9999852 1.0000000 0.9999626 0.9999999
#>  [64] 0.9992011 1.0000000 0.9999972 0.9986740 1.0000000 0.9404018 0.9999999
#>  [71] 0.5951619 0.9999997 0.7751662 0.9999598 0.9999986 0.9999929 0.9992876
#>  [78] 0.7239383 0.9990348 0.9999998 0.9999999 1.0000000 0.9999999 0.1323701
#>  [85] 0.9978308 0.9997870 0.9997020 0.9997449 0.9999992 0.9999889 0.9999603
#>  [92] 0.9998404 0.9999996 1.0000000 0.9999850 0.9999997 0.9999969 0.9999977
#>  [99] 0.9999997 0.9999977 1.0000000 0.9996139 0.9999990 0.9997188 0.9999999
#> [106] 1.0000000 0.8908123 0.9999955 0.9999921 1.0000000 0.9902584 0.9997429
#> [113] 0.9999800 0.9999673 0.9999999 0.9999952 0.9976994 0.9999999 1.0000000
#> [120] 0.9204923 0.9999996 0.9995130 1.0000000 0.9484339 0.9999824 0.9995586
#> [127] 0.8245440 0.8022990 0.9999992 0.9712013 0.9999969 0.9999189 0.9999999
#> [134] 0.2048741 0.9664047 1.0000000 0.9999999 0.9964973 0.6691425 0.9998717
#> [141] 1.0000000 0.9999440 0.9996139 1.0000000 1.0000000 0.9999932 0.9991067
#> [148] 0.9989939 0.9999956 0.9776789