insurance_charges_model/prediction/model.py
def predict(self, data: InsuranceChargesModelInput) -> InsuranceChargesModelOutput:
        """Make a prediction with the model.

        :param data: Data for making a prediction with the model. Object must meet requirements of the input schema.
        :rtype: dict -- The result of the prediction, the output object will meet the requirements of the output schema.

        """
        # converting the incoming dictionary into a pandas dataframe that can be accepted by the model
        X = pd.DataFrame([[data.age, data.sex.value, data.bmi, data.children, data.smoker, data.region.value]],
                         columns=["age", "sex", "bmi", "children", "smoker", "region"])

        # making the prediction and extracting the result from the array
        y_hat = round(float(self._svm_model.predict(X)[0]), 2)

        return InsuranceChargesModelOutput(charges=y_hat)
Make a prediction with the model.

        :param data: Data for making a prediction with the model. Object must meet requirements of the input schema.
        :rtype: dict -- The result of the prediction, the output object will meet the requirements of the output schema.

        
Make a prediction with the model.
Make a prediction with the model .
def predict(self, data: InsuranceChargesModelInput) -> InsuranceChargesModelOutput:
        X = pd.DataFrame([[data.age, data.sex.value, data.bmi, data.children, data.smoker, data.region.value]],
                         columns=["age", "sex", "bmi", "children", "smoker", "region"])
        y_hat = round(float(self._svm_model.predict(X)[0]), 2)
        return InsuranceChargesModelOutput(charges=y_hat)
def predict ( self , data : InsuranceChargesModelInput ) -> InsuranceChargesModelOutput : X = pd . DataFrame ( [ [ data . age , data . sex . value , data . bmi , data . children , data . smoker , data . region . value ] ] , columns = [ "age" , "sex" , "bmi" , "children" , "smoker" , "region" ] ) y_hat = round ( float ( self . _svm_model . predict ( X ) [ 0 ] ) , 2 ) return InsuranceChargesModelOutput ( charges = y_hat )
Make a prediction with the model.
Make a prediction with the model .
"""Make a prediction with the model.

        :param data: Data for making a prediction with the model. Object must meet requirements of the input schema.
        :rtype: dict -- The result of the prediction, the output object will meet the requirements of the output schema.

        """ # converting the incoming dictionary into a pandas dataframe that can be accepted by the model # making the prediction and extracting the result from the array
None
dict -- The result of the prediction, the output object will meet the requirements of the output schema.
self
data
InsuranceChargesModelInput
Data for making a prediction with the model. Object must meet requirements of the input schema.
Data for making a prediction with the model . Object must meet requirements of the input schema .