0% found this document useful (0 votes)
8 views2 pages

Anomaly Detection in Cyclone Data

Uploaded by

naveen
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

Anomaly Detection in Cyclone Data

Uploaded by

naveen
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

import pandas as pd

from [Link] import IsolationForest

# Load the dataset from Excel file


data = pd.read_excel('cyclone_data.xlsx')

# Select the relevant columns for anomaly detection


selected_columns = ['Cyclone_Inlet_Gas_Temp', 'Cyclone_Gas_Outlet_Temp',
'Cyclone_Outlet_Gas_draft', 'Cyclone_cone_draft',
'Cyclone_Inlet_Draft', 'Cyclone_Material_Temp']
X = data[selected_columns]

# Initialize and fit the Isolation Forest model


model = IsolationForest(contamination='auto', random_state=42)
[Link](X)

# Predict the anomalies


predictions = [Link](X)

# Add the anomaly predictions as a new column in the original dataset


data['Anomaly'] = predictions

# Filter the dataset to show only the anomalous records


anomalies = data[data['Anomaly'] == -1]

# Identify the time periods with abnormal operations


abnormal_periods = []
current_period = []

for index, row in [Link]():


if len(current_period) == 0:
current_period.append(index)
elif index == current_period[-1] + 1:
current_period.append(index)
else:
abnormal_periods.append(current_period)
current_period = [index]

# Print the time periods with abnormal operations


for period in abnormal_periods:
start_time = [Link][period[0], 'Timestamp']
end_time = [Link][period[-1], 'Timestamp']
print(f"Abnormal period: {start_time} to {end_time}")

You might also like