Preparing the catalog and filters…Katalog ve filtreler hazırlanıyor…
Starter code
module xor_classifier;
@seed(17);
param w: Angle = 0.4;
fn main() {
let q = qreg[2];
encode(sample_row(), q, method: "reupload");
CNOT(q[0], q[1]);
Ry(q[1], w);
let cost = expect Z(q[1]);
train {
objective: minimize cost;
optimizer: adam(lr = 0.2);
steps: 40;
dataset: xor_2d;
loss: mse;
}
return cost;
}Expected output
The train block runs over xor_2d
MSE history is finite
Final accuracy reaches at least 75%
The trained parameter is reported
Debugging checklist
Run the source
Inspect each ten-step cost line
Find finalAccuracy in the training result
Change the seed and record the contract
Extension challenge
Add a second trainable rotation and compare accuracy without increasing the 100-step guardrail.