% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/mlp.R
\name{mx.mlp}
\alias{mx.mlp}
\title{Convenience interface for multiple layer perceptron}
\usage{
mx.mlp(data, label, hidden_node = 1, out_node, dropout = NULL,
  activation = "tanh", out_activation = "softmax",
  device = mx.ctx.default(), ...)
}
\arguments{
\item{data}{the input matrix. Only mx.io.DataIter and R array/matrix types supported.}

\item{label}{the training label. Only R array type supported.}

\item{hidden_node}{a vector containing number of hidden nodes on each hidden layer as well as the output layer.}

\item{out_node}{the number of nodes on the output layer.}

\item{dropout}{a number in [0,1) containing the dropout ratio from the last hidden layer to the output layer.}

\item{activation}{either a single string or a vector containing the names of the activation functions.}

\item{out_activation}{a single string containing the name of the output activation function.}

\item{device}{whether train on cpu (default) or gpu.}

\item{...}{other parameters passing to \code{mx.model.FeedForward.create}/}

\item{eval_metric}{the evaluation metric/}
}
\description{
Convenience interface for multiple layer perceptron
}
\examples{

require(mlbench)
data(Sonar, package="mlbench")
Sonar[,61] = as.numeric(Sonar[,61])-1
train.ind = c(1:50, 100:150)
train.x = data.matrix(Sonar[train.ind, 1:60])
train.y = Sonar[train.ind, 61]
test.x = data.matrix(Sonar[-train.ind, 1:60])
test.y = Sonar[-train.ind, 61]
model = mx.mlp(train.x, train.y, hidden_node = 10, out_node = 2, out_activation = "softmax", 
               learning.rate = 0.1)
preds = predict(model, test.x)

}

