Connect and Manage an Exist Experiment

1. Connect Experiment

[1]:
from nni.experiment import Experiment
experiment = Experiment.connect(8080)
[2021-03-05 12:18:28] Connect to port 8080 success, experiment id is DH8pVfXc, status is RUNNING.

2. Experiment View & Control

[2]:
experiment.get_experiment_profile()
[2]:
{'id': 'DH8pVfXc',
 'revision': 4,
 'execDuration': 10,
 'logDir': '/home/ningshang/nni-experiments/DH8pVfXc',
 'nextSequenceId': 1,
 'params': {'authorName': 'default',
  'experimentName': 'example_sklearn-classification',
  'trialConcurrency': 1,
  'maxExecDuration': 3600,
  'maxTrialNum': 100,
  'searchSpace': '{"C": {"_type": "uniform", "_value": [0.1, 1]}, "kernel": {"_type": "choice", "_value": ["linear", "rbf", "poly", "sigmoid"]}, "degree": {"_type": "choice", "_value": [1, 2, 3, 4]}, "gamma": {"_type": "uniform", "_value": [0.01, 0.1]}, "coef0": {"_type": "uniform", "_value": [0.01, 0.1]}}',
  'trainingServicePlatform': 'local',
  'tuner': {'builtinTunerName': 'TPE',
   'classArgs': {'optimize_mode': 'maximize'},
   'checkpointDir': '/home/ningshang/nni-experiments/DH8pVfXc/checkpoint'},
  'versionCheck': True,
  'clusterMetaData': [{'key': 'trial_config',
    'value': {'command': 'python3 main.py',
     'codeDir': '/home/ningshang/nni/examples/trials/sklearn/classification/.',
     'gpuNum': 0}}]},
 'startTime': 1614946699989}
[3]:
experiment.update_max_trial_number(200)
[2021-03-05 12:18:32] (root) Successfully update maxTrialNum.
[4]:
experiment.get_experiment_profile()
[4]:
{'id': 'DH8pVfXc',
 'revision': 5,
 'execDuration': 14,
 'logDir': '/home/ningshang/nni-experiments/DH8pVfXc',
 'nextSequenceId': 1,
 'params': {'authorName': 'default',
  'experimentName': 'example_sklearn-classification',
  'trialConcurrency': 1,
  'maxExecDuration': 3600,
  'maxTrialNum': 200,
  'searchSpace': '{"C": {"_type": "uniform", "_value": [0.1, 1]}, "kernel": {"_type": "choice", "_value": ["linear", "rbf", "poly", "sigmoid"]}, "degree": {"_type": "choice", "_value": [1, 2, 3, 4]}, "gamma": {"_type": "uniform", "_value": [0.01, 0.1]}, "coef0": {"_type": "uniform", "_value": [0.01, 0.1]}}',
  'trainingServicePlatform': 'local',
  'tuner': {'builtinTunerName': 'TPE',
   'classArgs': {'optimize_mode': 'maximize'},
   'checkpointDir': '/home/ningshang/nni-experiments/DH8pVfXc/checkpoint'},
  'versionCheck': True,
  'clusterMetaData': [{'key': 'trial_config',
    'value': {'command': 'python3 main.py',
     'codeDir': '/home/ningshang/nni/examples/trials/sklearn/classification/.',
     'gpuNum': 0}}]},
 'startTime': 1614946699989}

3. Stop Experiment

[5]:
experiment.stop()
[2021-03-05 12:18:36] Stopping experiment, please wait...
[2021-03-05 12:18:38] Experiment stopped