我正在对我的数据进行增量分析。数据属于 4 个年龄组(第 1 天、第 2 天、第 3 天和第 4 天)。在将数据输入模型之前,我使用 sklearn 中的标准缩放器实现对特征进行标准化。当我想到它时,我想到了三种方法。
Approach (1)standardize the newly added data separately
days = [day1, day2, day3, day4]
data=[]
for day in days:
standard_scaler = StandardScaler()
scaled = standard_scaler.fit_transform(day)
data.append(scaled)
Y = model.fit_transform(data)
Approach (2)standardize all the data up to the current day together separately
days = [day1, day2, day3, day4]
data=[]
for day in days:
data.append(day)
standard_scaler = StandardScaler()
scaled = standard_scaler.fit_transform(data)
Y = model.fit_transform(scaled)
Approach (3)partial_fit the same standard scaler on the newly added increments
days = [day1, day2, day3, day4]
standard_scaler = StandardScaler()
data=[]
for day in days:
standard_scaler.partial_fit(day)
data.append(day)
scaled = standard_scaler.transform(data)
Y = model.fit_transform(scaled)
请告知哪种方法最适合。