online-machine-learning

naive bayes classifier dynamic training

做~自己de王妃 提交于 2021-02-05 07:43:17
问题 Is it possible (and how if it is) to dynamically train sklearn MultinomialNB Classifier? I would like to train(update) my spam classifier every time I feed an email in it. I want this (does not work): x_train, x_test, y_train, y_test = tts(features, labels, test_size=0.2) clf = MultinomialNB() for i in range(len(x_train)): clf.fit([x_train[i]], [y_train[i]]) preds = clf.predict(x_test) to have similar result as this (works OK): x_train, x_test, y_train, y_test = tts(features, labels, test

Incremental learning in keras

假如想象 提交于 2021-01-29 13:30:34
问题 I am looking for a keras equivalent of scikit-learn's partial_fit : https://scikit-learn.org/0.15/modules/scaling_strategies.html#incremental-learning for incremental/online learning. I finally found the train_on_batch method but I can't find an example that shows how to properly implement it in a for loop for a dataset that looks like this : x = np.array([[0.5, 0.7, 0.8]]) # input data y = np.array([[0.4, 0.6, 0.33, 0.77, 0.88, 0.71]]) # output data Note : this is a multi-output regression