Spaces:
Sleeping
Sleeping
Download src/entity/__init__.py from Sai-sathwik/MLOPS_LIFECYCLE: direct link, hf CLI and curl.
- Browser
- Download file 2.91 kB
-
https://huggingface.co/spaces/Sai-sathwik/MLOPS_LIFECYCLE/resolve/main/src/entity/__init__.py
- Command line
-
hf download hf://spaces/Sai-sathwik/MLOPS_LIFECYCLE/src/entity/__init__.py
-
curl -L -o __init__.py https://huggingface.co/spaces/Sai-sathwik/MLOPS_LIFECYCLE/resolve/main/src/entity/__init__.py
2.91 kB
| """Data entity classes for the MLOps platform.""" | |
| from dataclasses import dataclass, field | |
| from datetime import datetime | |
| from pathlib import Path | |
| from typing import Any, Dict, List, Optional | |
| class DataIngestionConfig: | |
| """Configuration for data ingestion.""" | |
| source_path: Path | |
| raw_data_path: Path | |
| processed_data_path: Path | |
| test_size: float = 0.2 | |
| random_state: int = 42 | |
| class DataValidationConfig: | |
| """Configuration for data validation.""" | |
| schema_path: Path | |
| report_path: Path | |
| drift_threshold: float = 0.05 | |
| class DataTransformationConfig: | |
| """Configuration for data transformation.""" | |
| preprocessor_path: Path | |
| target_column: str = "target" | |
| numeric_imputer: str = "median" | |
| categorical_imputer: str = "most_frequent" | |
| scaler: str = "standard" | |
| encoder: str = "onehot" | |
| class ModelTrainerConfig: | |
| """Configuration for model training.""" | |
| model_dir: Path | |
| experiment_name: str | |
| test_size: float = 0.2 | |
| cv_folds: int = 5 | |
| random_state: int = 42 | |
| n_jobs: int = -1 | |
| class ModelEvaluationConfig: | |
| """Configuration for model evaluation.""" | |
| metrics_path: Path | |
| plots_path: Path | |
| threshold: float = 0.5 | |
| class ModelRegistryConfig: | |
| """Configuration for model registry.""" | |
| tracking_uri: str | |
| experiment_name: str | |
| model_name: str | |
| class DatasetInfo: | |
| """Information about a loaded dataset.""" | |
| name: str | |
| rows: int | |
| columns: int | |
| missing_values: int | |
| duplicates: int | |
| numeric_features: List[str] | |
| categorical_features: List[str] | |
| target_column: Optional[str] | |
| task_type: Optional[str] # "regression" or "classification" | |
| feature_dtypes: Dict[str, str] = field(default_factory=dict) | |
| missing_per_column: Dict[str, int] = field(default_factory=dict) | |
| created_at: datetime = field(default_factory=datetime.now) | |
| class TrainingResult: | |
| """Result from a single model training run.""" | |
| model_name: str | |
| run_id: str | |
| metrics: Dict[str, float] | |
| params: Dict[str, Any] | |
| training_time: float | |
| model_path: str | |
| feature_importances: Optional[Dict[str, float]] = None | |
| cv_scores: Optional[List[float]] = None | |
| is_best: bool = False | |
| class PredictionResult: | |
| """Result from a prediction request.""" | |
| predictions: List[Any] | |
| probabilities: Optional[List[List[float]]] | |
| model_name: str | |
| model_version: str | |
| inference_time: float | |
| confidence_scores: Optional[List[float]] = None | |
| explanations: Optional[Dict[str, Any]] = None | |
| class ModelInfo: | |
| """Model information for registry.""" | |
| name: str | |
| version: str | |
| stage: str | |
| metrics: Dict[str, float] | |
| params: Dict[str, Any] | |
| tags: Dict[str, str] | |
| created_at: datetime | |
| run_id: str | |
| artifact_uri: str | |
| description: Optional[str] = None | |