Skip to main content

Posts

Showing posts from September 10, 2024

Predictive Maintenance Using Machine Learning

Context : A manufacturing company wants to predict when equipment is likely to fail, so they can schedule maintenance and reduce downtime. Dataset : The company collects data on equipment sensor readings, maintenance records, and failure events. Libraries : pandas for data manipulation numpy for numerical computations scikit-learn for machine learning matplotlib and seaborn for visualization Code : # Import libraries import pandas as pd import numpy as np from sklearn.model_selection import train_test_split from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import accuracy_score, classification_report import matplotlib.pyplot as plt import seaborn as sns # Load dataset df = pd.read_csv('equipment_data.csv') # Preprocess data df['failure'] = df['failure'].map({'yes': 1, 'no': 0}) X = df.drop(['failure'], axis=1) y = df['failure'] # Split data into training and testing sets X_train, X_test, y_train, y_test = tr...