Close Menu
    Facebook X (Twitter) Instagram
    Articles Stock
    • Home
    • Technology
    • AI
    • Pages
      • About ArticlesStock — AI & Technology Journalist
      • Contact us
      • Disclaimer For Articles Stock
      • Privacy Policy
      • Terms and Conditions
    Facebook X (Twitter) Instagram
    Articles Stock
    AI

    Easy methods to Construct an Finish-to-Finish Manufacturing Grade Machine Studying Pipeline with ZenML, Together with Customized Materializers, Metadata Monitoring, and Hyperparameter Optimization

    Naveed AhmadBy Naveed Ahmad05/05/2026Updated:05/05/2026No Comments1 Min Read
    blog 1 3


    @step(enable_cache=True)
    def load_data() -> Annotated[DatasetBundle, "raw_dataset"]:
       information = load_breast_cancer()
       return DatasetBundle(
           information.information, information.goal, information.feature_names,
           stats={"supply": "sklearn.datasets.load_breast_cancer"},
       )
    
    
    @step
    def split_and_scale(
       bundle: DatasetBundle,
       test_size: float = 0.2,
       random_state: int = 42,
    ) -> Tuple[
       Annotated[np.ndarray, "X_train"],
       Annotated[np.ndarray, "X_test"],
       Annotated[np.ndarray, "y_train"],
       Annotated[np.ndarray, "y_test"],
    ]:
       X_tr, X_te, y_tr, y_te = train_test_split(
           bundle.X, bundle.y, test_size=test_size,
           random_state=random_state, stratify=bundle.y,
       )
       scaler = StandardScaler().match(X_tr)
       X_tr, X_te = scaler.rework(X_tr), scaler.rework(X_te)
       log_metadata(metadata={"train_size": len(X_tr), "test_size": len(X_te)})
       return X_tr, X_te, y_tr, y_te
    
    
    @step
    def train_candidate(
       X_train: np.ndarray,
       y_train: np.ndarray,
       model_type: str = "random_forest",
       n_estimators: int = 100,
       max_depth: int = 5,
    ) -> Annotated[Any, "candidate_model"]:
       if model_type == "random_forest":
           m = RandomForestClassifier(n_estimators=n_estimators,
                                      max_depth=max_depth, random_state=42)
       elif model_type == "gradient_boosting":
           m = GradientBoostingClassifier(n_estimators=n_estimators,
                                          max_depth=max_depth, random_state=42)
       else:
           m = LogisticRegression(max_iter=2000, random_state=42)
       m.match(X_train, y_train)
       log_metadata(metadata={
           "model_type": model_type,
           "hyperparameters": {"n_estimators": n_estimators, "max_depth": max_depth},
       })
       return m



    Source link

    Naveed Ahmad

    Naveed Ahmad is a technology journalist and AI writer at ArticlesStock, covering artificial intelligence, machine learning, and emerging tech policy. Read his latest articles.

    Related Posts

    US authorities warns of extreme CopyFail bug affecting main variations of Linux

    05/05/2026

    Hackers are mass-exploiting the cPanel bug to realize management of hundreds of internet sites

    05/05/2026

    Katie Haun raises $1B for brand spanking new enterprise funds

    05/05/2026
    Leave A Reply Cancel Reply

    Categories
    • AI
    Recent Comments
      Facebook X (Twitter) Instagram Pinterest
      © 2026 ThemeSphere. Designed by ThemeSphere.

      Type above and press Enter to search. Press Esc to cancel.