For showing regression SSLR models, we will use Airquality dataset with 10% labeled data:
set.seed(1)
data <- airquality
#Train and test data
train.index  <- sample(nrow(data), round(0.7 * nrow(data)))
train <- data[ train.index,]
test  <- data[-train.index,]
cls <- which(colnames(wine) == "Ozone")
#% LABELED
labeled.index <- sample(nrow(train), round(0.1 * nrow(train)))
train[-labeled.index,cls] <- NAFor example, we can train with Decision Tree:
m <- SSLRDecisionTree(min_samples_split = round(length(labeled.index) * 0.25),
                      w = 0.3) %>% fit(Ozone ~ ., data = train)Now we can use metrics from yardstick package:
predict(m,test)%>%
  bind_cols(test) %>%
  metrics(truth = "Ozone", estimate = .pred)
#> # A tibble: 3 x 3
#>   .metric .estimator .estimate
#>   <chr>   <chr>          <dbl>
#> 1 rmse    standard      26.9  
#> 2 rsq     standard       0.562
#> 3 mae     standard      16.8For example, we can train with coBC: