liveBook · Manning

Multilayer perceptron

As explained in Fight Fraud with Machine Learning

A multilayer perceptron is a feedforward neural network composed of fully connected layers that transform input features into predictions.

A multilayer perceptron (MLP) is a feedforward neural network that transforms transaction features through fully connected layers to predict licit or illicit activity. For Bitcoin fraud detection, it treats each transaction independently and provides a practical baseline before models that use graph relationships. section 9.1.4 section 9.5

A feature-only MLP workflow includes:

  • Feed each transaction’s 165 features into a fully connected layer producing eight intermediate features. section 9.2.1
  • Apply a ReLU activation and dropout, then pass the result to a second fully connected layer producing two class outputs. section 9.2.1
  • Train with cross-entropy loss, Adam, learning rate 0.01, weight decay 0.0001, and 1,000 epochs. section 9.2.3
  • Evaluate predictions with accuracy and weighted F1, since accuracy alone can conceal performance problems in imbalanced classes. section 9.2.3

Elliptic Bitcoin transaction baseline

A PyTorch MLP can map 165 transaction features to eight hidden features and then two outputs for licit and illicit classes. After training, the demonstrated model reaches 0.9328 test accuracy and a 0.9377 F1 score. These results provide a reference point for graph models that additionally use payment connections. section 9.2.1 section 9.2.3 section 9.5

class MLP(torch.nn.Module):
    def __init__(self, hidden_channels):
        super().__init__()
        torch.manual_seed(12345)
        self.lin1 = Linear(dataset.num_features, hidden_channels)
        self.lin2 = Linear(hidden_channels, dataset.num_classes)
    def forward(self, x):
        x = self.lin1(x)
        x = x.relu()
        x = F.dropout(x, p=0.5, training=self.training)
        x = self.lin2(x)
        return x

Inspect the compact PyTorch class defining the two linear layers, ReLU activation, dropout, and forward pass. section 9.2.1

How Fight Fraud with Machine Learning covers it

How deep it goes
Explains layer dimensions, activation, dropout, initialization, training, evaluation, and learning curves, but stops short of neighborhood aggregation.
Examples
Uses the Elliptic Bitcoin dataset, 165-feature transactions, PyTorch listings, learning curves, graph visualizations, and licit-versus-illicit predictions.
What it assumes
Assumes transaction feature vectors and labels, while teaching the model architecture, forward pass, optimization loop, and classification evaluation.
What you can do after
Builds and evaluates a PyTorch MLP baseline for binary or extensible multiclass transaction classification.
How it connects
Connects fully connected layers, ReLU, dropout, cross-entropy loss, Adam, class imbalance, graph neural networks, GCNs, and GATs.

Also explained in

Compare how 4 books explain multilayer perceptron →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Fight Fraud with Machine Learning. The section links point to the parts of the book it draws on.