View source: R/GraphLearnerTorch.R
| as_learner_torch | R Documentation |
Converts a Graph representing a deep learning pipeline into a
GraphLearnerTorch.
The graph either builds the network from PipeOpTorch operators and ends in a
PipeOpTorchModel, or its base learner is a LearnerTorch, e.g.
po("scale") %>>% lrn("classif.mlp").
The advantage over using as_learner() is that the resulting learner exposes methods like
$dataset() and fields like $network.
as_learner_torch(x, ...)
## S3 method for class 'Graph'
as_learner_torch(x, id = NULL, ...)
## S3 method for class 'PipeOp'
as_learner_torch(x, ...)
## S3 method for class 'GraphLearner'
as_learner_torch(x, id = x$id, ...)
x |
(any) |
... |
(any) |
id |
( |
GraphLearner
Other Graph Network:
ModelDescriptor(),
TorchIngressToken(),
mlr_learners_torch_model,
mlr_pipeops_module,
mlr_pipeops_torch,
mlr_pipeops_torch_ingress,
mlr_pipeops_torch_ingress_categ,
mlr_pipeops_torch_ingress_ltnsr,
mlr_pipeops_torch_ingress_num,
model_descriptor_to_learner(),
model_descriptor_to_module(),
model_descriptor_union(),
nn_graph(),
pipeop_torch()
Other Learner:
GraphLearnerTorch,
mlr_learners.ft_transformer,
mlr_learners.mlp,
mlr_learners.module,
mlr_learners.realmlp,
mlr_learners.tab_resnet,
mlr_learners.tabm,
mlr_learners.torch_featureless,
mlr_learners_torch,
mlr_learners_torch_image,
mlr_learners_torch_model
graph = po("scale") %>>%
po("torch_ingress_num") %>>%
nn("linear", out_features = 10) %>>%
nn("relu") %>>%
nn("head") %>>%
po("torch_loss", "cross_entropy") %>>%
po("torch_optimizer", "adam", lr = 0.1) %>>%
po("torch_model_classif", epochs = 1, batch_size = 32)
learner = as_learner_torch(graph)
learner$id
learner$param_set$set_values(linear.out_features = 20, torch_optimizer.lr = 0.01)
task = tsk("iris")
learner$train(task)
learner$network
learner$predict(task)
learner$dataset(task, "train")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.