大家都知道BMI指数吧。
但是不同的人会有不同的BMI
我给大家程序。
import tkinter as tk from tkinter import messagebox from joblib import load import pandas as pd import numpy as np # 加载BMI数据 data = pd.read_csv('bmi.csv') # 加载分类器 clf = load('clf.pkl') # 计算BMI def calculate_bmi(): height = float(entry_height.get()) weight = float(entry_weight.get()) bmi = weight / (height * height) return bmi # 计算建议的体重 def calculate_suggested_weight(): height = float(entry_height.get()) desired_bmi = 24.0 suggested_weight = desired_bmi * (height * height) return suggested_weight # 预测BMI的范围 def predict_bmi_range(): sex = variable_sex.get() age = int(entry_age.get()) height = float(entry_height.get()) weight = float(entry_weight.get()) bmi = weight / (height * height) X = np.array([[sex, age, height, weight]]) bmi_range =