Example Scripts =============== The following example scripts demonstrate common CorePlexML SDK workflows. Each script is self-contained, uses ``argparse`` for configuration, and can be run directly against a CorePlexML instance. All examples are located in the ``docs-site/examples/`` directory. .. contents:: :local: :depth: 1 01 -- Quick Start ----------------- End-to-end ML workflow: create a project, upload data, train a classifier, deploy to staging, and make predictions. .. code-block:: bash python 01_quickstart.py --base-url https://your-domain.com \ --api-key YOUR_KEY --csv data.csv --target churned .. literalinclude:: ../examples/01_quickstart.py :language: python :linenos: 02 -- Batch Predictions ----------------------- Read rows from a CSV, send them in configurable batches to a deployment endpoint, and write predictions to an output file. .. code-block:: bash python 02_batch_predictions.py --base-url https://your-domain.com \ --api-key YOUR_KEY --deployment-id DEPLOY_UUID \ --input new_data.csv --output predictions.csv --batch-size 500 .. literalinclude:: ../examples/02_batch_predictions.py :language: python :linenos: 03 -- Experiment Comparison --------------------------- Run multiple experiments with different AutoML configurations on the same dataset, wait for all to complete, and print a ranked comparison. .. code-block:: bash python 03_experiment_comparison.py --base-url https://your-domain.com \ --api-key YOUR_KEY --project-id PROJ_UUID --version-id VER_UUID \ --target churned --problem-type classification .. literalinclude:: ../examples/03_experiment_comparison.py :language: python :linenos: 04 -- Privacy Workflow ---------------------- Create a HIPAA compliance policy, scan a dataset for PII, apply privacy transformations (masking, hashing, redaction), and retrieve results. .. code-block:: bash python 04_privacy_workflow.py --base-url https://your-domain.com \ --api-key YOUR_KEY --project-id PROJ_UUID --dataset-id DS_UUID \ --profile hipaa 05 -- Synthetic Data Generation ------------------------------- Train a SynthGen model (CTGAN/CopulaGAN/TVAE/Gaussian Copula) on a dataset version, wait for training, and generate synthetic rows with optional reproducibility seed. .. code-block:: bash python 05_synthetic_data.py --base-url https://your-domain.com \ --api-key YOUR_KEY --project-id PROJ_UUID --version-id VER_UUID \ --model-type ctgan --epochs 300 --num-rows 5000 --seed 42 06 -- Model Monitoring ---------------------- Deploy a model, promote to production, and check for data drift. .. code-block:: bash python 06_model_monitoring.py --base-url https://your-domain.com \ --api-key YOUR_KEY --project-id PROJ_UUID --model-id MODEL_UUID 07 -- What-If Analysis ---------------------- Create a studio session with baseline inputs, define counterfactual scenarios, run predictions, and compare results side by side. .. code-block:: bash python 07_what_if_analysis.py --base-url https://your-domain.com \ --api-key YOUR_KEY --project-id PROJ_UUID --deployment-id DEP_UUID 08 -- Report Generation ----------------------- Generate experiment and deployment reports with AI insights, wait for PDF generation, and download the results. .. code-block:: bash python 08_reports.py --base-url https://your-domain.com \ --api-key YOUR_KEY --project-id PROJ_UUID \ --experiment-id EXP_UUID --output-dir ./reports Running the Examples -------------------- All examples follow the same pattern: 1. Install the SDK: .. code-block:: bash pip install coreplexml 2. Set your API key and server URL. You can pass them as arguments or export them as environment variables and modify the scripts to read from ``os.environ``. 3. Run the script: .. code-block:: bash python 01_quickstart.py --base-url https://ml.example.com --api-key cp_ab12cd34.your-secret-key --csv train.csv 4. Each script prints progress to stdout and exits with code 0 on success or 1 on error.