SVM和NN模型过度适用于大数据



我使用了两个类训练了SVM和NN模型。一个班级有24000个推文和另外32000条推文。

当我进行验证时,它会像这样

-

text_clf = Pipeline([('vect', CountVectorizer(stop_words='english')), ('tfidf',TfidfTransformer(use_idf=True)),('clf',MLPClassifier(activation="relu", solver='adam', alpha=0.001, hidden_layer_sizes=(5, 2), random_state=1)),])
              precision    recall  f1-score   support
    disaster       1.00      1.00      1.00     12862
 nondisaster       1.00      1.00      1.00      9543
   micro avg       1.00      1.00      1.00     22405
   macro avg       1.00      1.00      1.00     22405
weighted avg       1.00      1.00      1.00     22405

text_clf = Pipeline([('vect', CountVectorizer(stop_words='english')), ('tfidf',TfidfTransformer(use_idf=True)),('clf',SGDClassifier(loss='hinge', penalty='l2', alpha=1e-3, random_state=42, verbose=1)),])
            text_clf.fit(X_train, y_train)
              precision    recall  f1-score   support
    disaster       1.00      1.00      1.00      6360
 nondisaster       1.00      1.00      1.00      4842
   micro avg       1.00      1.00      1.00     11202
   macro avg       1.00      1.00      1.00     11202
weighted avg       1.00      1.00      1.00     11202

当我将NN模型中的alpha值从0.001更改为0.00001

              precision    recall  f1-score   support
    disaster       1.00      0.99      0.99     12739
 nondisaster       0.98      1.00      0.99      9666
   micro avg       0.99      0.99      0.99     22405
   macro avg       0.99      0.99      0.99     22405
weighted avg       0.99      0.99      0.99     22405

当我测试一些记录时,它总是会偏向一个类。例如,SVM正在预测非disaster的所有输入,而NN对灾难类进行了。

有什么想法或建议,我该如何调整此模型?

据我所知,当数据集有偏见时,就会发生这种情况。我相信 - 垃圾中的垃圾概念。

可视化火车测试数据对您来说是一件好事。我相信它会有偏见。

说,假设您的用例是推文的灾难预测,可以理解的是,如果您进行一系列推文,甚至1000个中的1个都不会是灾难。

因此,明智的做法是将查询范围调整到精致的主题和用户,以便您获得足够好的数据集。

想法?

谢谢Arun

最新更新