def run_montecarlo(models: List[Model], dataset: cvnn.dataset.Dataset, open_dataset: Optional[t_path]=None, iterations: int=30, epochs: int=300, batch_size: int=100, display_freq: int=1, validation_split: float=0.2, validation_data: Optional[Union[(Tuple, data.Dataset)]]=None, verbose: Union[(bool, int)]=False, do_conf_mat: bool=False, do_all: bool=True, tensorboard: bool=False, polar: Optional[Union[(str, List[Optional[str]], Tuple[Optional[str]])]]=None, plot_data: bool=False, early_stop: bool=False, shuffle: bool=True, preprocess_data: bool=True) -> str:
    "\n    This function is used to compare different neural networks performance.\n    1. Runs simulation and compares them.\n    2. Saves several files into ./log/montecarlo/date/of/run/\n        2.1. run_summary.txt: Summary of the run models and data\n        2.2. run_data.csv: Full information of performance of iteration of each model at each epoch\n        2.3. <model_name>_statistical_result.csv: Statistical results of all iterations of each model per epoch\n        2.4. (Optional) `plot/` folder with the corresponding plots generated by MonteCarloAnalyzer.do_all()\n\n    :param models: List of cvnn.CvnnModel to be compared.\n    :param dataset: cvnn.dataset.Dataset with the dataset to be used on the training\n    :param open_dataset: (Default: None)\n        If dataset is saved inside a folder and must be opened, path of the Dataset to be opened. Else None (default)\n    :param iterations: Number of iterations to be done for each model\n    :param epochs: Number of epochs for each iteration\n    :param batch_size: Batch size at each iteration\n    :param display_freq: Frequency in terms of epochs of when to do a checkpoint.\n    :param verbose: Different modes according to number:\n            - 0 or 'silent': No output at all\n            - 1 or False: Progress bar per iteration\n            - 2 or True or 'debug': Progress bar per epoch\n    :param polar: Boolean weather the RVNN should receive real and imaginary part (False) or amplitude and phase (True)\n    :param do_all: If true (default) it creates a `plot/` folder with the plots generated by MonteCarloAnalyzer.do_all()\n    :param validation_split: Float between 0 and 1.\n            Percentage of the input data to be used as test set (the rest will be use as train set)\n            Default: 0.0 (No validation set).\n            This input is ignored if validation_data is given.\n        :param validation_data: Data on which to evaluate the loss and any model metrics at the end of each epoch.\n            The model will not be trained on this data. This parameter takes precedence over validation_split.\n            It can be:\n                - tuple (x_val, y_val) of Numpy arrays or tensors. Preferred data type (less overhead).\n                - A tf.data dataset.\n    :param do_conf_mat: Generate a confusion matrix based on results.\n    :return: (string) Full path to the run_data.csv generated file.\n        It can be used by cvnn.data_analysis.SeveralMonteCarloComparison to compare several runs.\n    "
    if open_dataset:
        dataset = dp.OpenDataset(open_dataset)
    monte_carlo = MonteCarlo()
    for model in models:
        monte_carlo.add_model(model)
    if ((not open_dataset) and isinstance(dataset, dp.Dataset)):
        dataset.save_data(monte_carlo.monte_carlo_analyzer.path)
    monte_carlo.output_config['excel_summary'] = False
    monte_carlo.output_config['tensorboard'] = tensorboard
    monte_carlo.output_config['confusion_matrix'] = do_conf_mat
    monte_carlo.output_config['plot_all'] = do_all
    if (plot_data and isinstance(dataset, dp.Dataset)):
        dataset.plot_data(overlapped=True, showfig=False, save_path=monte_carlo.monte_carlo_analyzer.path, library='matplotlib')
    if isinstance(dataset, dp.Dataset):
        x = dataset.x
        y = dataset.y
        data_summary = dataset.summary()
    else:
        x = dataset
        y = None
        data_summary = ''
    monte_carlo.run(x, y, iterations=iterations, validation_split=validation_split, validation_data=validation_data, epochs=epochs, batch_size=batch_size, display_freq=display_freq, early_stop=early_stop, shuffle=shuffle, verbose=verbose, data_summary=data_summary, real_cast_modes=polar, process_dataset=preprocess_data)
    _save_montecarlo_log(iterations=iterations, path=str(monte_carlo.monte_carlo_analyzer.path), models_names=[str(model.name) for model in models], dataset_name=data_summary, num_classes=(str(dataset.y.shape[1]) if isinstance(dataset, dp.Dataset) else ''), polar_mode=str(polar), dataset_size=(str(dataset.x.shape[0]) if isinstance(dataset, dp.Dataset) else ''), features_size=(str(dataset.x.shape[1]) if isinstance(dataset, dp.Dataset) else ''), epochs=epochs, batch_size=batch_size)
    return str('./log/run_data.csv')
