code: def test_non_train_params_are_frozen_after_first_train():
      aml = H2OAutoML(
          max_models=2,
          nfolds=3,
          seed=42,
          keep_cross_validation_predictions=True,
      )
      ds = import_dataset()
      aml.train(
          y=ds.target,
          training_frame=ds.train,
          validation_frame=ds.valid,
      )
      assert (
          aml.leaderboard.nrows
          == aml.max_models
          + aml.leaderboard["model_id"].grep("StackedEnsemble").sum()
      )
      assert aml.leaderboard.columns[1] == "auc"
  
      try:
          aml.nfolds = 0
          assert False, "should have raised"
      except H2OValueError as e:
          assert (
              "Param ``nfolds`` can not be modified after the first call to ``train``."
              == str(e)
          )
          assert aml.nfolds == 3
  
      try:
          aml.seed = 24
          assert False, "should have raised"
      except H2OValueError as e:
          assert (
              "Param ``seed`` can not be modified after the first call to ``train``."
              == str(e)
          )
          assert aml.seed == 42
  
      assert aml.sort_metric == "AUTO"
      aml.sort_metric = "logloss"
      aml.train(
          y=ds.target,
          training_frame=ds.train,
          validation_frame=ds.valid,
      )
      print(aml.leaderboard)
      assert (
          aml.leaderboard.nrows
          == aml.max_models * 2
          + aml.leaderboard["model_id"].grep("StackedEnsemble").sum()
      )
      assert aml.leaderboard.columns[1] == "logloss"
  
file_path: h2o-3/h2o-py/tests/testdir_algos/automl/pyunit_automl_params_attributes.py
imports: import os
  import sys
  from h2o.exceptions import H2OValueError
  from h2o.automl import H2OAutoML
  from tests import pyunit_utils
  from _automl_utils import import_dataset
label_desc: Use image node_id 3 for calling a global function with example usage: test_non_train_params_are_frozen_after_first_train() without return types