QuantumNeuralNetwork<T>

Models & Types · AiDotNet.NeuralNetworks

Represents a Quantum Neural Network, which combines quantum computing principles with neural network architecture.

Inheritance: NeuralNetworkBase<T> → DeclaredModelLayoutBase<T> → VectorModelLayoutBase<T> → QuantumNeuralNetwork<T>

For Beginners

A Quantum Neural Network combines ideas from quantum computing with neural networks.

Think of it like upgrading from a regular calculator to a special calculator with new abilities:

  • Regular neural networks use normal bits (0 or 1)
  • Quantum neural networks use quantum bits or “qubits” that can be 0, 1, or both at the same time
  • This “both at the same time” property (called superposition) gives quantum networks special abilities
  • These networks might solve certain problems much faster than regular neural networks

For example, a quantum neural network might find patterns in complex data or optimize solutions in ways that would be extremely difficult for traditional neural networks.

While the math behind quantum computing is complex, you can think of a quantum neural network as having the potential to explore many possible solutions simultaneously rather than one at a time.

How It Works

A Quantum Neural Network (QNN) is a neural network architecture that leverages quantum computing principles to potentially solve certain problems more efficiently than classical neural networks. It uses quantum bits (qubits) instead of classical bits, allowing it to process information in ways not possible with traditional neural networks.

Example

var input = Tensor<float>.CreateRandom(new[] { 1, 4 });
var trainX = Tensor<float>.CreateRandom(4, 8);
var trainY = Tensor<float>.CreateRandom(4, 2);
var result = new AiModelBuilder<float, Tensor<float>, Tensor<float>>()
    .ConfigureModel(new QuantumNeuralNetwork<float>())
    .Build(trainX, trainY);
var output = result.Predict(input);

Constructors

Constructor Summary
QuantumNeuralNetwork() Initializes a new instance of the QuantumNeuralNetwork class with the specified architecture and number of qubits.
QuantumNeuralNetwork(NeuralNetworkArchitecture<T> architecture, int numQubits, PreprocessingPipeline<T, Tensor<T>, Tensor<T>> preprocessingPipeline, ILossFunction<T> lossFunction, QuantumNeuralNetworkOptions options)

Methods

Method Summary
ModelMetadata<T> GetModelMetadata() Retrieves metadata about the quantum neural network model.