docstr: Creates a SGD classifier based on a configuration and evaluates it on the
  digits dataset using cross-validation.
docstr_tok: ["Creates","a","SGD","classifier","based","on","a","configuration","and","evaluates","it","on","the","digits","dataset","using","cross-validation","."]
code: def train(
      self,
      config: Configuration,
      instance: str = "0-1",
      budget: float = 1,
      seed: int = 0,
  ) -> float:
      """Creates a SGD classifier based on a configuration and evaluates it on the
      digits dataset using cross-validation."""
  
      with warnings.catch_warnings():
          warnings.filterwarnings("ignore")
  
          # SGD classifier using given configuration
          clf = SGDClassifier(
              loss="log_loss",
              penalty="elasticnet",
              alpha=config["alpha"],
              l1_ratio=config["l1_ratio"],
              learning_rate=config["learning_rate"],
              eta0=config["eta0"],
              max_iter=budget,
              early_stopping=True,
              random_state=seed,
          )
  
          # Get instance
          data, target = self.dataset.get_instance_data(instance)
  
          cv = StratifiedKFold(
              n_splits=4, random_state=seed, shuffle=True
          )  # to make CV splits consistent
          scores = cross_val_score(clf, data, target, cv=cv)
  
      return 1 - np.mean(scores)
  
file_path: SMAC3/tests/fixtures/models.py
imports: from __future__ import annotations
  import warnings
  import numpy
  import pytest
  from ConfigSpace import Categorical, Configuration, ConfigurationSpace, Float
  from sklearn.linear_model import SGDClassifier
  from sklearn.model_selection import StratifiedKFold, cross_val_score
label_desc: Use image node_id 3 for calling the SGD obj's underlying member method code with example usage: obj.train(config, instance, budget, seed) and returns: unknown