{"id":87647,"date":"2025-02-14T12:05:32","date_gmt":"2025-02-14T12:05:32","guid":{"rendered":"https:\/\/peraltafinancing.com\/analytics\/machine-predictive-maintenance-with-mlops\/"},"modified":"2025-02-14T12:05:32","modified_gmt":"2025-02-14T12:05:32","slug":"machine-predictive-maintenance-with-mlops","status":"publish","type":"post","link":"https:\/\/fivemor.com\/?p=87647","title":{"rendered":"Machine Predictive Maintenance with MLOps"},"content":{"rendered":"<p> <br \/>\n<\/p>\n<div id=\"article-start\">\n<p>Machines don\u2019t break down out of nowhere\u2014there are always signs. The problem? Humans aren\u2019t always great at noticing them. That\u2019s where Machine Predictive Maintenance comes in! This guide will take you through the exciting world of Machine Predictive Maintenance, using AWS and <a href=\"https:\/\/www.analyticsvidhya.com\/blog\/2022\/03\/a-comprehensive-guide-on-mlops-for-machine-learning-engineering\/\" target=\"_blank\" rel=\"noreferrer noopener\">MLOps <\/a>to ensure your equipment stays predictably reliable.<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-learning-objectives\">Learning Objectives<\/h3>\n<ul class=\"wp-block-list\">\n<li>Understand how to design and implement an end-to-end MLOps pipeline for predictive maintenance, covering data ingestion, model training, and deployment.<\/li>\n<li>Learn to integrate essential tools like Docker, FastAPI, and AWS services to build a robust, production-ready machine learning application.<\/li>\n<li>Explore the use of GitHub Actions for automating<a href=\"https:\/\/www.analyticsvidhya.com\/blog\/2022\/08\/setting-up-ci-cd-using-github-actions\/#:~:text=Various%20Stages%20of%20the%20CI,application%20in%20our%20GitHub%20repository.\" target=\"_blank\" rel=\"noreferrer noopener\"> CI\/CD workflows<\/a>, ensuring smooth and reliable code integration and deployment.<\/li>\n<li>Set up best practices for monitoring, performance tracking, and continuous improvement to keep your machine learning models efficient and maintainable.<\/li>\n<\/ul>\n<p><em><strong>This article was published as a part of the\u00a0<\/strong><\/em><a href=\"https:\/\/www.analyticsvidhya.com\/datahack\/blogathon\" target=\"_blank\" rel=\"noreferrer noopener\"><em><strong>Data Science Blogathon.<\/strong><\/em><\/a><\/p>\n<h2 class=\"wp-block-heading\" id=\"h-problem-unplanned-downtime-amp-maintenance-costs\">Problem: Unplanned Downtime &amp; Maintenance Costs<\/h2>\n<p>Unexpected equipment failures in industrial settings cause downtime and financial losses. In our project, we are using MLOps best practices and machine learning to detect issues early, enabling timely repairs and reducing disruptions.<\/p>\n<p>Before diving into implementation, let\u2019s take a closer look at the project architecture.<\/p>\n<figure class=\"wp-block-image size-full is-resized figure  mt-2 mb-2 d-table mx-auto\"><img fetchpriority=\"high\" decoding=\"async\" width=\"960\" height=\"540\" src=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/machine_Predictive_Maintenance.webp\" alt=\"machine_Predictive_Maintenance\" class=\"wp-image-221099\" style=\"width:585px;height:auto\" srcset=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/machine_Predictive_Maintenance.webp 960w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/machine_Predictive_Maintenance-300x169.webp 300w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/machine_Predictive_Maintenance-768x432.webp 768w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/machine_Predictive_Maintenance-150x84.webp 150w\" sizes=\"(max-width: 960px) 100vw, 960px\"\/><\/figure>\n<h2 class=\"wp-block-heading\" id=\"h-necessary-prerequisites\">Necessary Prerequisites<\/h2>\n<p>Below we will first look in the prerequisites required:<\/p>\n<p><strong>Clone the repository<\/strong>:<\/p>\n<pre class=\"wp-block-code\"><code>git clone \"https:\/\/github.com\/karthikponna\/Predictive_Maintenance_MLOps.git\"\ncd Predictive_Maintenance_MLOps<\/code><\/pre>\n<p><strong>Create and activate the virtual environment<\/strong>:<\/p>\n<pre class=\"wp-block-code\"><code># For macOS and Linux:\npython3 -m venv venv\nsource venv\/bin\/activate\n\n# For Windows:\npython -m venv venv\n.\\venv\\Scripts\\activate<\/code><\/pre>\n<p><strong>Install Required Dependencies<\/strong>:<\/p>\n<pre class=\"wp-block-code\"><code>pip install -r requirements.txt<\/code><\/pre>\n<p><strong>Set Up Environment Variables:<\/strong><\/p>\n<pre class=\"wp-block-code\"><code># Create a `.env` file and add your MongoDB connection string:\nMONGO_URI=your_mongodb_connection_string<\/code><\/pre>\n<h2 class=\"wp-block-heading\" id=\"h-project-structure\">Project Structure<\/h2>\n<p>The Project Structure outlines the key components and organization of the project, ensuring clarity and maintainability. It helps in understanding how different modules interact and how the overall system is designed. A well-defined structure simplifies development, debugging, and scalability.<\/p>\n<pre class=\"wp-block-code\"><code>project_root\/\n\u2502\n\u251c\u2500\u2500 .github\/\n\u2502   \u2514\u2500\u2500 workflows\/\n\u2502       \u2514\u2500\u2500 main.yml\n\u2502\n\u251c\u2500\u2500 data_schema\/\n\u2502   \u2514\u2500\u2500 schema.yaml\n\u2502\n\u251c\u2500\u2500 final_model\/\n\u2502   \u251c\u2500\u2500 model.pkl\n\u2502   \u2514\u2500\u2500 preprocessor.pkl\n\u2502\n\u251c\u2500\u2500 Machine_Predictive_Data\/\n\u2502   \u2514\u2500\u2500 predictive_maintenance.csv\n\u2502\n\u251c\u2500\u2500 machine_predictive_maintenance\/\n\u2502   \u251c\u2500\u2500 cloud\/\n\u2502   \u251c\u2500\u2500 components\/\n\u2502   \u251c\u2500\u2500 constant\/\n\u2502   \u251c\u2500\u2500 entity\/\n\u2502   \u251c\u2500\u2500 exception\/\n\u2502   \u251c\u2500\u2500 logging\/\n\u2502   \u251c\u2500\u2500 pipeline\/\n\u2502   \u251c\u2500\u2500 utils\/\n\u2502   \u2514\u2500\u2500 __init__.py\n\u2502\n\u251c\u2500\u2500 my_venv\/\n\u2502\n\u251c\u2500\u2500 notebooks\/\n\u2502   \u251c\u2500\u2500 EDA.ipynb\n\u2502   \u251c\u2500\u2500 prediction_output\/\n\u2502\n\u251c\u2500\u2500 templates\/\n\u2502   \u2514\u2500\u2500 table.html\n\u2502\n\u251c\u2500\u2500 valid_data\/\n|    \u2514\u2500\u2500test.csv\n\u2502\n\u251c\u2500\u2500 .env\n\u251c\u2500\u2500 .gitignore\n\u251c\u2500\u2500 app.py\n\u251c\u2500\u2500 Dockerfile\n\u251c\u2500\u2500 main.py\n\u251c\u2500\u2500 push_data.py\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 requirements.txt\n\u251c\u2500\u2500 setup.py\n\u251c\u2500\u2500 test_mongodb.py<\/code><\/pre>\n<h2 class=\"wp-block-heading\" id=\"h-data-ingestion\">Data Ingestion<\/h2>\n<p>In this project, we use a machine predictive maintenance CSV file, converting it into JSON records, and inserting it into a MongoDB collection.\u00a0<\/p>\n<p>Dataset Link: <a href=\"https:\/\/www.kaggle.com\/datasets\/shivamb\/machine-predictive-maintenance-classification\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/www.kaggle.com\/datasets\/shivamb\/machine-predictive-maintenance-classification<\/a><\/p>\n<p>Here is the code snippet to convert CSV -&gt; JSON records -&gt; MongoDB<\/p>\n<pre class=\"wp-block-code\"><code>class PredictiveDataExtract():\n\n    def __init__(self):\n        \"\"\"\n        Initializes the PredictiveDataExtract class.\n        \"\"\"\n        try:\n            pass\n        except Exception as e:\n            raise MachinePredictiveMaintenanceException(e, sys)\n        \n    def csv_to_json_convertor(self, file_path):\n        try:\n            data = pd.read_csv(file_path)\n            data.reset_index(drop=True, inplace=True)\n            records = list(json.loads(data.T.to_json()).values())\n            return records\n        except Exception as e:\n            raise MachinePredictiveMaintenanceException(e, sys)\n        \n    def insert_data_mongodb(self, records, database, collection):\n        try:\n            self.records = records\n            self.database = database\n            self.collection = collection\n\n            self.mongo_client = pymongo.MongoClient(MONGO_DB_URL)\n            self.database = self.mongo_client[self.database]\n            \n            self.collection = self.database[self.collection]\n            self.collection.insert_many(self.records)\n            return(len(self.records))\n        except Exception as e:\n            raise MachinePredictiveMaintenanceException(e, sys)\n        \nif __name__==\"__main__\":\n    FILE_PATH=\"Machine_Predictive_Data\/predictive_maintenance.csv\"\n    DATABASE=\"Predictive_Maintenance_MLOps\"\n    collection = \"Machine_Predictive_Data\"\n\n    predictive_data_obj=PredictiveDataExtract()\n    records = predictive_data_obj.csv_to_json_convertor(FILE_PATH)\n    no_of_records = predictive_data_obj.insert_data_mongodb(records, DATABASE, collection)\n    print(no_of_records)<\/code><\/pre>\n<p>Here is the code snippet to fetch data from MongoDB, split the data into train and test CSV files, and store them as a Data Ingestion artifact.<\/p>\n<pre class=\"wp-block-code\"><code>class DataIngestion:\n    def __init__(self, data_ingestion_config:DataIngestionConfig):\n\n        \"\"\"\n        Initializes the DataIngestion class with the provided configuration.\n\n        Parameters:\n            data_ingestion_config: DataIngestionConfig\n                Configuration object containing details for data ingestion.\n        \"\"\"\n        try:\n            self.data_ingestion_config=data_ingestion_config\n        except Exception as e:\n            raise MachinePredictiveMaintenanceException(e, sys)\n        \n    def export_collection_as_dataframe(self):\n        try:\n            database_name= self.data_ingestion_config.database_name\n            collection_name= self.data_ingestion_config.collection_name\n            self.mongo_client = pymongo.MongoClient(MONGO_DB_URL)\n            collection = self.mongo_client[database_name][collection_name]\n            df = pd.DataFrame(list(collection.find()))\n            if \"_id\" in df.columns.to_list():\n                df = df.drop(columns=[\"_id\"], axis=1)\n            df.replace({\"na\":np.nan},inplace=True)\n            return df\n        except Exception as e:\n            raise MachinePredictiveMaintenanceException(e, sys)\n\n    def export_data_into_feature_store(self,dataframe: pd.DataFrame):\n        try:\n            feature_store_file_path=self.data_ingestion_config.feature_store_file_path\n            #creating folder\n            dir_path = os.path.dirname(feature_store_file_path)\n            os.makedirs(dir_path,exist_ok=True)\n            dataframe.to_csv(feature_store_file_path,index=False,header=True)\n            return dataframe\n        except Exception as e:\n            raise MachinePredictiveMaintenanceException(e,sys)\n\n    def split_data_as_train_test(self, dataframe:pd.DataFrame):        \n        try:\n            train_set, test_set = train_test_split(\n                dataframe, test_size=self.data_ingestion_config.train_test_split_ratio\n            )\n            logging.info(\"Performed train test split on the dataframe\")\n            logging.info(\n                \"Exited split_data_as_train_test method of Data_Ingestion class\"\n            )\n            dir_path = os.path.dirname(self.data_ingestion_config.training_file_path)\n            os.makedirs(dir_path, exist_ok=True)\n            logging.info(f\"Exporting train and test file path.\")\n            train_set.to_csv(\n                self.data_ingestion_config.training_file_path, index=False, header=True\n            )\n            test_set.to_csv(\n                self.data_ingestion_config.testing_file_path, index=False, header=True\n                            )\n            logging.info(f\"Exported train and test file path.\"  )\n        except Exception as e:\n            raise MachinePredictiveMaintenanceException(e, sys)\n\n    def initiate_data_ingestion(self):\n        try:\n            dataframe = self.export_collection_as_dataframe()\n            dataframe = self.export_data_into_feature_store(dataframe)\n            self.split_data_as_train_test(dataframe)\n            dataingestionartifact= DataIngestionArtifact(trained_file_path=self.data_ingestion_config.training_file_path,\n                                                         test_file_path=self.data_ingestion_config.testing_file_path)\n            return dataingestionartifact\n        except Exception as e:\n            raise MachinePredictiveMaintenanceException(e,sys)<\/code><\/pre>\n<h2 class=\"wp-block-heading\" id=\"h-data-validation\">Data Validation<\/h2>\n<p>In this step, we\u2019ll check if the ingested data meets the expected format by ensuring all required columns are present using a predefined schema and comparing the training and testing data for any differences. Then we save the clean data and create a drift report, so only quality data is used for the next step, which is transforming the data.\u00a0<\/p>\n<p>Data Validation code snippet:<\/p>\n<pre class=\"wp-block-code\"><code>class DataValidation:\n\n    def __init__(self, data_ingestion_artifact:DataIngestionArtifact,\n                 data_validation_config: DataValidationConfig):\n        try:\n            self.data_ingestion_artifact= data_ingestion_artifact\n            self.data_validation_config= data_validation_config\n            self._schema_config = read_yaml_file(SCHEMA_FILE_PATH)\n        except Exception as e:\n            raise MachinePredictiveMaintenanceException(e, sys)\n        \n    @staticmethod\n    def read_data(file_path) -&gt; pd.DataFrame:\n        try:\n            return pd.read_csv(file_path)\n        except Exception as e:\n            raise MachinePredictiveMaintenanceException(e, sys) \n\n    \n    def validate_number_of_columns(self, dataframe:pd.DataFrame)-&gt; bool:\n        try:\n            number_of_columns = len(self._schema_config)\n            logging.info(f\"Required number of columns:{number_of_columns}\")\n            logging.info(f\"Data frame has columns:{len(dataframe.columns)}\")\n\n            if len(dataframe.columns) == number_of_columns: \n                return True\n            return False\n        except Exception as e:\n            raise MachinePredictiveMaintenanceException (e, sys)\n        \n\n    def is_columns_exist(self, df:pd.DataFrame) -&gt; bool:\n        try:\n            dataframe_columns = df.columns\n            missing_numerical_columns = []\n            missing_categorical_columns = []\n\n            for column in self._schema_config[\"numerical_columns\"]:\n                if column not in dataframe_columns:\n                    missing_numerical_columns.append(column)\n\n            if len(missing_numerical_columns) &gt; 0:\n                logging.info(f\"Missing numerical column: {missing_numerical_columns}\")\n\n            for column in self._schema_config[\"categorical_columns\"]:\n                if column not in dataframe_columns:\n                    missing_categorical_columns.append(column)\n\n            if len(missing_categorical_columns) &gt; 0:\n                logging.info(f\"Missing categorical column: {missing_categorical_columns}\")\n            return False if len(missing_categorical_columns)&gt;0 or len(missing_numerical_columns)&gt;0 else True\n            \n        except Exception as e:\n            raise MachinePredictiveMaintenanceException(e, sys)\n\n    \n    def detect_dataset_drift(self, base_df, current_df, threshold = 0.05) -&gt; bool :\n        try:\n            status = True\n            report = {}\n            for column in base_df.columns:\n                d1 = base_df[column]\n                d2 = current_df[column]\n\n                is_same_dist = ks_2samp(d1, d2)\n                if threshold  DataValidationArtifact:\n        try:\n            validation_error_msg  = \"\"\n            logging.info(\"Starting data validation\")\n\n            train_file_path = self.data_ingestion_artifact.trained_file_path\n            test_file_path = self.data_ingestion_artifact.test_file_path\n\n            # read the data from the train and test \n            train_dataframe = DataValidation.read_data(train_file_path)\n            test_dataframe = DataValidation.read_data(test_file_path)\n\n            # validate number of columns\n            status = self.validate_number_of_columns(dataframe=train_dataframe)\n            logging.info(f\"All required columns present in training dataframe: {status}\")\n\n            if not status:\n                validation_error_msg += f\"Train dataframe does not contain all columns.\\n\"\n\n            status = self.validate_number_of_columns(dataframe=test_dataframe)\n\n            if not status:\n                validation_error_msg += f\"Test dataframe does not contain all columns.\\n\"\n\n            status = self.is_columns_exist(df=train_dataframe)\n\n            if not status:\n                validation_error_msg += f\"Columns are missing in training dataframe.\"\n\n            status = self.is_columns_exist(df=test_dataframe)\n\n            if not status:\n                validation_error_msg += f\"columns are missing in test dataframe.\"\n            ## lets check datadrift\n            status=self.detect_dataset_drift(base_df=train_dataframe,current_df=test_dataframe)\n            dir_path=os.path.dirname(self.data_validation_config.valid_train_file_path)\n            os.makedirs(dir_path,exist_ok=True)\n\n            train_dataframe.to_csv(\n                self.data_validation_config.valid_train_file_path, index=False, header=True\n\n            )\n            test_dataframe.to_csv(\n                self.data_validation_config.valid_test_file_path, index=False, header=True\n            )\n\n            data_validation_artifact = DataValidationArtifact(\n                validation_status=status,\n                valid_train_file_path=self.data_validation_config.valid_train_file_path,\n                valid_test_file_path=self.data_validation_config.valid_test_file_path,\n                invalid_train_file_path=None,\n                invalid_test_file_path=None,\n                drift_report_file_path=self.data_validation_config.drift_report_file_path,\n            )\n            return data_validation_artifact\n        except Exception as e:\n            raise MachinePredictiveMaintenanceException(e,sys)<\/code><\/pre>\n<p>Below is the drift report generated by the Data Validation.<\/p>\n<pre class=\"wp-block-code\"><code>Air temperature [K]:\n  drift_status: true\n  p_value: 0.016622943467175914\nFailure Type:\n  drift_status: false\n  p_value: 1.0\nProcess temperature [K]:\n  drift_status: false\n  p_value: 0.052940072765804994\nProduct ID:\n  drift_status: false\n  p_value: 0.09120557172716418\nRotational speed [rpm]:\n  drift_status: false\n  p_value: 0.2673520066245566\nTarget:\n  drift_status: false\n  p_value: 0.999999998717466\nTool wear [min]:\n  drift_status: false\n  p_value: 0.13090856779628832\nTorque [Nm]:\n  drift_status: false\n  p_value: 0.5001773464540389\nType:\n  drift_status: false\n  p_value: 1.0\nUDI:\n  drift_status: true\n  p_value: 0.022542489133976953<\/code><\/pre>\n<h2 class=\"wp-block-heading\" id=\"h-data-transformation\">Data Transformation<\/h2>\n<p>Here, we will clean and transform the validated data by converting temperature features from Kelvin to Celsius, dropping unnecessary columns, and applying a transformation pipeline that uses ordinal encoding and Min-Max scaling, and handling data imbalance using SMOTEENN.<\/p>\n<p>The transformed training and test datasets are saved as <b>.npy files<\/b> along with a serialized preprocessing object i.e. Minmax scaler(<b>preprocessing.pkl<\/b>) all encapsulated as an artifact for further model training.<\/p>\n<pre class=\"wp-block-code\"><code>class DataTransformation:\n\n    def __init__(self,data_validation_artifact: DataValidationArtifact,\n                 data_transformation_config: DataTransformationConfig):\n        try:\n            self.data_validation_artifact: DataValidationArtifact = data_validation_artifact\n            self.data_transformation_config: DataTransformationConfig = data_transformation_config\n            self._schema_config = read_yaml_file(file_path=SCHEMA_FILE_PATH)\n        except Exception as e:\n            raise MachinePredictiveMaintenanceException(e,sys)\n        \n    @staticmethod\n    def read_data(file_path) -&gt; pd.DataFrame:\n        try:\n            return pd.read_csv(file_path)\n        except Exception as e:\n            raise MachinePredictiveMaintenanceException(e, sys)\n        \n    def get_data_transformer_object(self):\n        try:\n            logging.info(\"Got numerical cols from schema config\")\n            \n            scaler = MinMaxScaler()\n            # Fetching categories for OrdinalEncoder from schema config\n            ordinal_categories = self._schema_config.get('ordinal_categories', [])\n            ordinal_encoder = OrdinalEncoder(categories=ordinal_categories)\n\n            logging.info(\"Initialized MinMaxScaler, OrdinalEncoder with categories\")\n\n            ordinal_columns = self._schema_config['ordinal_columns']\n            scaling_features = self._schema_config['scaling_features']\n            preprocessor = ColumnTransformer(\n                [\n                    (\"Ordinal_Encoder\", ordinal_encoder, ordinal_columns),\n                    (\"MinMaxScaling\", scaler, scaling_features)\n                ]\n            )\n            logging.info(\"Created preprocessor object from ColumnTransformer\")\n            return preprocessor\n        except Exception as e:\n            raise MachinePredictiveMaintenanceException(e, sys)\n        \n    def initiate_data_transformation(self) -&gt; DataTransformationArtifact:\n        try:\n            \n            logging.info(\"Starting data transformation\")\n            preprocessor = self.get_data_transformer_object()\n            train_df = DataTransformation.read_data(self.data_validation_artifact.valid_train_file_path)\n            test_df = DataTransformation.read_data(self.data_validation_artifact.valid_test_file_path)\n            input_feature_train_df = train_df.drop(columns=[TARGET_COLUMN], axis=1)\n            target_feature_train_df = train_df[TARGET_COLUMN]\n\n            input_feature_train_df['Air temperature [c]'] = input_feature_train_df['Air temperature [K]'] - 273.15\n            input_feature_train_df['Process temperature [c]'] = input_feature_train_df['Process temperature [K]'] - 273.15\n            drop_cols = self._schema_config['drop_columns']\n\n            input_feature_train_df = drop_columns(df=input_feature_train_df, cols = drop_cols)\n            logging.info(\"Completed dropping the columns for Training dataset\")\n            input_feature_test_df = test_df.drop(columns=[TARGET_COLUMN], axis=1)\n            target_feature_test_df = test_df[TARGET_COLUMN]\n\n            input_feature_test_df['Air temperature [c]'] = input_feature_test_df['Air temperature [K]'] - 273.15\n            input_feature_test_df['Process temperature [c]'] = input_feature_test_df['Process temperature [K]'] - 273.15\n            drop_cols = self._schema_config['drop_columns']\n            input_feature_test_df = drop_columns(df=input_feature_test_df, cols = drop_cols)\n\n            logging.info(\"Completed dropping the columns for Testing dataset\")\n            input_feature_train_arr = preprocessor.fit_transform(input_feature_train_df)\n            input_feature_test_arr = preprocessor.transform(input_feature_test_df)\n            \n            smt =  SMOTEENN(sampling_strategy=\"minority\")\n            input_feature_train_final, target_feature_train_final = smt.fit_resample(\n                input_feature_train_arr, target_feature_train_df\n            )\n            logging.info(\"Applied SMOTEENN on training dataset\")\n\n            input_feature_test_final, target_feature_test_final = smt.fit_resample(\n                input_feature_test_arr, target_feature_test_df\n            )\n            train_arr = np.c_[\n                input_feature_train_final, np.array(target_feature_train_final)\n            ]\n            test_arr = np.c_[\n                input_feature_test_final, np.array(target_feature_test_final)\n            ]\n            save_numpy_array_data(self.data_transformation_config.transformed_train_file_path, array=train_arr, )\n            save_numpy_array_data(self.data_transformation_config.transformed_test_file_path,array=test_arr,)\n            save_object( self.data_transformation_config.transformed_object_file_path, preprocessor,)\n\n            save_object( \"final_model\/preprocessor.pkl\", preprocessor,)\n\n            data_transformation_artifact=DataTransformationArtifact(\n                transformed_object_file_path=self.data_transformation_config.transformed_object_file_path,\n                transformed_train_file_path=self.data_transformation_config.transformed_train_file_path,\n                transformed_test_file_path=self.data_transformation_config.transformed_test_file_path\n            )\n            return data_transformation_artifact\n        except Exception as e:\n            raise MachinePredictiveMaintenanceException(e, sys)<\/code><\/pre>\n<h2 class=\"wp-block-heading\" id=\"h-training-and-evaluation\">Training and Evaluation<\/h2>\n<p>Now we will train different classification models on the transformed training data like Decision Tree,\u00a0Random Forest,\u00a0Gradient Boosting,\u00a0Logistic Regression, and AdaBoost models and evaluate their performance using evaluation metrics like f1-score, precision, and recall, and then log these details with <a href=\"https:\/\/www.analyticsvidhya.com\/blog\/2021\/07\/machine-learning-workflow-using-mlflow-a-beginners-guide\/\" target=\"_blank\" rel=\"noopener\">MLflow<\/a>.<\/p>\n<p>After selecting the best model, it saves both the model and transformation object locally to artifact and evaluation metrics to use it for deployment.<\/p>\n<pre class=\"wp-block-code\"><code>class ModelTrainer:\n    def __init__(self, data_transformation_artifact: DataTransformationArtifact, model_trainer_config: ModelTrainerConfig):\n        try:\n            self.data_transformation_artifact = data_transformation_artifact\n            self.model_trainer_config = model_trainer_config\n\n        except Exception as e:\n            raise MachinePredictiveMaintenanceException(e, sys)\n        \n    def track_mlflow(self, best_model, classification_metric, input_example):\n        \"\"\"\n        Log model and metrics to MLflow.\n\n        Args:\n            best_model: The trained model object.\n            classification_metric: The classification metrics (f1, precision, recall).\n            input_example: An example input data sample for the model.\n        \"\"\"\n        try:\n            with mlflow.start_run():\n                f1_score=classification_metric.f1_score\n                precision_score=classification_metric.precision_score\n                recall_score=classification_metric.recall_score\n\n                mlflow.log_metric(\"f1_score\",f1_score)\n                mlflow.log_metric(\"precision\",precision_score)\n                mlflow.log_metric(\"recall_score\",recall_score)\n                mlflow.sklearn.log_model(best_model,\"model\", input_example=input_example)\n        except Exception as e:\n            raise MachinePredictiveMaintenanceException(e, sys)\n    \n    def train_model(self, X_train, y_train, X_test, y_test ):\n        \"\"\"\n        Train multiple models and select the best-performing one based on evaluation metrics.\n\n        Args:\n            X_train: Training features.\n            y_train: Training labels.\n            X_test: Testing features.\n            y_test: Testing labels.\n\n        Returns:\n            ModelTrainerArtifact: An artifact containing details about the trained model and its metrics.\n        \"\"\"\n        models = {\n                \"Random Forest\": RandomForestClassifier(verbose=1),\n                \"Decision Tree\": DecisionTreeClassifier(),\n                \"Gradient Boosting\": GradientBoostingClassifier(verbose=1),\n                \"Logistic Regression\": LogisticRegression(verbose=1),\n                \"AdaBoost\": AdaBoostClassifier(),\n            }\n        params={\n            \"Decision Tree\": {\n                'criterion':['gini', 'entropy', 'log_loss'],\n                # 'splitter':['best','random'],\n                # 'max_features':['sqrt','log2'],\n            },\n            \"Random Forest\":{\n                # 'criterion':['gini', 'entropy', 'log_loss'],\n                \n                # 'max_features':['sqrt','log2',None],\n                'n_estimators': [8,16,32,128,256]\n            },\n            \"Gradient Boosting\":{\n                # 'loss':['log_loss', 'exponential'],\n                'learning_rate':[.1,.01,.05,.001],\n                'subsample':[0.6,0.7,0.75,0.85,0.9],\n                # 'criterion':['squared_error', 'friedman_mse'],\n                # 'max_features':['auto','sqrt','log2'],\n                'n_estimators': [8,16,32,64,128,256]\n            },\n            \"Logistic Regression\":{},\n            \"AdaBoost\":{\n                'learning_rate':[.1,.01,.001],\n                'n_estimators': [8,16,32,64,128,256]\n            }\n            \n        }\n        model_report: dict = evaluate_models(X_train=X_train, y_train=y_train, X_test=X_test, y_test=y_test,\n                                             models=models, param=params)\n        best_model_score = max(sorted(model_report.values()))\n        logging.info(f\"Best Model Score: {best_model_score}\")\n        best_model_name = list(model_report.keys())[\n            list(model_report.values()).index(best_model_score)\n        ]\n        logging.info(f\"Best Model Name: {best_model_name}\")\n        best_model = models[best_model_name]\n\n        y_train_pred = best_model.predict(X_train)\n        classification_train_metric = get_classification_score(y_true=y_train, y_pred=y_train_pred)\n\n        input_example = X_train[:1]\n        print(input_example)\n        # Track the experiments with mlflow\n        self.track_mlflow(best_model, classification_train_metric, input_example)\n\n\n        y_test_pred=best_model.predict(X_test)\n        classification_test_metric = get_classification_score(y_true=y_test, y_pred=y_test_pred)\n\n        # Track the experiments with mlflow\n        self.track_mlflow(best_model, classification_test_metric, input_example)\n\n\n        preprocessor = load_object(file_path=self.data_transformation_artifact.transformed_object_file_path)\n\n\n        model_dir_path = os.path.dirname(self.model_trainer_config.trained_model_file_path)\n        os.makedirs(model_dir_path,exist_ok=True)\n\n        Machine_Predictive_Model = MachinePredictiveModel(model=best_model)\n\n        save_object(self.model_trainer_config.trained_model_file_path,obj=MachinePredictiveModel)\n\n        save_object(\"final_model\/model.pkl\",best_model)\n\n        ## Model Trainer Artifact\n        model_trainer_artifact=ModelTrainerArtifact(trained_model_file_path=self.model_trainer_config.trained_model_file_path,\n                             train_metric_artifact=classification_train_metric,\n                             test_metric_artifact=classification_test_metric\n                             )\n        logging.info(f\"Model trainer artifact: {model_trainer_artifact}\")\n        return model_trainer_artifact\n\n    def initiate_model_trainer(self) -&gt; ModelTrainerArtifact:\n\n        try:\n            train_file_path = self.data_transformation_artifact.transformed_train_file_path\n            test_file_path = self.data_transformation_artifact.transformed_test_file_path\n\n            #loading training array and testing array\n            train_arr = load_numpy_array_data(train_file_path)\n            test_arr = load_numpy_array_data(test_file_path)\n\n            X_train, y_train, X_test, y_test = (\n                train_arr[:, :-1],\n                train_arr[:, -1],\n                test_arr[:, :-1],\n                test_arr[:, -1],\n            )\n\n            model_trainer_artifact=self.train_model(X_train,y_train,X_test,y_test)\n            return model_trainer_artifact\n            \n        except Exception as e:\n            raise MachinePredictiveMaintenanceException(e, sys)<\/code><\/pre>\n<p>Now, let\u2019s create a <b>training_pipeline.py<\/b> file where we sequentially integrate all the steps of data ingestion, validation, transformation, and model training into a complete pipeline.<\/p>\n<pre class=\"wp-block-code\"><code>def run_pipeline(self):\n\n        \"\"\"\n        Executes the entire training pipeline.\n\n        Returns:\n            ModelTrainerArtifact: Contains metadata about the trained model.\n        \"\"\"\n        try:\n            data_ingestion_artifact= self.data_ingestion()\n            data_validation_artifact= self.data_validation(data_ingestion_artifact=data_ingestion_artifact)\n            data_transformation_artifact= self.data_transformation(data_validation_artifact=data_validation_artifact)\n            model_trainer_artifact= self.model_trainer(data_transformation_artifact=data_transformation_artifact)\n            self.sync_artifact_dir_to_s3()\n            self.sync_saved_model_dir_to_s3()\n            \n            return model_trainer_artifact\n        except Exception as e:\n            raise MachinePredictiveMaintenanceException(e,sys)<\/code><\/pre>\n<p>You can visually see how we have built the <a href=\"https:\/\/github.com\/karthikponna\/Predictive_Maintenance_MLOps\/blob\/main\/assets\/training_pipeline.gif\" target=\"_blank\" rel=\"nofollow noopener\">training_pipeline<\/a>.<\/p>\n<figure class=\"wp-block-image size-full is-resized figure  mt-2 mb-2 d-table mx-auto\"><img loading=\"lazy\" decoding=\"async\" width=\"960\" height=\"540\" src=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/training_pipeline.webp\" alt=\"training_pipeline\" class=\"wp-image-221101\" style=\"width:700px;height:auto\" srcset=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/training_pipeline.webp 960w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/training_pipeline-300x169.webp 300w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/training_pipeline-768x432.webp 768w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/training_pipeline-150x84.webp 150w\" sizes=\"auto, (max-width: 960px) 100vw, 960px\"\/><\/figure>\n<p>Now that we\u2019ve completed creating the pipeline, run the training_pipeline.py file to view the artifacts generated in the previous steps.<\/p>\n<pre class=\"wp-block-code\"><code>python training_pipeline.py<\/code><\/pre>\n<p>Run the following command to view the MLflow dashboard.<\/p>\n<pre class=\"wp-block-code\"><code>mlflow ui  # Launch the MLflow dashboard to monitor experiments.<\/code><\/pre>\n<p>As you can see, we have successfully logged model metrics like recall, precision, and F1-score in MLflow.<\/p>\n<figure class=\"wp-block-image size-full is-resized figure  mt-2 mb-2 d-table mx-auto\"><img loading=\"lazy\" decoding=\"async\" width=\"1895\" height=\"869\" src=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/mlflow_pwrlSun.webp\" alt=\"ML log in\" class=\"wp-image-221103\" style=\"width:770px;height:auto\" srcset=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/mlflow_pwrlSun.webp 1895w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/mlflow_pwrlSun-300x138.webp 300w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/mlflow_pwrlSun-768x352.webp 768w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/mlflow_pwrlSun-1536x704.webp 1536w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/mlflow_pwrlSun-150x69.webp 150w\" sizes=\"auto, (max-width: 1895px) 100vw, 1895px\"\/><\/figure>\n<h2 class=\"wp-block-heading\" id=\"h-aws-integration\">AWS Integration<\/h2>\n<p>After running the training_pipeline.py file, we generated artifacts and stored them locally. Now, we will store these artifacts in an AWS S3 bucket to enable cloud-based storage and accessibility.<\/p>\n<p>Using a Docker image, we will push it to AWS ECR via GitHub Actions and then deploy it to production using AWS EC2. We will discuss this process in more detail in the upcoming sections.<\/p>\n<figure class=\"wp-block-image size-full figure  mt-2 mb-2 d-table mx-auto\"><img loading=\"lazy\" decoding=\"async\" width=\"1585\" height=\"410\" src=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/AWS-Integration.webp\" alt=\"AWS Integration\" class=\"wp-image-221104\" srcset=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/AWS-Integration.webp 1585w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/AWS-Integration-300x78.webp 300w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/AWS-Integration-768x199.webp 768w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/AWS-Integration-1536x397.webp 1536w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/AWS-Integration-150x39.webp 150w\" sizes=\"auto, (max-width: 1585px) 100vw, 1585px\"\/><\/figure>\n<h2 class=\"wp-block-heading\" id=\"h-aws-s3\">AWS S3<\/h2>\n<p>Follow these steps to create an AWS S3 bucket:<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-step1-download-aws-cli\">Step1: Download AWS CLI<\/h3>\n<ul class=\"wp-block-list\">\n<li>You can click <a href=\"https:\/\/docs.aws.amazon.com\/cli\/latest\/userguide\/getting-started-install.html\" rel=\"nofollow\">here<\/a> to download AWS CLI for Windows, Linux, and macOS<\/li>\n<\/ul>\n<h3 class=\"wp-block-heading\" id=\"h-step2-log-in-to-aws-iam-user\">Step2:\u00a0Log in to AWS IAM User<\/h3>\n<ul class=\"wp-block-list\">\n<li>You can sign in to the <a href=\"https:\/\/aws.amazon.com\/console\/\" rel=\"nofollow\">Console<\/a> with your IAM user credentials and select the appropriate AWS region (eg., us-east-1).<\/li>\n<li>Once logged in, search for \u2018IAM\u2019 in the AWS search bar. Navigate to \u2018Users,\u2019 select your username, and go to the \u2018Security Credentials\u2019 tab. Under \u2018Access Keys,\u2019 click \u2018Create access key,\u2019 choose \u2018CLI,\u2019 and then confirm by clicking \u2018Create access key\u2019.<\/li>\n<li>Now, open your terminal and type aws configure. Enter your AWS Access Key and Secret Access Key when prompted, then press Enter.<\/li>\n<\/ul>\n<p>Your IAM user has been successfully connected to your project.<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-step3-navigate-to-s3-service\">Step3: Navigate to S3 Service<\/h3>\n<ul class=\"wp-block-list\">\n<li>Once logged in, search for \u201cS3\u201d in the AWS search bar.<\/li>\n<li>Click on Amazon S3 service and select the \u201cCreate bucket\u201d button. Next, type in a unique bucket name (eg., machinepredictive)<\/li>\n<li>Review the configuration settings, and then click on \u201cCreate bucket.\u201d<\/li>\n<\/ul>\n<p>Your bucket is now created, and you can start uploading artifacts. Now, add the following code to your training_pipeline.py file and run it again to see the artifacts in your AWS S3 bucket.<\/p>\n<pre class=\"wp-block-code\"><code>    def sync_artifact_dir_to_s3(self):\n\n        \"\"\"\n        Syncs the artifact directory to S3.\n        \"\"\"\n        try:\n\n            aws_bucket_url = f\"s3:\/\/{TRAINING_BUCKET_NAME}\/artifact\/{self.training_pipeline_config.timestamp}\"\n            self.s3_sync.sync_folder_to_s3(folder = self.training_pipeline_config.artifact_dir,aws_bucket_url=aws_bucket_url)\n\n        except Exception as e:\n            raise MachinePredictiveMaintenanceException(e,sys)\n        \n    def sync_saved_model_dir_to_s3(self):\n\n        \"\"\"\n        Syncs the saved model directory to S3.\n        \"\"\"\n\n        try:\n            aws_bucket_url = f\"s3:\/\/{TRAINING_BUCKET_NAME}\/final_model\/{self.training_pipeline_config.timestamp}\"\n            self.s3_sync.sync_folder_to_s3(folder = self.training_pipeline_config.model_dir,aws_bucket_url=aws_bucket_url)\n        except Exception as e:\n            raise MachinePredictiveMaintenanceException(e,sys)<\/code><\/pre>\n<figure class=\"wp-block-image size-full figure  mt-2 mb-2 d-table mx-auto\"><img loading=\"lazy\" decoding=\"async\" width=\"1894\" height=\"828\" src=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/aws_s3_bucket.webp\" alt=\"aws_s3_bucket\" class=\"wp-image-221107\" srcset=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/aws_s3_bucket.webp 1894w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/aws_s3_bucket-300x131.webp 300w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/aws_s3_bucket-768x336.webp 768w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/aws_s3_bucket-1536x671.webp 1536w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/aws_s3_bucket-150x66.webp 150w\" sizes=\"auto, (max-width: 1894px) 100vw, 1894px\"\/><\/figure>\n<h2 class=\"wp-block-heading\" id=\"h-amazon-elastic-container-registry-ecr\">Amazon Elastic Container Registry (ECR)<\/h2>\n<p>Follow these steps to create an ECR repository.<\/p>\n<ul class=\"wp-block-list\">\n<li>Search for \u2018ECR\u2019 in the AWS search bar.<\/li>\n<li>Click Create Repository, and select Private Repository.<\/li>\n<li>Provide a repository name (e.g., machinepredictive) and click Create.<\/li>\n<\/ul>\n<figure class=\"wp-block-image size-full figure  mt-2 mb-2 d-table mx-auto\"><img loading=\"lazy\" decoding=\"async\" width=\"1897\" height=\"444\" src=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/Amazon-Elastic-Container-Registry-ECR.webp\" alt=\"Amazon Elastic Container Registry (ECR)\" class=\"wp-image-221108\" srcset=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/Amazon-Elastic-Container-Registry-ECR.webp 1897w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/Amazon-Elastic-Container-Registry-ECR-300x70.webp 300w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/Amazon-Elastic-Container-Registry-ECR-768x180.webp 768w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/Amazon-Elastic-Container-Registry-ECR-1536x360.webp 1536w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/Amazon-Elastic-Container-Registry-ECR-150x35.webp 150w\" sizes=\"auto, (max-width: 1897px) 100vw, 1897px\"\/><\/figure>\n<p>Copy the URI from your ECR repository, which should look something like \u201c<b>788614365622.dkr.ecr.ap-southeast-2.amazonaws.com<\/b>\u201c, and save it somewhere. We will need it later to paste into GitHub Secrets.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-docker-integration-for-deployment\">Docker Integration for Deployment<\/h2>\n<p>Dockerizing our project ensures it runs smoothly in any environment without dependency issues. It\u2019s a must-have tool for packaging and sharing applications effortlessly.<\/p>\n<p>Keeping the Docker image as small as possible is important for efficiency. We can minimize its size by using techniques like multi-staging and choosing a lightweight Python base image.<\/p>\n<pre class=\"wp-block-code\"><code>FROM python:3.10-slim-buster\nWORKDIR \/app\nCOPY . \/app\n\nRUN apt update -y &amp;&amp; apt install awscli -y\n\nRUN apt-get update &amp;&amp; pip install -r requirements.txt\nCMD [\"python3\", \"app.py\"]<\/code><\/pre>\n<h2 class=\"wp-block-heading\" id=\"h-setup-action-secrets-and-variables-nbsp\">Setup Action Secrets and Variables\u00a0<\/h2>\n<p>To securely store sensitive information like AWS credentials and repository URIs, we need to set up GitHub Action Secrets in our repository. Follow these steps:<\/p>\n<h4 class=\"wp-block-heading\" id=\"h-step1-open-your-github-repository\">Step1: Open Your GitHub Repository<\/h4>\n<p>Navigate to your repository on GitHub.<\/p>\n<h4 class=\"wp-block-heading\" id=\"h-step2-go-to-settings\">Step2:\u00a0Go to Settings<\/h4>\n<p>At the top of your repository page, locate and click on the \u201cSettings\u201d tab.<\/p>\n<h4 class=\"wp-block-heading\" id=\"h-step3-access-secrets-and-variables\">Step3: Access Secrets and Variables<\/h4>\n<p>In the left sidebar, scroll down to Secrets and Variables \u2192 Select Actions.<\/p>\n<h4 class=\"wp-block-heading\" id=\"h-step4-create-a-new-secret\">Step4:\u00a0Create a New Secret<\/h4>\n<p>Click the New repository secret button.<\/p>\n<h4 class=\"wp-block-heading\" id=\"h-step5-add-aws-credentials\">Step5:\u00a0Add AWS Credentials<\/h4>\n<ul class=\"wp-block-list\">\n<li>Create a secret with the name \u201cAWS_ACCESS_KEY_ID\u201d and paste your AWS Access Key.<\/li>\n<li>Create another secret named AWS_SECRET_ACCESS_KEY and paste your AWS Secret Access Key.<\/li>\n<li>create a secret named \u201cAWS_REGION\u201d and paste your selected region (eg., us-east-1).<\/li>\n<\/ul>\n<h4 class=\"wp-block-heading\" id=\"h-step6-add-aws-ecr-repository-uri\">Step6:\u00a0Add AWS ECR Repository URI<\/h4>\n<ul class=\"wp-block-list\">\n<li>Copy your ECR repository URI (e.g., 788614365622.dkr.ecr.ap-southeast-2.amazonaws.com).<\/li>\n<li>Create a new secret named \u201cAWS_ECR_LOGIN_URI\u201d and paste the copied URI.<\/li>\n<li>Create a new secret named \u201cECR_REPOSITORY_NAME\u201d and paste the name of the ECR repository e.g., machinepredictive).<\/li>\n<\/ul>\n<figure class=\"wp-block-image size-full is-resized figure  mt-2 mb-2 d-table mx-auto\"><img loading=\"lazy\" decoding=\"async\" width=\"1176\" height=\"832\" src=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/Screenshot_2025-02-09_194621.webp\" alt=\"\" class=\"wp-image-221111\" style=\"width:725px;height:auto\" srcset=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/Screenshot_2025-02-09_194621.webp 1176w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/Screenshot_2025-02-09_194621-300x212.webp 300w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/Screenshot_2025-02-09_194621-768x543.webp 768w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/Screenshot_2025-02-09_194621-150x106.webp 150w\" sizes=\"auto, (max-width: 1176px) 100vw, 1176px\"\/><\/figure>\n<h2 class=\"wp-block-heading\" id=\"h-aws-ec2-nbsp\">AWS EC2\u00a0<\/h2>\n<p>Now let\u2019s understand how to create an instance with AWS EC2. Follow these steps.<\/p>\n<ul class=\"wp-block-list\">\n<li>Navigate to the EC2 service in the AWS Management Console and click Launch an instance.<\/li>\n<li>Name your instance (e.g., machinepredictive) and select Ubuntu as your operating system.<\/li>\n<li>Choose the instance type as t2.large.<\/li>\n<li>Select your default key pair.<\/li>\n<li>Under network security, choose the default VPC and configure the security groups as needed.<\/li>\n<li>Finally, click Launch Instance.<\/li>\n<\/ul>\n<h3 class=\"wp-block-heading\" id=\"h-aws-ec2-cli\">AWS EC2 CLI<\/h3>\n<p>After creating the instance named machinepredictive, select its Instance ID and click Connect. Then, under EC2 Instance Connect, click Connect again. This will open an AWS CLI interface where you can run the necessary commands.<\/p>\n<p>Now, enter these commands in the CLI one by one to set up Docker on your EC2 instance:<\/p>\n<pre class=\"wp-block-code\"><code>sudo apt-get update -y\nsudo apt-get upgrade\ncurl -fsSL https:\/\/get.docker.com -o get-docker.sh\nsudo sh get-docker.sh\nsudo usermod -aG docker ubuntu\nnewgrp docker<\/code><\/pre>\n<p>Keep your CLI session open. Next, navigate to your GitHub repository, click on Settings, then go to the Actions section, and under Runners, click New self-hosted runner. Choose the Linux runner image. Now, run the following commands one by one in your CLI to download and configure your self-hosted runner:<\/p>\n<pre class=\"wp-block-code\"><code># Create a folder and navigate into it\nmkdir actions-runner &amp;&amp; cd actions-runner\n\n# Download the latest runner package\ncurl -o actions-runner-linux-x64-2.322.0.tar.gz -L https:\/\/github.com\/actions\/runner\/releases\/download\/v2.322.0\/actions-runner-linux-x64-2.322.0.tar.gz\n\n# Optional: Validate the hash\necho \"b13b784808359f31bc79b08a191f5f83757852957dd8fe3dbfcc38202ccf5768  actions-runner-linux-x64-2.322.0.tar.gz\" | shasum -a 256 -c\n\n# Extract the installer\ntar xzf .\/actions-runner-linux-x64-2.322.0.tar.gz\n\n# Configure the runner\n.\/config.sh --url https:\/\/github.com\/karthikponna\/Predictive_Maintenance_MLOps --token \"Paste your token here\"\n\n# Run the runner\n.\/run.sh<\/code><\/pre>\n<p>This will download, configure, and start your self-hosted GitHub Actions runner on your EC2 instance.<\/p>\n<p>After setting up the self-hosted GitHub Actions runner, the CLI will prompt you to enter a name for the runner. Type self-hosted and press Enter. <\/p>\n<h2 class=\"wp-block-heading\" id=\"h-ci-cd-with-github-actions\">CI\/CD with GitHub Actions<\/h2>\n<p>You can check out the <b>.github\/workflows\/main.yml<\/b> <a href=\"https:\/\/github.com\/karthikponna\/Predictive_Maintenance_MLOps\/blob\/main\/.github\/workflows\/main.yml\" target=\"_blank\" rel=\"nofollow noopener\">code<\/a>\u00a0file.<\/p>\n<p>Now, let\u2019s dive into what each section of this main.yml file does.<\/p>\n<ul class=\"wp-block-list\">\n<li><b>Continuous Integration Job<\/b>: This job runs on an Ubuntu runner to check out the code, lint it, and execute unit tests.<\/li>\n<li><b>Continuous Delivery Job<\/b>: Triggered after CI, this job installs utilities, configures AWS credentials, logs into Amazon ECR, and builds, tags, and pushes your Docker image to ECR.<\/li>\n<li><b>Continuous Deployment Job<\/b>: Running on a self-hosted runner, this job pulls the latest Docker image from ECR, runs it as a container to serve users, and cleans up any previous images or containers.<\/li>\n<\/ul>\n<figure class=\"wp-block-image size-full figure mt-2 mb-2 d-table mx-auto\"><img loading=\"lazy\" decoding=\"async\" width=\"1893\" height=\"687\" src=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/GitHub-Actions.webp\" alt=\"GitHub Actions\" class=\"wp-image-221112\" srcset=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/GitHub-Actions.webp 1893w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/GitHub-Actions-300x109.webp 300w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/GitHub-Actions-768x279.webp 768w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/GitHub-Actions-1536x557.webp 1536w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/GitHub-Actions-150x54.webp 150w\" sizes=\"auto, (max-width: 1893px) 100vw, 1893px\"\/><\/figure>\n<p>Once the Continuous Deployment Job completes successfully, you\u2019ll see an output like this in the AWS CLI.<\/p>\n<figure class=\"wp-block-image size-full figure  mt-2 mb-2 d-table mx-auto\"><img loading=\"lazy\" decoding=\"async\" width=\"1906\" height=\"785\" src=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/aws_ec2_cli_1.webp\" alt=\"aws_ec2_cli_1\" class=\"wp-image-221113\" srcset=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/aws_ec2_cli_1.webp 1906w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/aws_ec2_cli_1-300x124.webp 300w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/aws_ec2_cli_1-768x316.webp 768w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/aws_ec2_cli_1-1536x633.webp 1536w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/aws_ec2_cli_1-150x62.webp 150w\" sizes=\"auto, (max-width: 1906px) 100vw, 1906px\"\/><\/figure>\n<p>Open your AWS EC2 instance by clicking its Instance ID. Verify that the instance state is Running and locate the Public IPv4 DNS. Click on the \u201cOpen address\u201d option to automatically launch your FastAPI application in your browser. Now, let\u2019s dive into FastAPI.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-fastapi\">FastAPI<\/h2>\n<p>You can check out the <b>app.py<\/b> <a href=\"https:\/\/github.com\/karthikponna\/Predictive_Maintenance_MLOps\/blob\/main\/app.py\" target=\"_blank\" rel=\"nofollow noopener\">file<\/a>.\u00a0<\/p>\n<p>In this FastAPI application, I\u2019ve created two main routes, one for training the model and another for generating predictions. Let\u2019s explore each route in detail.\u00a0\u00a0<\/p>\n<figure class=\"wp-block-image size-full figure mt-2 mb-2 d-table mx-auto\"><img loading=\"lazy\" decoding=\"async\" width=\"1898\" height=\"749\" src=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/fast_api_interface.webp\" alt=\"FastAPI\" class=\"wp-image-221114\" srcset=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/fast_api_interface.webp 1898w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/fast_api_interface-300x118.webp 300w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/fast_api_interface-768x303.webp 768w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/fast_api_interface-1536x606.webp 1536w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/02\/fast_api_interface-150x59.webp 150w\" sizes=\"auto, (max-width: 1898px) 100vw, 1898px\"\/><\/figure>\n<h3 class=\"wp-block-heading\" id=\"h-train-route\">Train route<\/h3>\n<p>The \/train endpoint starts the model training process using a predefined dataset, making it easy to update and improve the model with new data.\u00a0It is especially useful for retraining the model to improve accuracy or incorporate new data, ensuring the model remains up-to-date and performs optimally.<\/p>\n<figure class=\"wp-block-image figure mt-2 mb-2 d-table mx-auto\"><img decoding=\"async\" src=\"https:\/\/av-eks-lekhak.s3.amazonaws.com\/media\/article_images\/train_route.png\" alt=\" \/train route\"\/><\/figure>\n<h4 class=\"wp-block-heading\" id=\"h-predict-route\">Predict route<\/h4>\n<p>The \/predict endpoint accepts a CSV file via POST. This endpoint handles incoming data, leverages the trained model to generate predictions, and then returns the outcomes formatted as JSON.\u00a0This route is perfect for applying the model to new datasets, making it efficient for large-scale prediction tasks.<\/p>\n<p>In the \/predict route, we\u2019ve included a sample test.csv file; you can download it <a href=\"https:\/\/github.com\/karthikponna\/Predictive_Maintenance_MLOps\/blob\/main\/valid_data\/test.csv\" target=\"_blank\" rel=\"nofollow noopener\">here<\/a>.<\/p>\n<figure class=\"wp-block-image figure mt-2 mb-2 d-table mx-auto\"><img decoding=\"async\" src=\"https:\/\/av-eks-lekhak.s3.amazonaws.com\/media\/article_images\/predict_route.png\" alt=\" \/predict route\"\/><figcaption class=\"wp-element-caption\">\/predict route<\/figcaption><\/figure>\n<h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2>\n<p>Together, we built a full production-ready Predictive Maintenance MLOps project\u2014from gathering and preprocessing data to training, evaluating, and deploying our model using Docker, AWS, and FastAPI. This project shows how MLOps can bridge the gap between development and production, making it easier to build robust, scalable solutions.<\/p>\n<p>Remember, this guide is all about learning and applying these techniques to your data science projects. Don\u2019t hesitate to experiment, innovate, and explore new enhancements as you progress. Thank you for sticking with me until the end\u2014keep learning, keep doing, and keep growing!<\/p>\n<p><b>GitHub repo:\u00a0<\/b><a href=\"https:\/\/github.com\/karthikponna\/Predictive_Maintenance_MLOps\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/github.com\/karthikponna\/Predictive_Maintenance_MLOps<\/a><\/p>\n<h3 class=\"wp-block-heading\" id=\"h-key-takeaways\">Key Takeaways<\/h3>\n<ul class=\"wp-block-list\">\n<li>We built an end-to-end MLOps pipeline that covers data ingestion, model training, and deployment.<\/li>\n<li>Docker, AWS, and FastAPI work together seamlessly to move from development to production.<\/li>\n<li>Dockerizing our ML project is key\u2014it ensures it runs smoothly in any environment without any dependency headaches.<\/li>\n<li>Continuous deployment ensures the model stays efficient and up-to-date in real-world applications.<\/li>\n<\/ul>\n<h2 class=\"wp-block-heading\" id=\"h-frequently-asked-questions\">Frequently Asked Questions<\/h2>\n<div class=\"schema-faq wp-block-yoast-faq-block\">\n<div class=\"schema-faq-section\" id=\"faq-question-1739343060762\"><strong class=\"schema-faq-question\">Q1. Why do we use Docker in this project?<\/strong> <\/p>\n<p class=\"schema-faq-answer\">A.\u00a0Docker ensures our ML project runs smoothly in any environment by eliminating dependency issues.<\/p>\n<\/p><\/div>\n<div class=\"schema-faq-section\" id=\"faq-question-1739343117868\"><strong class=\"schema-faq-question\">Q2. How does AWS help with this project?<\/strong> <\/p>\n<p class=\"schema-faq-answer\">A. AWS services like EC2, S3, and ECR enable seamless deployment, storage, and scaling of our application.<\/p>\n<\/p><\/div>\n<div class=\"schema-faq-section\" id=\"faq-question-1739343144774\"><strong class=\"schema-faq-question\">Q3. What is MLflow used for?<\/strong> <\/p>\n<p class=\"schema-faq-answer\">A. MLflow makes machine learning development easier by offering tools for tracking experiments, versioning models, and deploying them.<\/p>\n<\/p><\/div>\n<div class=\"schema-faq-section\" id=\"faq-question-1739343158387\"><strong class=\"schema-faq-question\">Q4.\u00a0What is the role of GitHub Actions in this project?<\/strong> <\/p>\n<p class=\"schema-faq-answer\">A.\u00a0GitHub Actions automates the CI\/CD process\u2014running tests, building Docker images, and deploying updates\u2014ensuring a smooth transition from development to production.<\/p>\n<\/p><\/div>\n<\/p><\/div>\n<p><strong>The media shown in this article is not owned by Analytics Vidhya and is used at the Author\u2019s discretion.<\/strong><\/p>\n<div class=\"border-top py-3 author-info my-4\">\n<div class=\"author-card d-flex align-items-center\">\n<div class=\"flex-shrink-0 overflow-hidden\">\n                                    <a href=\"https:\/\/www.analyticsvidhya.com\/blog\/author\/karthik3852845\/\" class=\"text-decoration-none active-avatar\"><br \/>\n                                                                       <img decoding=\"async\" src=\"https:\/\/av-eks-lekhak.s3.amazonaws.com\/media\/lekhak-profile-images\/converted_image_3tjdORM.webp\" width=\"48\" height=\"48\" alt=\"Karthik Ponna\" loading=\"lazy\" class=\"rounded-circle\"\/><\/p>\n<p>                                <\/a>\n                                <\/div>\n<\/p><\/div>\n<p>Hi! I&#8217;m Karthik Ponna, a Machine Learning Engineer at Antern. I&#8217;m deeply passionate about exploring the fields of AI and Data Science, as they constantly evolve and shape the future. I believe writing blogs is a great way to not only enhance my skills and solidify my understanding but also to share my knowledge and insights with others in the community. This helps me connect with like-minded individuals who share a curiosity for technology and innovation.<\/p>\n<\/p><\/div>\n<\/p><\/div>\n\n","protected":false},"excerpt":{"rendered":"<p>Machines don\u2019t break down out of nowhere\u2014there are always signs. The problem? Humans aren\u2019t always great at noticing them. That\u2019s where Machine Predictive Maintenance comes in! This guide will take you through the exciting world of Machine Predictive Maintenance, using AWS and MLOps to ensure your equipment stays predictably reliable. Learning Objectives Understand how to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":87648,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12033],"tags":[5815,1952,1649,42904,15731],"dealstore":[],"offerexpiration":[],"class_list":["post-87647","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-analytics","tag-blogathon","tag-machine","tag-maintenance","tag-mlops","tag-predictive"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Machine Predictive Maintenance with MLOps - Som2ny Network<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/fivemor.com\/?p=87647\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Machine Predictive Maintenance with MLOps - Som2ny Network\" \/>\n<meta property=\"og:description\" content=\"Machines don\u2019t break down out of nowhere\u2014there are always signs. The problem? Humans aren\u2019t always great at noticing them. That\u2019s where Machine Predictive Maintenance comes in! This guide will take you through the exciting world of Machine Predictive Maintenance, using AWS and MLOps to ensure your equipment stays predictably reliable. Learning Objectives Understand how to [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fivemor.com\/?p=87647\" \/>\n<meta property=\"og:site_name\" content=\"Som2ny Network\" \/>\n<meta property=\"article:published_time\" content=\"2025-02-14T12:05:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/Machine-Predictive-Maintenance-with-MLOps-Deployed-on-AWS-.webp.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"872\" \/>\n\t<meta property=\"og:image:height\" content=\"473\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"25 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/fivemor.com\/?p=87647#article\",\"isPartOf\":{\"@id\":\"https:\/\/fivemor.com\/?p=87647\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371\"},\"headline\":\"Machine Predictive Maintenance with MLOps\",\"datePublished\":\"2025-02-14T12:05:32+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/fivemor.com\/?p=87647\"},\"wordCount\":2166,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/fivemor.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/fivemor.com\/?p=87647#primaryimage\"},\"thumbnailUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/Machine-Predictive-Maintenance-with-MLOps-Deployed-on-AWS-.webp.webp\",\"keywords\":[\"Blogathon\",\"Machine\",\"Maintenance\",\"MLOps\",\"Predictive\"],\"articleSection\":[\"Analytics\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/fivemor.com\/?p=87647#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/fivemor.com\/?p=87647\",\"url\":\"https:\/\/fivemor.com\/?p=87647\",\"name\":\"Machine Predictive Maintenance with MLOps - Som2ny Network\",\"isPartOf\":{\"@id\":\"https:\/\/fivemor.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/fivemor.com\/?p=87647#primaryimage\"},\"image\":{\"@id\":\"https:\/\/fivemor.com\/?p=87647#primaryimage\"},\"thumbnailUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/Machine-Predictive-Maintenance-with-MLOps-Deployed-on-AWS-.webp.webp\",\"datePublished\":\"2025-02-14T12:05:32+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/fivemor.com\/?p=87647#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/fivemor.com\/?p=87647\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/fivemor.com\/?p=87647#primaryimage\",\"url\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/Machine-Predictive-Maintenance-with-MLOps-Deployed-on-AWS-.webp.webp\",\"contentUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/Machine-Predictive-Maintenance-with-MLOps-Deployed-on-AWS-.webp.webp\",\"width\":872,\"height\":473},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/fivemor.com\/?p=87647#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/fivemor.com\/?bp_activities=1\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Machine Predictive Maintenance with MLOps\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/fivemor.com\/#website\",\"url\":\"https:\/\/fivemor.com\/\",\"name\":\"Som2ny Network\",\"description\":\"Daily Deals\",\"publisher\":{\"@id\":\"https:\/\/fivemor.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/fivemor.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/fivemor.com\/#organization\",\"name\":\"Som2ny Network\",\"url\":\"https:\/\/fivemor.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/fivemor.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2026\/07\/4a0953c4-logo-300x86-1.png\",\"contentUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2026\/07\/4a0953c4-logo-300x86-1.png\",\"width\":300,\"height\":86,\"caption\":\"Som2ny Network\"},\"image\":{\"@id\":\"https:\/\/fivemor.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/fivemor.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/729ae85bf62b9917e93538db2f2688ca?s=96&r=g&default=https%3A%2F%2Ffivemor.com%2Fwp-content%2Fplugins%2Fbuddypress-first-letter-avatar%2Fimages%2Fdefault%2F96%2Flatin_a.png\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/729ae85bf62b9917e93538db2f2688ca?s=96&r=g&default=https%3A%2F%2Ffivemor.com%2Fwp-content%2Fplugins%2Fbuddypress-first-letter-avatar%2Fimages%2Fdefault%2F96%2Flatin_a.png\",\"caption\":\"admin\"},\"sameAs\":[\"https:\/\/fivemor.com\"],\"url\":\"https:\/\/fivemor.com\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Machine Predictive Maintenance with MLOps - Som2ny Network","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/fivemor.com\/?p=87647","og_locale":"en_US","og_type":"article","og_title":"Machine Predictive Maintenance with MLOps - Som2ny Network","og_description":"Machines don\u2019t break down out of nowhere\u2014there are always signs. The problem? Humans aren\u2019t always great at noticing them. That\u2019s where Machine Predictive Maintenance comes in! This guide will take you through the exciting world of Machine Predictive Maintenance, using AWS and MLOps to ensure your equipment stays predictably reliable. Learning Objectives Understand how to [&hellip;]","og_url":"https:\/\/fivemor.com\/?p=87647","og_site_name":"Som2ny Network","article_published_time":"2025-02-14T12:05:32+00:00","og_image":[{"width":872,"height":473,"url":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/Machine-Predictive-Maintenance-with-MLOps-Deployed-on-AWS-.webp.webp","type":"image\/webp"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin","Est. reading time":"25 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fivemor.com\/?p=87647#article","isPartOf":{"@id":"https:\/\/fivemor.com\/?p=87647"},"author":{"name":"admin","@id":"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371"},"headline":"Machine Predictive Maintenance with MLOps","datePublished":"2025-02-14T12:05:32+00:00","mainEntityOfPage":{"@id":"https:\/\/fivemor.com\/?p=87647"},"wordCount":2166,"commentCount":0,"publisher":{"@id":"https:\/\/fivemor.com\/#organization"},"image":{"@id":"https:\/\/fivemor.com\/?p=87647#primaryimage"},"thumbnailUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/Machine-Predictive-Maintenance-with-MLOps-Deployed-on-AWS-.webp.webp","keywords":["Blogathon","Machine","Maintenance","MLOps","Predictive"],"articleSection":["Analytics"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fivemor.com\/?p=87647#respond"]}]},{"@type":"WebPage","@id":"https:\/\/fivemor.com\/?p=87647","url":"https:\/\/fivemor.com\/?p=87647","name":"Machine Predictive Maintenance with MLOps - Som2ny Network","isPartOf":{"@id":"https:\/\/fivemor.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/fivemor.com\/?p=87647#primaryimage"},"image":{"@id":"https:\/\/fivemor.com\/?p=87647#primaryimage"},"thumbnailUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/Machine-Predictive-Maintenance-with-MLOps-Deployed-on-AWS-.webp.webp","datePublished":"2025-02-14T12:05:32+00:00","breadcrumb":{"@id":"https:\/\/fivemor.com\/?p=87647#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fivemor.com\/?p=87647"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fivemor.com\/?p=87647#primaryimage","url":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/Machine-Predictive-Maintenance-with-MLOps-Deployed-on-AWS-.webp.webp","contentUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/Machine-Predictive-Maintenance-with-MLOps-Deployed-on-AWS-.webp.webp","width":872,"height":473},{"@type":"BreadcrumbList","@id":"https:\/\/fivemor.com\/?p=87647#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/fivemor.com\/?bp_activities=1"},{"@type":"ListItem","position":2,"name":"Machine Predictive Maintenance with MLOps"}]},{"@type":"WebSite","@id":"https:\/\/fivemor.com\/#website","url":"https:\/\/fivemor.com\/","name":"Som2ny Network","description":"Daily Deals","publisher":{"@id":"https:\/\/fivemor.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/fivemor.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/fivemor.com\/#organization","name":"Som2ny Network","url":"https:\/\/fivemor.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fivemor.com\/#\/schema\/logo\/image\/","url":"https:\/\/fivemor.com\/wp-content\/uploads\/2026\/07\/4a0953c4-logo-300x86-1.png","contentUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2026\/07\/4a0953c4-logo-300x86-1.png","width":300,"height":86,"caption":"Som2ny Network"},"image":{"@id":"https:\/\/fivemor.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fivemor.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/729ae85bf62b9917e93538db2f2688ca?s=96&r=g&default=https%3A%2F%2Ffivemor.com%2Fwp-content%2Fplugins%2Fbuddypress-first-letter-avatar%2Fimages%2Fdefault%2F96%2Flatin_a.png","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/729ae85bf62b9917e93538db2f2688ca?s=96&r=g&default=https%3A%2F%2Ffivemor.com%2Fwp-content%2Fplugins%2Fbuddypress-first-letter-avatar%2Fimages%2Fdefault%2F96%2Flatin_a.png","caption":"admin"},"sameAs":["https:\/\/fivemor.com"],"url":"https:\/\/fivemor.com\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/posts\/87647","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=87647"}],"version-history":[{"count":0,"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/posts\/87647\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/media\/87648"}],"wp:attachment":[{"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=87647"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=87647"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=87647"},{"taxonomy":"dealstore","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fdealstore&post=87647"},{"taxonomy":"offerexpiration","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fofferexpiration&post=87647"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}