新生儿喂养观察记录数据分析
1、背景分析
对喂养数据进行建模,从新生儿的喂养中抽象出关键的事件,包括:
- 喝奶
- 拉尿
- 拉屎
对每个关键事件的多维度属性值进行量化、归一:
- 上次喂奶量 / 两次间隔时间 = 单位奶支撑的单位时间,代表新生儿对营养的吸收情况
- 本次拉屎量 / 两次间隔时间 = 单位时间产生的屎量,代表新生儿的肠胃运行情况
- 本次拉尿量 / 两次间隔时间 = 单位时间产生的尿量,代表新生儿的肾脏和膀胱运行情况
由于屎量不好精确定义,因此采用一个枚举区间表示:
- 10:大量
- 5:中等
- 2:少量
对尿的定义也采取类似的归一化处理:
- 1.2:多
- 1:中等
- 0.8:少量
2、数据拟合
用我家宝出生后72小时数据作为训练数据,
import matplotlib.pyplot as plt import datetime y_data_milk = [ .5 / (datetime.datetime.strptime("2022-01-20 23:30", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-20 21:32", "%Y-%m-%d %H:%M")).seconds, .5 / (datetime.datetime.strptime("2022-01-21 01:30", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-20 23:30", "%Y-%m-%d %H:%M")).seconds, .10 / (datetime.datetime.strptime("2022-01-21 03:24", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-21 01:30", "%Y-%m-%d %H:%M")).seconds, .10 / (datetime.datetime.strptime("2022-01-21 05:20", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-21 03:24", "%Y-%m-%d %H:%M")).seconds, .10 / (datetime.datetime.strptime("2022-01-21 06:55", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-21 05:20", "%Y-%m-%d %H:%M")).seconds, .10 / (datetime.datetime.strptime("2022-01-21 09:25", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-21 06:55", "%Y-%m-%d %H:%M")).seconds, .10 / (datetime.datetime.strptime("2022-01-21 11:00", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-21 09:25", "%Y-%m-%d %H:%M")).seconds, .10 / (datetime.datetime.strptime("2022-01-21 12:08", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-21 11:00", "%Y-%m-%d %H:%M")).seconds, .10 / (datetime.datetime.strptime("2022-01-21 14:35", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-21 12:08", "%Y-%m-%d %H:%M")).seconds, .5 / (datetime.datetime.strptime("2022-01-21 16:20", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-21 14:35", "%Y-%m-%d %H:%M")).seconds, .15 / (datetime.datetime.strptime("2022-01-21 18:15", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-21 16:20", "%Y-%m-%d %H:%M")).seconds, .15 / (datetime.datetime.strptime("2022-01-21 20:00", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-21 18:15", "%Y-%m-%d %H:%M")).seconds, .20 / (datetime.datetime.strptime("2022-01-21 21:20", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-21 20:00", "%Y-%m-%d %H:%M")).seconds, .30 / (datetime.datetime.strptime("2022-01-22 00:21", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-21 21:20", "%Y-%m-%d %H:%M")).seconds, .18 / (datetime.datetime.strptime("2022-01-22 02:10", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-22 00:21", "%Y-%m-%d %H:%M")).seconds, .30 / (datetime.datetime.strptime("2022-01-22 03:20", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-22 02:10", "%Y-%m-%d %H:%M")).seconds, .30 / (datetime.datetime.strptime("2022-01-22 05:25", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-22 03:20", "%Y-%m-%d %H:%M")).seconds, .30 / (datetime.datetime.strptime("2022-01-22 08:06", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-22 05:25", "%Y-%m-%d %H:%M")).seconds, .30 / (datetime.datetime.strptime("2022-01-22 11:00", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-22 08:06", "%Y-%m-%d %H:%M")).seconds, .30 / (datetime.datetime.strptime("2022-01-22 13:10", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-22 11:00", "%Y-%m-%d %H:%M")).seconds, .30 / (datetime.datetime.strptime("2022-01-22 14:50", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-22 13:10", "%Y-%m-%d %H:%M")).seconds, .30 / (datetime.datetime.strptime("2022-01-22 18:25", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-22 14:50", "%Y-%m-%d %H:%M")).seconds, .30 / (datetime.datetime.strptime("2022-01-22 20:15", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-22 18:25", "%Y-%m-%d %H:%M")).seconds, .37 / (datetime.datetime.strptime("2022-01-22 21:51", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-22 20:15", "%Y-%m-%d %H:%M")).seconds, .35 / (datetime.datetime.strptime("2022-01-23 00:00", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-22 21:51", "%Y-%m-%d %H:%M")).seconds, .10 / (datetime.datetime.strptime("2022-01-23 01:15", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-23 00:00", "%Y-%m-%d %H:%M")).seconds, .20 / (datetime.datetime.strptime("2022-01-23 01:50", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-23 01:15", "%Y-%m-%d %H:%M")).seconds, .20 / (datetime.datetime.strptime("2022-01-23 02:23", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-23 01:50", "%Y-%m-%d %H:%M")).seconds, .15 / (datetime.datetime.strptime("2022-01-23 03:26", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-23 02:23", "%Y-%m-%d %H:%M")).seconds, .20 / (datetime.datetime.strptime("2022-01-23 05:20", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-23 03:26", "%Y-%m-%d %H:%M")).seconds, .30 / (datetime.datetime.strptime("2022-01-23 06:52", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-23 05:20", "%Y-%m-%d %H:%M")).seconds, .35 / (datetime.datetime.strptime("2022-01-23 08:30", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-23 06:52", "%Y-%m-%d %H:%M")).seconds, .40 / (datetime.datetime.strptime("2022-01-23 10:54", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-23 08:30", "%Y-%m-%d %H:%M")).seconds, .20 / (datetime.datetime.strptime("2022-01-23 12:45", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-23 10:54", "%Y-%m-%d %H:%M")).seconds ] x_data_milk = list(range(0, len(y_data_milk))) y_data_shit = [ .5 / (datetime.datetime.strptime("2022-01-20 23:30", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-20 21:32", "%Y-%m-%d %H:%M")).seconds, .10 / (datetime.datetime.strptime("2022-01-21 00:20", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-20 23:30", "%Y-%m-%d %H:%M")).seconds, .10 / (datetime.datetime.strptime("2022-01-21 03:24", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-21 00:20", "%Y-%m-%d %H:%M")).seconds, .10 / (datetime.datetime.strptime("2022-01-21 04:20", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-21 03:24", "%Y-%m-%d %H:%M")).seconds, .10 / (datetime.datetime.strptime("2022-01-21 06:55", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-21 04:20", "%Y-%m-%d %H:%M")).seconds, .10 / (datetime.datetime.strptime("2022-01-21 09:25", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-21 06:55", "%Y-%m-%d %H:%M")).seconds, .10 / (datetime.datetime.strptime("2022-01-21 14:35", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-21 09:25", "%Y-%m-%d %H:%M")).seconds, .10 / (datetime.datetime.strptime("2022-01-21 18:15", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-21 14:35", "%Y-%m-%d %H:%M")).seconds, .10 / (datetime.datetime.strptime("2022-01-22 05:32", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-21 18:15", "%Y-%m-%d %H:%M")).seconds, .10 / (datetime.datetime.strptime("2022-01-22 13:10", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-22 05:32", "%Y-%m-%d %H:%M")).seconds, .10 / (datetime.datetime.strptime("2022-01-22 14:50", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-22 13:10", "%Y-%m-%d %H:%M")).seconds, .10 / (datetime.datetime.strptime("2022-01-22 18:25", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-22 14:50", "%Y-%m-%d %H:%M")).seconds, .10 / (datetime.datetime.strptime("2022-01-23 08:30", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-22 18:25", "%Y-%m-%d %H:%M")).seconds, .10 / (datetime.datetime.strptime("2022-01-23 12:45", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-23 08:30", "%Y-%m-%d %H:%M")).seconds, .10 / (datetime.datetime.strptime("2022-01-23 13:10", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-23 12:45", "%Y-%m-%d %H:%M")).seconds ] x_data_shit = list(range(0, len(y_data_shit))) y_data_urine = [ .1 / (datetime.datetime.strptime("2022-01-21 00:20", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-20 21:32", "%Y-%m-%d %H:%M")).seconds, .1 / (datetime.datetime.strptime("2022-01-21 03:24", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-21 00:20", "%Y-%m-%d %H:%M")).seconds, .1 / (datetime.datetime.strptime("2022-01-21 04:20", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-21 03:24", "%Y-%m-%d %H:%M")).seconds, .1 / (datetime.datetime.strptime("2022-01-21 06:55", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-21 04:20", "%Y-%m-%d %H:%M")).seconds, .1 / (datetime.datetime.strptime("2022-01-21 09:25", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-21 06:55", "%Y-%m-%d %H:%M")).seconds, .1 / (datetime.datetime.strptime("2022-01-21 14:35", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-21 09:25", "%Y-%m-%d %H:%M")).seconds, .1 / (datetime.datetime.strptime("2022-01-21 18:15", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-21 14:35", "%Y-%m-%d %H:%M")).seconds, 1.2 / (datetime.datetime.strptime("2022-01-22 00:21", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-21 18:15", "%Y-%m-%d %H:%M")).seconds, 1.2 / (datetime.datetime.strptime("2022-01-22 05:32", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-22 00:21", "%Y-%m-%d %H:%M")).seconds, 1.2 / (datetime.datetime.strptime("2022-01-22 08:06", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-22 05:32", "%Y-%m-%d %H:%M")).seconds, .1 / (datetime.datetime.strptime("2022-01-22 13:10", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-22 08:06", "%Y-%m-%d %H:%M")).seconds, .1 / (datetime.datetime.strptime("2022-01-22 14:50", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-22 13:10", "%Y-%m-%d %H:%M")).seconds, .1 / (datetime.datetime.strptime("2022-01-22 18:25", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-22 14:50", "%Y-%m-%d %H:%M")).seconds, .1 / (datetime.datetime.strptime("2022-01-23 00:00", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-22 18:25", "%Y-%m-%d %H:%M")).seconds, .1 / (datetime.datetime.strptime("2022-01-23 01:50", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-23 00:00", "%Y-%m-%d %H:%M")).seconds, .1 / (datetime.datetime.strptime("2022-01-23 02:23", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-23 01:50", "%Y-%m-%d %H:%M")).seconds, .1 / (datetime.datetime.strptime("2022-01-23 03:26", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-23 02:23", "%Y-%m-%d %H:%M")).seconds, .1 / (datetime.datetime.strptime("2022-01-23 05:20", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-23 03:26", "%Y-%m-%d %H:%M")).seconds, .1 / (datetime.datetime.strptime("2022-01-23 06:52", "%Y-%m-%d %H:%M") - datetime.datetime.strptime("2022-01-23 05:20", "%Y-%m-%d %H:%M")).seconds ] x_data_urine = list(range(0, len(y_data_urine))) plt.plot(x_data_milk, y_data_milk, color='red', linewidth=2.0, linestyle='--') plt.plot(x_data_shit, y_data_shit, color='blue', linewidth=3.0, linestyle='-.') plt.plot(x_data_urine, y_data_urine, color='green', linewidth=4.0, linestyle='--') plt.show()
3、数据洞察
- 喂奶指数总体呈现上升趋势,相比于刚出生时候,总体均值提升了50%,表现该婴儿的肠胃和营养吸收情况正在提升。另一方面,该指数的方差相对还较大,表明该婴儿的身体机能还处于构建期
- 粪便指数和排尿指数的总体情况相对较平均,表明身体脏器功能总体情况不错
- 红色折线,也就是喂奶指数并不是一条平滑上升的曲线,而是呈现一个总体上升但是不断波动的形状。这背后的原因是:婴儿的肠胃能力的增长是线性的,但是负责喂奶的阿姨每次给小孩喂的量总是滞后的,阿姨总是要等到发现上次喂奶量不够后,才会在下一次增加一定的量。得到这个洞察后,就可以知道我们更好的进行喂奶量的精细化控制,那就是根据拟合后的模型,按照分钟级进行精细化的预测,精确到分支和毫升预测下一次喂奶的时间和喂奶量。
目前数据量还不太足够,后期收集足够数据后,应该可以得到更多的数据趋势洞察。
另一方便,从医院的视角来看,如果能够将全部婴儿的喂养数据全部录入数据仓库,进行大数据分析,从而可以得到整体新生儿的健康均值和方差情况,然后就可以基于标准模型,对之后的新生儿进行实时的指标监控,及时发现问题。