LogoLogo
sigopt.comLog In / Sign Up
  • Welcome to SigOpt!
    • SigOpt API Modules
    • Main Concepts
      • Define and Set Up Parameter Space
      • Define and Set Up Metric Space
      • Alternative Experiment Types
  • Advanced Experimentation
    • Multimetric Optimization
    • Metric Thresholds
    • Metric Constraints
    • Metric Failure
    • All Constraints Experiment
    • Multisolution
    • Parallelism
    • Parameter Constraints
    • Prior Beliefs
    • Multitask Experiments
  • Core Module API References
    • Installation and Setup
    • Quick Start
    • API Topics
      • API Tokens and Authentication
      • API Errors
      • Manage Open Suggestions
      • Metadata
      • Pagination
    • API Endpoints
      • Client Detail
      • Experiment Best Assignments
      • Experiment Create
      • Experiment Delete
      • Experiment Detail
      • Experiment Metric Importances
      • Experiment Stopping Criteria
      • Experiment Update
      • Observation Create
      • Observation Batch Create
      • Observation Delete
      • Observation Detail
      • Observation List Delete
      • Observation List
      • Observation Update
      • Queued Suggestion Create
      • Queued Suggestion Delete
      • Queued Suggestion Detail
      • Queued Suggestion List
      • Suggestion Create
      • Suggestion Delete
      • Suggestion Detail
      • Suggestion List Delete
      • Suggestion List
      • Experiment Token Create
      • Organization Detail
      • Suggestion Update
    • API Objects
      • Assignments Object
      • Best Assignments Object
      • Bounds Object
      • Categorical Value Object
      • Client Object
      • Conditional Object
      • Conditions Object
      • Constraint Term Object
      • Experiment Object
      • Metadata Object
      • Metric Object
      • Metric Evaluation Object
      • Metric Importances Object
      • Observation Object
      • Organization Object
      • Pagination Object
      • Parameter Object
      • Parameter Constraint Object
      • Plan Object
      • Plan Period Object
      • Plan Rules Object
      • Prior Object
      • Progress Object
      • Queued Suggestion Object
      • Stopping Criteria Object
      • Suggestion Object
      • Token Object
  • AI MODULE API REFERENCES
    • Installation and Setup
    • Quick Start Tutorials
      • Run Tutorial
      • Project Tutorial
      • AI Experiment and Optimization Tutorial
    • Tracking Your Training Runs
      • Set Up for Example Code
      • Record SigOpt Runs in Jupyter
      • Record SigOpt Runs with Python IDE and SigOpt CLI
      • Record SigOpt Runs with Python IDE
      • View and Analyze the Recorded SigOpt Run
      • Enable Optimization for your SigOpt Runs
    • AI Experiments
      • AI Experiment Set Up
    • Bring Your Own Optimizer
    • XGBoost Integration
      • Installation
      • Tracking XGBoost Training
      • Tuning XGBoost Models
    • HyperOpt
      • Installation
      • User Case
      • API
    • SigOpt Orchestrate
      • Install SigOpt Orchestrate
      • Orchestrate a Tracked Training Run
      • Orchestrate an AI Experiment
      • AWS Cluster Create and Manage
      • SigOpt: Bring Your Own Cluster
      • Dockerfile: Define Your Environment
      • Debugging
      • CLI Reference
    • API Reference
      • Manually create a SigOpt Run
      • Tracking a Run
      • AI Experiment Client Calls
      • Project Client Calls
      • Objects
        • Training Run Object
        • AI Experiment Object
        • Parameter Object
        • Metric Object
      • SigOpt CLI Commands
      • Orchestrate CLI Commands
  • Support
    • Support
    • FAQ
    • Best Practices
      • Setting an experiment budget
      • Reproducibility in SigOpt
      • Uploading data as a Training Run artifact
      • Navigating multiple metrics
Powered by GitBook
On this page
  1. AI MODULE API REFERENCES
  2. API Reference

Manually create a SigOpt Run

If the CLI or Jupyter Notebook integration isn't right for your use case then you might want to create Runs and AI Experiments directly with the SigOpt Python Client. To create a Run, just add the following to your code:

run = sigopt.create_run()

With this Run object you can get and set parameter values and log attributes in a similar way as you would when using the CLI:

run.params.learning_rate = 0.1
accuracy = train_my_model(learning_rate=run.params.learning_rate)
run.log_metric("accuracy", accuracy)

Finally, end the Run:

run.end()

For convenience, you can use a Python context manager to end the Run automatically, including when your code raises an exception:

with sigopt.create_run() as run:
    run.params.learning_rate = 0.1
    accuracy = train_my_model(learning_rate=sigopt.params.learning_rate)
    run.log_metric("accuracy", accuracy)

When using an instance of a Run, all client calls can be applied to the instance as seen above.

PreviousAPI ReferenceNextTracking a Run

Last updated 2 years ago