Neural Network Algorithm

The Neural Network algorithm in SQL Server Analysis Services (SSAS) is a powerful tool for classification and regression tasks. It simulates the structure and function of biological neural networks to learn complex patterns in data.

Overview

Neural networks are composed of interconnected nodes (neurons) organized into layers: an input layer, one or more hidden layers, and an output layer. Each connection between neurons has a weight, which is adjusted during the training process. The algorithm learns by iteratively adjusting these weights to minimize the difference between its predictions and the actual outcomes in the training data.

Diagram of a neural network structure

A simplified representation of a neural network architecture.

Key Concepts

Applications

The Neural Network algorithm is well-suited for scenarios where:

Common applications include:

Parameters

Key parameters for the Neural Network algorithm in SSAS include:

Implementation Example (DMX)

To create a Neural Network mining model:


CREATE MINING MODEL [MyNeuralNetworkModel]
(
    [CustomerID] LONG KEY,
    [IsChurn]   DISCRETIZED (1, 0) SHARED STRUCTURE,
    [Demographics] STRUCTURE
    (
        [Age] LONG,
        [Gender] TEXT,
        [Income] DOUBLE
    ) PREDICTED `IsChurn`
)
USING NEWOWAN_CLASSIFICATION(
    HIDDEN_LAYERS = '2-10-5',
    MAX_ITERATIONS = 500,
    OPTIMIZATION_GOAL = 'CROSS_ENTROPY'
)
            

Usage and Prediction

Once trained, the model can be used to predict the likelihood of churn for existing or new customers:


SELECT
    [CustomerID],
    Predict (`IsChurn`) AS PredictedChurn,
    PredictProbability (`IsChurn`, 1) AS ChurnProbability,
    PredictProbability (`IsChurn`, 0) AS NoChurnProbability
FROM
    [MyNeuralNetworkModel]
NATURAL PREDICTION JOIN
    OPENQUERY(DataSourceView, 'SELECT CustomerID, Age, Gender, Income FROM Customers WHERE CustomerID = 12345')
            

Performance Considerations

Training neural networks can be computationally intensive. Consider data normalization, feature selection, and careful parameter tuning to optimize performance and prevent overfitting.

Further Reading