# Confidence Threshold for feature-classifier classify-sklearn

**URL:** https://forum.qiime2.org/t/confidence-threshold-for-feature-classifier-classify-sklearn/18881
**Category:** User Support
**Tags:** taxonomy
**Created:** [March 16, 2021, 8:12pm UTC](https://forum.qiime2.org/t/confidence-threshold-for-feature-classifier-classify-sklearn/18881 "2021-03-16T20:12:04Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![amin](https://forum.qiime2.org/user_avatar/forum.qiime2.org/amin/32/9685_2.png) [@amin](https://forum.qiime2.org/u/amin)
#### Post date: [March 16, 2021, 8:12pm UTC](https://forum.qiime2.org/t/confidence-threshold-for-feature-classifier-classify-sklearn/18881/1 "2021-03-16T20:12:04Z")

</div>

I trained a naive bayes classifier using feature-classifier classify-sklearn to assign taxonomy. Because of continuous error, I switched to qiime/2.2019.04 from qiime/2.2020.2 for this step and put “ --p-confidence -1 --p-read-orientation same” (as suggested here in one post) . It worked well for me, but now I get confidence "-1". Could you please tell me what does it mean, and how should I prepare my response for my publication? I am using a reference database for rpoB amplicon sequencing. Here is the pipeline I used:

qiime feature-classifier classify-sklearn --i-classifier classifier19.qza --i-reads dada2\_11000.qza --o-classification dada2\_rep\_seqs\_taxonomy\_github.qza --p-confidence -1 --p-read-orientation same

qiime taxa filter-table   
--i-table table\_11000.qza   
--i-taxonomy dada2\_rep\_seqs\_taxonomy\_github.qza   
--p-exclude Unassigned   
--o-filtered-table dada2\_improved\_table.qza

qiime taxa filter-seqs   
--i-sequences rep-seqs.qza   
--i-taxonomy dada2\_rep\_seqs\_taxonomy\_github.qza   
--p-exclude Unassigned   
--o-filtered-sequences dada2\_improved\_sequences.qza

qiime feature-classifier classify-sklearn --i-classifier classifier19.qza --i-reads dada2\_improved\_sequences.qza --o-classification dada2\_rep\_seqs\_taxonomy\_improved.qza --p-confidence -1 --p-read-orientation same

---

<div class="post-metadata">

### Author: ![amin](https://forum.qiime2.org/user_avatar/forum.qiime2.org/amin/32/9685_2.png) [@amin](https://forum.qiime2.org/u/amin)
#### Post date: [March 17, 2021, 9:44pm UTC](https://forum.qiime2.org/t/confidence-threshold-for-feature-classifier-classify-sklearn/18881/2 "2021-03-17T21:44:58Z")

</div>

For your consideration I am also attaching my rep seqs and trained Classifier. I just noticed I mistakenly write here dada2\_11000.qza instead of rep-seqs.qza in my first sklearn command, but when I ran the code I used the correct one, still getting the error. Please let me know if you need anything more. I really appreciate your assistance on this.[rep-seqs.qza](https://forum.qiime2.org/uploads/short-url/A64ovv6DG67LBEgNlAWYcGOsAbs.qza) (2.0 MB) [classifier19.qza](https://forum.qiime2.org/uploads/short-url/25nPkgImUTwrMGDiPAUnM2XHF9y.qza) (4.6 MB)

---

<div class="post-metadata">

### Author: ![ChrisKeefe](https://forum.qiime2.org/user_avatar/forum.qiime2.org/chriskeefe/32/1907_2.png) [@ChrisKeefe](https://forum.qiime2.org/u/ChrisKeefe)
#### Post date: [March 18, 2021, 10:32pm UTC](https://forum.qiime2.org/t/confidence-threshold-for-feature-classifier-classify-sklearn/18881/3 "2021-03-18T22:32:05Z")

</div>

> [@amin](#):
>
> “ --p-confidence -1 --p-read-orientation same” (as suggested here in one post)

Looks like you dug that out of the deep archives, @amin! 👴 In current versions of QIIME 2, `--p-confidence -1` has been replaced with the more descriptive [`--p-confidence disable`](https://docs.qiime2.org/2021.2/plugins/available/feature-classifier/classify-sklearn/). Whichever version you're using, it's generally preferable to fix the underlying issue with the taxonomy rather than passing this parameter, as it disables confidence calculation, causing the classifier:

> [@classify-sklearn - Plugin error from feature-classifier: pop from empty list](https://forum.qiime2.org/t/classify-sklearn-plugin-error-from-feature-classifier-pop-from-empty-list/14074/4):
>
> to choose the top hit without considering its similarity to other hits.

In future, please share details about the error messages you encounter. Without them, it's hard to help. [This post](https://forum.qiime2.org/t/classify-sklearn-plugin-error-from-feature-classifier-pop-from-empty-list/14074/4) discusses one possible underlying cause at slightly greater length.

Depending on what errors you're running into, I'd very likely recommend you switch back to a contemporary version of QIIME 2. 2021.2 is shiny and new, and does a lot of nice things that a two-year-old version cannot.

Good luck!  
Chris 🦛

---

<div class="post-metadata">

### Author: ![amin](https://forum.qiime2.org/user_avatar/forum.qiime2.org/amin/32/9685_2.png) [@amin](https://forum.qiime2.org/u/amin)
#### Post date: [March 24, 2021, 2:36am UTC](https://forum.qiime2.org/t/confidence-threshold-for-feature-classifier-classify-sklearn/18881/4 "2021-03-24T02:36:20Z")

</div>

I am a novice to this field and no one near me can help me on this area, I really appreciate your time and assistance on this, I am trying to find the solution for more than 10 days but stuck in this step. According to your advice I have switched to contemporary version of QIIME 2. 2021.2, now when I try to train my classifier using the following command:  
**qiime feature-classifier fit-classifier-naive-bayes --i-reference-reads fun\_9.6\_ref-fasta\_21.qza --i-reference-taxonomy fun\_9.6\_ref-taxonomy\_21.qza --o-classifier fun\_classifier\_21.qza**

I get following error:

Plugin error from feature-classifier: Found non-header line when attempting to read the 1st record:

For your examination I am attaching my fasta and taxonomy files (which I obtained from GitHub : [Mycorrhizal-symbiosis-modulates-the-rhizosphere-microbiota-to-promote-rhizobia-legume-symbiosis/rpoB\_reference at main · godlovexiaolin/Mycorrhizal-symbiosis-modulates-the-rhizosphere-microbiota-to-promote-rhizobia-legume-symbiosis · GitHub](https://github.com/godlovexiaolin/Mycorrhizal-symbiosis-modulates-the-rhizosphere-microbiota-to-promote-rhizobia-legume-symbiosis/tree/main/rpoB_reference)), I generated [fun\_9.6\_ref-fasta\_21.qza](https://forum.qiime2.org/uploads/short-url/wSaeXL6YRa6NlsFT9Nac3n7llwg.qza) (26.0 KB) [fun\_9.6\_ref-taxonomy\_21.qza](https://forum.qiime2.org/uploads/short-url/vNa8JxPlDW91N0TNpqQ0w6srWcL.qza) (60.7 KB) files from **rpoB\_reference** (GitHub) for training my classifier. I have also attached my representative sequence [rep-seqs.qza](https://forum.qiime2.org/uploads/short-url/A64ovv6DG67LBEgNlAWYcGOsAbs.qza) (2.0 MB) so that you can test the classifier. I guess the problem lies either in my fasta or taxonomy file, but I don’t have enough expertise fixing them, I would be ever grateful to you if you can provide me a solution for my problem.

---

<div class="post-metadata">

### Author: ![ChrisKeefe](https://forum.qiime2.org/user_avatar/forum.qiime2.org/chriskeefe/32/1907_2.png) [@ChrisKeefe](https://forum.qiime2.org/u/ChrisKeefe)
#### Post date: [March 24, 2021, 3:34am UTC](https://forum.qiime2.org/t/confidence-threshold-for-feature-classifier-classify-sklearn/18881/5 "2021-03-24T03:34:37Z")

</div>

When you first looked into this problem, did you see this [fantastic post](https://forum.qiime2.org/t/plugin-error-from-feature-classifier-found-non-header-line-when-attempting-to-read-the-1st-record/15593) addressing the same error message?

In short, " that error is only raised if your first line (ignoring any blank lines) does not start with a `>`", and certain software may introduce "invisible" characters that precede that `>` in your fasta. @Oddant1 describes a diagnostic approach (hex editor) and the OP describes a straightforward solution (delete and replace the `>`) if you find your issue is the same.

Let me know how it goes!  
CK

---

<div class="post-metadata">

### Author: ![amin](https://forum.qiime2.org/user_avatar/forum.qiime2.org/amin/32/9685_2.png) [@amin](https://forum.qiime2.org/u/amin)
#### Post date: [March 24, 2021, 3:42pm UTC](https://forum.qiime2.org/t/confidence-threshold-for-feature-classifier-classify-sklearn/18881/6 "2021-03-24T15:42:13Z")

</div>

> [@amin](#):
>
> QIIME 2. 2021.2

Thanks a lot for your prompt reply. At last, I successfully trained classifier [fun\_classifier\_21.qza](https://forum.qiime2.org/uploads/short-url/x0U4GOGHdCjpEGTEqFlbmjIjsKf.qza) (4.6 MB) in QIIME 2. 2021.2 but when I am testing with my representative sequences [rep-seqs.qza](https://forum.qiime2.org/uploads/short-url/A64ovv6DG67LBEgNlAWYcGOsAbs.qza) (2.0 MB), it’s giving me the following error.

Command I used:  
qiime feature-classifier classify-sklearn --i-classifier fun\_classifier\_21.qza --i-reads rep-seqs.qza --o-classification taxonomy.qza

Error:  
File "/usr/miniconda3/envs/qiime2/lib/python3.6/site-packages/q2\_feature\_classifier/\_skl.py", line 81, in \_predict\_chunk\_with\_conf  
classes = [cls for cls in classes if cls[0].pop(0) == level]  
File "/usr/miniconda3/envs/qiime2/lib/python3.6/site-packages/q2\_feature\_classifier/\_skl.py", line 81, in   
classes = [cls for cls in classes if cls[0].pop(0) == level]  
IndexError: pop from empty list

Plugin error from feature-classifier:

pop from empty list

Potential Cause:  
From the previous [post](https://forum.qiime2.org/t/classify-sklearn-plugin-error-from-feature-classifier-pop-from-empty-list/14074/3) I suspect it is a formatting issue of database, I really really appreciate your kind help on this matter.

---

<div class="post-metadata">

### Author: ![thermokarst](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/t/8e7dd6/32.png) [@thermokarst](https://forum.qiime2.org/u/thermokarst)
#### Post date: [March 26, 2021, 12:18am UTC](https://forum.qiime2.org/t/confidence-threshold-for-feature-classifier-classify-sklearn/18881/7 "2021-03-26T00:18:36Z")

</div>



---

<div class="post-metadata">

### Author: ![ChrisKeefe](https://forum.qiime2.org/user_avatar/forum.qiime2.org/chriskeefe/32/1907_2.png) [@ChrisKeefe](https://forum.qiime2.org/u/ChrisKeefe)
#### Post date: [March 26, 2021, 9:50pm UTC](https://forum.qiime2.org/t/confidence-threshold-for-feature-classifier-classify-sklearn/18881/8 "2021-03-26T21:50:08Z")

</div>

> [@amin](#):
>
> IndexError: pop from empty list

Thanks for your patience, @amin. I've been under the weather. Often the fastest way to troubleshoot errors like this is to search 🔍 this forum for the error message. I found a bunch of results, including [this one](https://forum.qiime2.org/t/plugin-error-from-feature-classifier-pop-from-empty-list/1431/13), by searching "IndexError: pop from empty list".

Give that post a read - I suspect you'll need to fix your taxonomy, but that should steer you in the right direction.

---

<div class="post-metadata">

### Author: ![thermokarst](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/t/8e7dd6/32.png) [@thermokarst](https://forum.qiime2.org/u/thermokarst)
#### Post date: [March 26, 2021, 9:53pm UTC](https://forum.qiime2.org/t/confidence-threshold-for-feature-classifier-classify-sklearn/18881/9 "2021-03-26T21:53:26Z")

</div>



---

<div class="post-metadata">

### Author: ![amin](https://forum.qiime2.org/user_avatar/forum.qiime2.org/amin/32/9685_2.png) [@amin](https://forum.qiime2.org/u/amin)
#### Post date: [March 30, 2021, 3:50am UTC](https://forum.qiime2.org/t/confidence-threshold-for-feature-classifier-classify-sklearn/18881/10 "2021-03-30T03:50:15Z")

</div>

Thanks @ChrisKeefe, I am trying to fix the taxonomy.

---

<div class="post-metadata">

### Author: ![system](https://forum-qiime2-org.s3.dualstack.us-west-2.amazonaws.com/original/3X/2/1/21af5fe23cb6f4579467c66a9ed94e55274ca7bd.svg) [@system](https://forum.qiime2.org/u/system)
#### Post date: [April 30, 2021, 9:50am UTC](https://forum.qiime2.org/t/confidence-threshold-for-feature-classifier-classify-sklearn/18881/11 "2021-04-30T09:50:24Z")

</div>

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
