Skip to main content
[ "article:topic", "showtoc:no", "authorname:ashipunov", "license:publicdomain", "jupyter:r", "Deep Learning" ]
Statistics LibreTexts

7.5: Deep Learning

  • Page ID
    3586
  • Nowadays, “deep learning” is a bit of buzzword which used to designate software packages including multiple classification methods, and among the always some complicated neural networks (multi-layered, recurrent etc.) In that sense, R with necessary packages is a deep learning system. What is missed (actually, not), is a common interface to all “animals” in this zoo of methods. Package mlr was created to unify the learning interface in R:

    Code \(\PageIndex{1}\) (Python):

    library(mlr)
    ...
    ## 1) Define the task
    ## Specify the type of analysis (e.g. classification)
    ## and provide data and response variable
    task <- makeClassifTask(data=iris, target="Species")
    ## 2) Define the learner, use listLearners()[,1]
    ## Choose a specific algorithm
    lrn <- makeLearner("classif.ctree")
    n = nrow(iris)
    train.set <- sample(n, size=2/3*n)
    test.set <- setdiff(1:n, train.set)
    ## 3) Fit the model
    ## Train the learner on the task using a random subset
    ## of the data as training set
    model <- train(lrn, task, subset=train.set)
    ## 4) Make predictions
    ## Predict values of the response variable for new
    ## observations by the trained model
    ## using the other part of the data as test set
    pred <- predict(model, task=task, subset=test.set)
    ## 5) Evaluate the learner
    ## Calculate the mean misclassification error and accuracy
    performance(pred, measures=list(mmce, acc))
    

    In addition, R now has interfaces (ways to connect with) to (almost) all famous “deep learning” software systems, namely TensorFlow, H2O, Keras, Caffe and MXNet.