SilverDragon9 commited on
Commit
b3e393a
·
verified ·
1 Parent(s): 8483a26

Update Sniffer_AI(Garage-door Dataset).py

Browse files
Files changed (1) hide show
  1. Sniffer_AI(Garage-door Dataset).py +2 -4
Sniffer_AI(Garage-door Dataset).py CHANGED
@@ -13,8 +13,7 @@ rf_model = joblib.load('rf_model.pkl') # Ensure the correct model path
13
 
14
  # Define required numeric features
15
  numeric_features = [
16
- "date_numeric", "total_minutes", "seconds",
17
- "door_state", "sphone_signal", "label"
18
  ]
19
 
20
  # Class labels for attack types
@@ -36,8 +35,7 @@ def convert_datetime_features(log_data):
36
  log_data['date_numeric'] = log_data['date'].astype(np.int64) // 10**9
37
 
38
  time_parsed = pd.to_datetime(log_data['time'], format='%H:%M:%S', errors='coerce')
39
- log_data['total_minutes'] = (time_parsed.dt.hour * 60) + time_parsed.dt.minute
40
- log_data['seconds'] = time_parsed.dt.second
41
  except Exception as e:
42
  return f"Error processing date/time: {str(e)}"
43
 
 
13
 
14
  # Define required numeric features
15
  numeric_features = [
16
+ "date_numeric", "time_numeric", "door_state", "sphone_signal", "label"
 
17
  ]
18
 
19
  # Class labels for attack types
 
35
  log_data['date_numeric'] = log_data['date'].astype(np.int64) // 10**9
36
 
37
  time_parsed = pd.to_datetime(log_data['time'], format='%H:%M:%S', errors='coerce')
38
+ log_data['time_numeric'] = (time_parsed.dt.hour * 3600) + (time_parsed.dt.minute * 60) + time_parsed.dt.second
 
39
  except Exception as e:
40
  return f"Error processing date/time: {str(e)}"
41