Question: Q06.7. Probability Estimation | Multiclass Logistic Regression | Simulated Data # load packages library( nnet )library( tibble ) # set seed set.seed( 33468 ) #
Q06.7. Probability Estimation | Multiclass Logistic Regression | Simulated Data
# load packageslibrary("nnet")library("tibble")# set seed set.seed(33468)# "split" datamcr_trn = as_tibble(mlbench::mlbench.2dnormals(n = 200, cl = 4))mcr_tst = as_tibble(mlbench::mlbench.2dnormals(n = 3, cl = 4))# check datamcr_trn
Use themultinom()function from thennetpackage tofitamulticlass logistic regressionto the training data. Useclassesas the response and the remaining variables as features.
- Immediately before using themultinom()function, useset.seed(42).
Use the trained multiclass logistic regression toestimatetheprobabilitythatclasses = 3for the three observations in the test set.

Use the multinom( ) function from the nnet package to fit a multiclass logistic regression to the training data. Use classes as the response and the remaining variables as features. . Immediately before using the multinom ( ) function, use set. seed (42). Use the trained multiclass logistic regression to estimate the probability that classes = 3 for the three observations in the test set. P[classes = 3 | Observation 1] number (rtol=0.0001, atol=1e-08) ? P[classes = 3 | Observation 2] number (rtol=0.0001, atol=1e-08) ? Pclasses = 3 | Observation 3] number (rtol=0.0001, atol=1e-08)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
