LILY-QML / LLY-DML

LLY-DML is part of the LILY project and is a Quantum Machine Learning model. It uses so-called L-Gates. These gates are Machine Learning gates that modify their state based on an input to map to a desired state of an input.
https://www.lilyqml.de
2 stars 5 forks source link

Class All/ Constraining Methods #43

Open xleonplayz opened 2 weeks ago

xleonplayz commented 2 weeks ago

Method: crosstraining(Optimizer)

This method is used to train the data in a random order and interval towards the end of the optimization function. It ensures that training subsequent activation matrices does not overly disrupt the datasets already trained.

Process Details

  1. Initialization:

    • Under the given optimizer's section in train.json, load:
      • The target_state for each activation matrix.
      • The last training matrix final_ombc for each activation matrix.
    • From data.json, retrieve the value iteration_crosstrain_b.
    • Initialize an internal attribute current_tp (Current Training Parameters) by loading final_ombc.
  2. Cross-Training Loop (Loop A):

    The number of iterations is set by iteration_crosstrain_a from data.json.

    • For Each Iteration:
      • Random Selection:
      • Randomly determine two values:
        • intern_iter: An internal iteration count.
        • selected_ap: A selected activation matrix from the available activation matrices in data.json.
      • Cross-Training Helper:
      • Call the crosshelper() method with:
        • The matrix and target_state from selected_ap loaded from train.json.
        • current_tp.
        • The optimizer.
        • The value iteration_crosstrain_b.
  3. Completion Check:

    • At the end, verify whether each activation matrix (AP) has been trained at least once.
      • If not, repeat the loop until the value top_cross_iterations from data.json is exceeded.
      • If the maximum is exceeded without training all APs, log an error message indicating that not every AP was cross-trained.

Method: crosshelper

Process Details

  1. Determine Iterations:

    • Check if iteration_crosstrain_a is greater than intern_iter.
      • If yes, set b_iterations to iteration_crosstrain_b.
      • If not, use intern_iter as b_iterations.
  2. Training Loop (Loop B):

    • For b_iterations Iterations:
      • Circuit Creation:
      • Create a circuit with:
        • current_tp as the training matrix.
        • selected_ap as the activation matrix.
      • Measurement:
      • Measure the circuit.
      • Optimization:
      • Call start(optimizer, target_state).
      • Execute the optimize method.

Documentation and Logging

Rules for the Training Matrices

Logging Rules


xleonplayz commented 2 weeks ago

needed files https://github.com/LILY-QML/LLY-DML/wiki/Optimizer https://github.com/LILY-QML/LLY-DML/issues/19 https://github.com/LILY-QML/LLY-DML/issues/34