addProblem {batchtools} | R Documentation |

## Define Problems for Experiments

### Description

Problems may consist of up to two parts: A static, immutable part (`data`

in `addProblem`

)
and a dynamic, stochastic part (`fun`

in `addProblem`

).
For example, for statistical learning problems a data frame would be the static problem part while
a resampling function would be the stochastic part which creates problem instance.
This instance is then typically passed to a learning algorithm like a wrapper around a statistical model
(`fun`

in `addAlgorithm`

).

This function serialize all components to the file system and registers the problem in the `ExperimentRegistry`

.

`removeProblem`

removes all jobs from the registry which depend on the specific problem.
`reg$problems`

holds the IDs of already defined problems.

### Usage

```
addProblem(
name,
data = NULL,
fun = NULL,
seed = NULL,
cache = FALSE,
reg = getDefaultRegistry()
)
removeProblems(name, reg = getDefaultRegistry())
```

### Arguments

`name` |
[ |

`data` |
[ |

`fun` |
[ |

`seed` |
[ |

`cache` |
[ |

`reg` |
[ |

### Value

[`Problem`

]. Object of class “Problem” (invisibly).

### See Also

### Examples

```
tmp = makeExperimentRegistry(file.dir = NA, make.default = FALSE)
addProblem("p1", fun = function(job, data) data, reg = tmp)
addProblem("p2", fun = function(job, data) job, reg = tmp)
addAlgorithm("a1", fun = function(job, data, instance) instance, reg = tmp)
addExperiments(repls = 2, reg = tmp)
# List problems, algorithms and job parameters:
tmp$problems
tmp$algorithms
getJobPars(reg = tmp)
# Remove one problem
removeProblems("p1", reg = tmp)
# List problems and algorithms:
tmp$problems
tmp$algorithms
getJobPars(reg = tmp)
```

*batchtools*version 0.9.17 Index]