@@ -299,13 +299,16 @@ def update_circuit_plot(num_qubits: int, num_layers: int, model_parameters: str)
299299 state = [
300300 State (component_id = "select_lr" , component_property = "value" ),
301301 State (component_id = "select_batch_size" , component_property = "value" ),
302+ State (component_id = "select_reg_type" , component_property = "value" ),
303+ State (component_id = "select_reg_strength" , component_property = "value" ),
302304 State (component_id = "train_datastore" , component_property = "data" ),
303305 State (component_id = "model_parameters" , component_property = "data" ),
304306 ],
305307)
306308def single_epoch (num_clicks : int , num_intervals : int , reset_clicks : int ,
307309 num_qubits : int , num_layers : int , selected_data_set : str ,
308- lr : float , batch_size : int , train_data , model_parameters ):
310+ lr : float , batch_size : int , reg_type : str , reg_strength : float ,
311+ train_data , model_parameters ):
309312 """
310313 Performs a single training epoch for the quantum model using the provided parameters.
311314
@@ -325,6 +328,10 @@ def single_epoch(num_clicks: int, num_intervals: int, reset_clicks: int,
325328 :type lr: float
326329 :param batch_size: Size of training batches
327330 :type batch_size: int
331+ :param reg_type: Type of regularization (none, l1, l2)
332+ :type reg_type: str
333+ :param reg_strength: Strength of regularization
334+ :type reg_strength: float
328335 :param train_data: Training data in JSON format
329336 :param model_parameters: Current model parameters
330337 :return: Updated model parameters and current epoch number
@@ -345,7 +352,7 @@ def single_epoch(num_clicks: int, num_intervals: int, reset_clicks: int,
345352 model_parameters = unserialize_model_dict (model_parameters )
346353 qcl .load_model (model_parameters )
347354
348- qcl .train_single_epoch (df_train [["x" , "y" ]].values , df_train ["label" ].values , lr , batch_size )
355+ qcl .train_single_epoch (df_train [["x" , "y" ]].values , df_train ["label" ].values , lr , batch_size , reg_type , reg_strength )
349356 model_parameters = qcl .save_model ()
350357
351358 return [json .dumps (model_parameters ), model_parameters ["config" ]["epoch" ]]
0 commit comments