sample classifier function

This commit is contained in:
Pritimay Sarkar
2023-12-08 21:44:55 +05:30
parent 9d8a2da5e9
commit 8e1093de47

View File

@@ -9,3 +9,15 @@ def sample_classification(event, context):
print(f"Function triggered by change to: {resource_string}.")
# now print out the entire event object
print(str(event))
with open('label_encoder.pkl', 'rb') as label_encoder_file:
loaded_label_encoder = pickle.load(label_encoder_file)
with open('gaussian_naive_bayes_model.pkl', 'rb') as model_file:
loaded_model = pickle.load(model_file)
input_data = pd.DataFrame({'calculatedRatio': 0.231057205, 'deviceRatio': 0.231057205,'led1Buffer': 23776.33, 'led2Buffer': 26401.67,
'led1Sample': 16286, 'led2Sample': 6952.67}, index=[0])
predicted_result = loaded_model.predict(new_data)
print(predicted_result.item())