简体   繁体   English

平衡数据集后的低 F1 分数

[英]Low F1-Score after balancing dataset

I have a binary classification problem with tweets;我有推文的二元分类问题; 17000 as a positive class and 122000 as a negative class. 17000 作为正 class 和 122000 作为负 class。 I have balanced the data with both as 17000 tweets in each class.我已经将数据与每个 class 中的 17000 条推文进行了平衡。 I have implemented models like LR, SVM, BERT, LSTM and CNN.我已经实现了 LR、SVM、BERT、LSTM 和 CNN 等模型。 In every run, the F1 score is around 0.55-0.66.在每次运行中,F1 分数在 0.55-0.66 左右。 Am I doing something wrong?难道我做错了什么? Is it normal to have an F1 score around 0.55? F1分数在0.55左右正常吗?

The problem continues with another dataset also.另一个数据集也存在问题。 The sample BERT model is样本 BERT model 是

trainer = Trainer(
model=model,                      # our loaded pre-trained transformer-based model "DistilBERT"
args=training_args,               # our defined training arguments
train_dataset=train_dataset,      # training dataset
eval_dataset=eval_dataset,        # evaluation dataset
compute_metrics=compute_metrics   # our defined evaluation function 

) )

Althought an F1 score around 0.55-0.66 can be normal it depends on your use case if it is good enough.尽管 F1 分数在 0.55-0.66 左右可能是正常的,但它是否足够好取决于您的用例。

The F1 score depends not only on data balancing but also on lots of factors. F1分数不仅取决于数据平衡,还取决于许多因素。

I'd recommend to take into account this steps for your ML pipeline:我建议为您的 ML 管道考虑以下步骤:

  1. Data preparation/cleansing (tokenization, stop-words removal, etc.)数据准备/清理(标记化、停用词删除等)

  2. Algorithms/Model selection (from experience SVM and NN perform good)算法/模型选择(根据经验 SVM 和 NN 表现良好)

  3. Feature engineering/selection (Which features have more influence in the model)特征工程/选择(哪些特征对模型影响更大)

  4. Hyperparameter tunning (depending on the model you'll have to search for the better combination of hyperparameters. Eg with NN you have to specify how many layers, how many nodes, activation fn, back propagation fn, etc.)超参数调整(取决于 model,您必须搜索更好的超参数组合。例如,对于 NN,您必须指定多少层、多少节点、激活 fn、反向传播 fn 等)

Many people like to focus on the last steps but I'd say that data preparation is one of the most important steps in any data pipeline.许多人喜欢关注最后一步,但我想说数据准备是任何数据管道中最重要的步骤之一。 Data preparation/cleansing plays also a huge role in the F1 score and practicaly all other metrics.数据准备/清理在 F1 分数和所有其他指标中也起着重要作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM