---
title: "SSLR basics"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{introduction}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```
This package includes a collection of methods to create models for semi-supervised learning (e.g. fitting the model, making predictions, etc), with a fairly intuitive interface that is easy to use.
In [`Model list section`](.././articles/models.html) you can see the list of different classification, regression and clustering models.
### Motivation
Current packages to do semi-supervised learning do not use an intuitive interface. In this package, trying to use semi-supervised learning in an easy and intuitive way.
`SSLR` tries to solve this by providing an interface to use different models, mainly using the parsnip model interface to make the use of this package easier.
`SSLR` connects with parsnip to create different models without using too many arguments in the fit functions.
In addition, it uses other packages such as [`RSSL`](https://CRAN.R-project.org/package=RSSL) to use the same interface in an easy way.
For example, to use different ones like [`RSSL`](https://CRAN.R-project.org/package=RSSL). It has a different interface. Thanks to SSLR you can use different options to use its fit functions.
### Process
To fit the model (for example SelfTraining), you must:
* Have a defined model using parsnip
* Use your _parameters_ or using by default
* Call `fit` with formula, `fit_xy` with x and y, or `fit_x_u` with x and unlabeled data. See [`Model fitting section`](.././articles/fit.html).
For example, with `fit` function:
```{r, eval = FALSE}
rf <- rand_forest(trees = 100, mode = "classification") %>%
set_engine("randomForest")
m <- selfTraining(learner = rf) %>% fit(Wine ~ ., data = train)
```
Or with `fit_xy` function:
```{r, eval = FALSE}
rf <- rand_forest(trees = 100, mode = "classification") %>%
set_engine("randomForest")
m <- selfTraining(learner = rf) %>% fit_xy(x = train[,-cls], y = train$Wine)
```
This uses the `parsnip` package that has an intuitive interface to create a Random Forest model and this can be used in the `SSLR` package in a simple way.