public PredictionModel Predict(HeartFailurePredictionModel heartFailurePredictionModel) { ClassificationModelInput modelInput = new ClassificationModelInput { Age = heartFailurePredictionModel.Age, Sex = heartFailurePredictionModel.Sex.Equals("Male") ? 1:0, Chest_pain_type = heartFailurePredictionModel.Chest_pain_type, Resting_bp_s = heartFailurePredictionModel.Resting_bp_s, Cholesterol = heartFailurePredictionModel.Cholesterol, Fasting_blood_sugar = float.Parse(heartFailurePredictionModel.Fasting_blood_sugar), Resting_ecg = float.Parse(heartFailurePredictionModel.Resting_ecg), Max_heart_rate = heartFailurePredictionModel.Max_heart_rate, Exercise_angina = float.Parse(heartFailurePredictionModel.Exercise_angina), Oldpeak = heartFailurePredictionModel.Oldpeak, ST_slope = heartFailurePredictionModel.ST_slope, }; var prediction = ConsumeModel.Predict(modelInput); heartFailurePredictionModel.HeartFailurePredictionResult = (int)(prediction.Score[^ 1] * 100);
public PredictionModel Predict(StrokePredictionModel strokePredictionModel) { ClassificationModelInput modelInput = new ClassificationModelInput { Age = strokePredictionModel.Age, AverageGlucoseLevel = (float)strokePredictionModel.AverageGlucoseLevel, BMI = (float)strokePredictionModel.BMI, EverMarried = strokePredictionModel.EverMarried, Gender = strokePredictionModel.Gender, HasHeartDisease = strokePredictionModel.HasHeartDisease, HasHypertension = strokePredictionModel.HasHeartDisease, ResidenceType = strokePredictionModel.ResidenceType, SmokingStatus = strokePredictionModel.SmokingStatus, WorkType = strokePredictionModel.WorkType }; var prediction = ConsumeModel.Predict(modelInput); strokePredictionModel.StrokePredictionResult = (int)(prediction.Score[^ 1] * 100);