This function is used to compare different neural networks performance.
1. Runs simulation and compares them.
2. Saves several files into ./log/montecarlo/date/of/run/
    2.1. run_summary.txt: Summary of the run models and data
    2.2. run_data.csv: Full information of performance of iteration of each model at each epoch
    2.3. <model_name>_statistical_result.csv: Statistical results of all iterations of each model per epoch
    2.4. (Optional) `plot/` folder with the corresponding plots generated by MonteCarloAnalyzer.do_all()

:param models: List of cvnn.CvnnModel to be compared.
:param dataset: cvnn.dataset.Dataset with the dataset to be used on the training
:param open_dataset: (Default: None)
    If dataset is saved inside a folder and must be opened, path of the Dataset to be opened. Else None (default)
:param iterations: Number of iterations to be done for each model
:param epochs: Number of epochs for each iteration
:param batch_size: Batch size at each iteration
:param display_freq: Frequency in terms of epochs of when to do a checkpoint.
:param verbose: Different modes according to number:
        - 0 or 'silent': No output at all
        - 1 or False: Progress bar per iteration
        - 2 or True or 'debug': Progress bar per epoch
:param polar: Boolean weather the RVNN should receive real and imaginary part (False) or amplitude and phase (True)
:param do_all: If true (default) it creates a `plot/` folder with the plots generated by MonteCarloAnalyzer.do_all()
:param validation_split: Float between 0 and 1.
        Percentage of the input data to be used as test set (the rest will be use as train set)
        Default: 0.0 (No validation set).
        This input is ignored if validation_data is given.
    :param validation_data: Data on which to evaluate the loss and any model metrics at the end of each epoch.
        The model will not be trained on this data. This parameter takes precedence over validation_split.
        It can be:
            - tuple (x_val, y_val) of Numpy arrays or tensors. Preferred data type (less overhead).
            - A tf.data dataset.
:param do_conf_mat: Generate a confusion matrix based on results.
:return: (string) Full path to the run_data.csv generated file.
    It can be used by cvnn.data_analysis.SeveralMonteCarloComparison to compare several runs.
