|
|
|
|
| import pandas as pd
|
| import joblib
|
|
|
|
|
| import pandas as pd
|
| import joblib
|
|
|
| class InsuranceClaimPredictor:
|
| def __init__(self, model_path):
|
| self.model_path = model_path
|
| self.model = self.load_model()
|
|
|
| def load_model(self):
|
|
|
| loaded_model = joblib.load(self.model_path)
|
| return loaded_model
|
|
|
| def predict(self, data):
|
|
|
| predictions = self.model.predict(data)
|
| return predictions
|
|
|
|
|
| if __name__ == "__main__":
|
| predictor = InsuranceClaimPredictor('model/insurance_claim_prediction_model.joblib')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| unseen_data = pd.DataFrame({
|
| 'age': [40],
|
| 'sex': ['male'],
|
| 'bmi': [25.3],
|
| 'children': [2],
|
| 'smoker': ['no'],
|
| 'region': ['southeast'],
|
| 'charges': [2900]
|
| })
|
|
|
| predictions = predictor.predict(unseen_data)
|
| print("Predictions for the unseen data:", predictions) |