Skip to contents

Train a supervised model with limited labels by first clustering the data and propagating labels within clusters.

Usage

tl_semisupervised(
  data,
  formula,
  labeled_indices,
  cluster_method = "kmeans",
  supervised_method = "logistic",
  ...
)

Arguments

data

A data frame

formula

Model formula

labeled_indices

Indices of labeled observations

cluster_method

Clustering method for label propagation

supervised_method

Supervised learning method for final model

...

Additional arguments

Value

A tidylearn model object with additional class "tidylearn_semisupervised", trained on pseudo-labeled data. The model includes a semisupervised_info element with labeled_indices, cluster_model, and label_mapping.

Examples

# \donttest{
# Use only 10% of labels
labeled_idx <- sample(nrow(iris), size = 15)
model <- tl_semisupervised(iris, Species ~ ., labeled_indices = labeled_idx,
  cluster_method = "kmeans",
  supervised_method = "tree"
)
# }