我正在训练3个数据列表L1,L2,L3。首先,我用sgdclassizer fit()训练所有这些人,然后用partial_fit()逐个训练它们。我用L4,L5测试数据。[列表中的数据是图像数据,L4、L5图像与L2相同]。在
fit()的预测是正确的,这正是我所期望的部分_fit()。但是,下面代码的输出显示,无论partial_fit()的10000次迭代次数如何,这两种方法的行为都是不同的。在
输出:
fit
[1] #Tested L1. Predicts label as 1 correctly
[2] #Tested L2. Predicts label as 2 correctly
[3] #Tested L3. Predicts label as 3 correctly
[2] #Tested L4. Predicts label as 2 correctly [Data close to L2]
[2] #Tested L5. Predicts label as 2 correctly [Data close to L2]
partial_fit
[3] #Tested L1. Predicts label as 3 incorrectly
[3] #Tested L2. Predicts label as 3 incorrectly
[3] #Tested L3. Predicts label as 3 incorrectly
[3] #Tested L4. Predicts label as 3 incorrectly
[3] #Tested L5. Predicts label as 3 incorrectly
代码:
^{pr2}$如何改进我的部分_fit()预测结果与fit()匹配?我想一个接一个地学习,并且仍然准确地预测。我尝试了不同次数的迭代,但没有成功。在
在实例化分类器时,可能需要使用}结合起来。在
warm_start=True
将fit
和{您应该为传入的数据和标签(类)创建一个缓冲区来优化它。使用缓冲区来提高拟合度(不是每个
fit
一个样本),并防止类不平衡(每批添加相同数量的每个类)。像这样:相关问题 更多 >
编程相关推荐