sklearn.linear_model.SGDClassifier能做小批量学习(mini-batch)吗?
文档里提到了SGD allows minibatch (online/out-of-core) learning, see the partial_fit method.
我感觉这个并不是mini-batch,只是online learning而已。
sklaern里的逻辑回归有做真正的mini-batch的吗?
2个回答
partial_fit可以差不多来实现mini-batch。但是只是和最原始的Mini-batch不是同一个意思。
clf = linear_model.SGDRegressor(learning_rate = 'constant', alpha = 0, eta0 = 0.01, shuffle=True)
chunks = list(batcherator)
for _ in range(4):
random.shuffle(chunks)
for X_chunk, y_chunk in chunks:
clf.partial_fit(X_chunk, y_chunk)
y_predicted = clf.predict_proba(X)