Description Usage Arguments Details Value References See Also Examples

View source: R/seq_cat_model.R

`seq_cat_model`

chooses the subjects sequentially by the logistic
regression model for the categorical case.

1 2 | ```
seq_cat_model(labeled_ids, unlabeled_ids, splitted, newY, train, data,
d = 0.8, adaptive = "random")
``` |

`labeled_ids` |
A numeric vector for the unique identification of the labeled dataset. |

`unlabeled_ids` |
A numeric vector for the unique identification of the unlabeled dataset. |

`splitted` |
A list containing the datasets which we will use in the categorical case. Note that the element of the splitted is the collections of samples from Classes 0 and Classes k. |

`newY` |
A numeric number denotes the value of the labels from 0 to K which is the number of categories. |

`train` |
A matrix for the labeled samples. Note that the indices of the samples in the train dataset is the same as the labeled_ids. |

`data` |
A matrix denotes all the data including the labeled samples and the unlabeled samples. Note that the first column of the dataset is the response variable, that's the labels and the rest is the explanatory variables. |

`d` |
A numeric number specifying the length of the fixed size confidence set for our model. The default value is 0.8. |

`adaptive` |
A character string that determines the sample selection criterion to be used, matching one of 'random' or 'A_optimal The default value is 'random'. |

seq_cat_model is a multinomial logistic regression model that estimate the coefficient of the explanatory variables and determines the samples sequentially from original training data set given the fixed size confidence set under the categorical case. Note that there are two methods to select the samples. One sampling method is random sampling while another is the A-optimality criterion which seeks to minimize the trace of the inverse of the information matrix. In addition, we will use the special model: the individualized binary logistic regression. We will use the specific model to only fit two subgroups of the all dataset and get the estimated coefficient and decide whether to stop sampling. If it shows that we need to continue, we will use one of the samepling method above to pick the sample. Note that if the method is A-optimality, we will pick the most informative subjects.

a list containing the following components

`d` |
the length of the fixed size confidence set that we specify |

`n` |
the current sample size when the stopping criterion is satisfied |

`is_stopped` |
the label of sequential iterations stop or not. When the value of is_stopped is TRUE, it means the iteration stops |

`beta_est` |
the estimated coeffificent when the criterion is safisfied |

`cov` |
the covariance matrix between the estimated parameters |

`adaptive` |
the sample selection criterion we used |

Li, J., Chen, Z., Wang, Z., & Chang, Y. I. (2020). Active learning in
multiple-class classification problems via individualized binary models.
*Computational Statistics & Data Analysis*, 145, 106911.
doi:10.1016/j.csda.2020.106911

`seq_GEE_model`

for generalized estimating equations case

`seq_bin_model`

for binary classification case

`seq_ord_model`

for ordinal case.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ```
# generate the toy example
beta <- matrix(c(1,2,1,-1,1,2), ncol=2)
res <- gen_multi_data(beta, N = 10000, type = 'cat', test_ratio = 0.3)
train_id <- res$train_id
train <- res$train
test <- res$test
res <- init_multi_data(train_id, train, init_N = 300, type = 'cat')
splitted <- res$splitted
train <- res$train
newY <- res$newY
labeled_ids <- res$labeled_ids
unlabeled_ids <- res$unlabeled_ids
data <- res$data
# use seq_cat_model to multi-classification problem under the categorical case.
# You can remove '#' to run the command.
# start_time <- Sys.time()
# logitA_cat <- seq_cat_model(labeled_ids, unlabeled_ids, splitted, newY,
# train, data, d = 0.5, adaptive = "A_optimal")
# logitA_cat$time <- as.numeric(Sys.time() - start_time, units = "mins")
# print(logitA_cat)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.