def run_montecarlo(models: List[Model], dataset: cvnn.dataset.Dataset, open_dataset: Optional[t_path]=None, iterations: int=30, epochs: int=300, batch_size: int=100, display_freq: int=1, validation_split: float=0.2, validation_data: Optional[Union[(Tuple, data.Dataset)]]=None, verbose: Union[(bool, int)]=False, do_conf_mat: bool=False, do_all: bool=True, tensorboard: bool=False, polar: Optional[Union[(str, List[Optional[str]], Tuple[Optional[str]])]]=None, plot_data: bool=False, early_stop: bool=False, shuffle: bool=True, preprocess_data: bool=True) -> str:
    "\n    This function is used to compare different neural networks performance.\n    1. Runs simulation and compares them.\n    2. Saves several files into ./log/montecarlo/date/of/run/\n        2.1. run_summary.txt: Summary of the run models and data\n        2.2. run_data.csv: Full information of performance of iteration of each model at each epoch\n        2.3. <model_name>_statistical_result.csv: Statistical results of all iterations of each model per epoch\n        2.4. (Optional) `plot/` folder with the corresponding plots generated by MonteCarloAnalyzer.do_all()\n\n    :param models: List of cvnn.CvnnModel to be compared.\n    :param dataset: cvnn.dataset.Dataset with the dataset to be used on the training\n    :param open_dataset: (Default: None)\n        If dataset is saved inside a folder and must be opened, path of the Dataset to be opened. Else None (default)\n    :param iterations: Number of iterations to be done for each model\n    :param epochs: Number of epochs for each iteration\n    :param batch_size: Batch size at each iteration\n    :param display_freq: Frequency in terms of epochs of when to do a checkpoint.\n    :param verbose: Different modes according to number:\n            - 0 or 'silent': No output at all\n            - 1 or False: Progress bar per iteration\n            - 2 or True or 'debug': Progress bar per epoch\n    :param polar: Boolean weather the RVNN should receive real and imaginary part (False) or amplitude and phase (True)\n    :param do_all: If true (default) it creates a `plot/` folder with the plots generated by MonteCarloAnalyzer.do_all()\n    :param validation_split: Float between 0 and 1.\n            Percentage of the input data to be used as test set (the rest will be use as train set)\n            Default: 0.0 (No validation set).\n            This input is ignored if validation_data is given.\n        :param validation_data: Data on which to evaluate the loss and any model metrics at the end of each epoch.\n            The model will not be trained on this data. This parameter takes precedence over validation_split.\n            It can be:\n                - tuple (x_val, y_val) of Numpy arrays or tensors. Preferred data type (less overhead).\n                - A tf.data dataset.\n    :param do_conf_mat: Generate a confusion matrix based on results.\n    :return: (string) Full path to the run_data.csv generated file.\n        It can be used by cvnn.data_analysis.SeveralMonteCarloComparison to compare several runs.\n    "
    if open_dataset:
        dataset = dp.OpenDataset(open_dataset)
    monte_carlo = MonteCarlo()
    for model in models:
        monte_carlo.add_model(model)
    if ((not open_dataset) and isinstance(dataset, dp.Dataset)):
        dataset.save_data(monte_carlo.monte_carlo_analyzer.path)
    monte_carlo.output_config['excel_summary'] = False
    monte_carlo.output_config['tensorboard'] = tensorboard
    monte_carlo.output_config['confusion_matrix'] = do_conf_mat
    monte_carlo.output_config['plot_all'] = do_all
    if (plot_data and isinstance(dataset, dp.Dataset)):
        dataset.plot_data(overlapped=True, showfig=False, save_path=monte_carlo.monte_carlo_analyzer.path, library='matplotlib')
    if isinstance(dataset, dp.Dataset):
        x = dataset.x
        y = dataset.y
        data_summary = dataset.summary()
    else:
        x = dataset
        y = None
        data_summary = 
    monte_carlo.run(x, y, iterations=iterations, validation_split=validation_split, validation_data=validation_data, epochs=epochs, batch_size=batch_size, display_freq=display_freq, early_stop=early_stop, shuffle=shuffle, verbose=verbose, data_summary=data_summary, real_cast_modes=polar, process_dataset=preprocess_data)
    _save_montecarlo_log(iterations=iterations, path=str(monte_carlo.monte_carlo_analyzer.path), models_names=[str(model.name) for model in models], dataset_name=data_summary, num_classes=(str(dataset.y.shape[1]) if isinstance(dataset, dp.Dataset) else ), polar_mode=str(polar), dataset_size=(str(dataset.x.shape[0]) if isinstance(dataset, dp.Dataset) else ), features_size=(str(dataset.x.shape[1]) if isinstance(dataset, dp.Dataset) else ), epochs=epochs, batch_size=batch_size)
    return str('./log/run_data.csv')