<p>I was not loading the <code>rfPermute</code> library which caused this issue!</p>

CC BY-SA 4.0
2023-03-10T02:05:51.840Z
2023-03-10T02:05:51.840Z
selene
<p>Would you post this as an issue on the <a href="https://github.com/EricArcher/banter" rel="nofollow noreferrer">banter Github repository</a> and also send me your <code>bant.mdl</code> and <code>dets_banter</code> objects together in a single .rdata file so I can try to replicate and debug this error?</p>
<p>Eric</p>

CC BY-SA 4.0
2023-03-01T00:37:43.350Z
Hi @gramposity, I *think* I made some progress on this (I wasn't loading `rfPermute`). I want to run a few more tests and if it i still have a problem, will upload to GH and send you the data objects.
selene
CC BY-SA 4.0
2023-02-27T22:47:52.697Z
2023-02-27T22:47:52.697Z
Gramposity
<p>I am using R program <code>banter</code> (<a href="https://cran.r-project.org/web/packages/banter/index.html" rel="nofollow noreferrer">banter CRAN link</a>) to classify some dolphin sounds. I have a banter model object that was created previously but I would like to now use it to predict species IDs for newly collected data. I'm trying to predict species from clicks, whistles, and burst pulses that were detected using PAMGuard, and then those detection features are extracted using R package <code>PAMpal</code> (<a href="https://cran.r-project.org/web/packages/PAMpal/index.html" rel="nofollow noreferrer">PAMpal CRAN link</a>). At the predict step, I am getting the below error and I am having no luck trying to debug.</p>
<pre><code>Error in UseMethod(&quot;predict&quot;) : 
   no applicable method for 'predict' applied to an object of class &quot;randomForest&quot;
</code></pre>
<p>My processing steps are:</p>
<pre><code># define my `PAMpal` parameters
fkwParams = PAMpalSettings(db = 'pam20207b_glider_banter_sg639_MHI_Apr2022.sqlite3', 
                           binaries = 'binaries/pam20207b_glider_banter_sg639_MHI_Apr2022/', 
                           sr_hz = &quot;auto&quot;, filterfrom_khz =10, filterto_khz = NULL, 
                           winLen_sec = 0.0025)

# extract the features for the specific encounters I want
dets = processPgDetections(fkwpps, mode = 'time', id = 'sg639_MHI', 
                           grouping = 'sg639_MHI_Apr2022_log_merged.csv', 
                           format = '%m/%d/%Y %H:%M:%S')

# Export those features in a `banter` compatible format
dets_banter= export_banter(dets)

# Load my existing banter model
load('LLBanterModel_2023-01-026.rda')

# Predict species IDs
score &lt;- banter::predict(bant.mdl, dets_banter)
</code></pre>
<p><strong>Has anyone else encountered this error or have any idea what my issue may be?</strong></p>

<pamguard><classification>
Error when using predict() function in R package banter for click classification
# Error when using predict() function in R package banter for click classification

(Asked by: username_0 on 2023-02-23)

I am using R program `banter` ([banter CRAN link](https://cran.r-project.org/web/packages/banter/index.html)) to classify some dolphin sounds. I have a banter model object that was created previously but I would like to now use it to predict species IDs for newly collected data. I'm trying to predict species from clicks, whistles, and burst pulses that were detected using PAMGuard, and then those detection features are extracted using R package `PAMpal` ([PAMpal CRAN link](https://cran.r-project.org/web/packages/PAMpal/index.html)). At the predict step, I am getting the below error and I am having no luck trying to debug.

```
Error in UseMethod("predict") : 
   no applicable method for 'predict' applied to an object of class "randomForest"

```

My processing steps are:

```
# define my `PAMpal` parameters
fkwParams = PAMpalSettings(db = 'pam20207b_glider_banter_sg639_MHI_Apr2022.sqlite3', 
                           binaries = 'binaries/pam20207b_glider_banter_sg639_MHI_Apr2022/', 
                           sr_hz = "auto", filterfrom_khz =10, filterto_khz = NULL, 
                           winLen_sec = 0.0025)

# extract the features for the specific encounters I want
dets = processPgDetections(fkwpps, mode = 'time', id = 'sg639_MHI', 
                           grouping = 'sg639_MHI_Apr2022_log_merged.csv', 
                           format = '%m/%d/%Y %H:%M:%S')

# Export those features in a `banter` compatible format
dets_banter= export_banter(dets)

# Load my existing banter model
load('LLBanterModel_2023-01-026.rda')

# Predict species IDs
score <- banter::predict(bant.mdl, dets_banter)

```

**Has anyone else encountered this error or have any idea what my issue may be?**

**Tags:** pamguard, classification


---

## 2 answers

### Answer by username_0 on 2023-03-10. Score: 1 | Accepted answer

I was not loading the `rfPermute` library which caused this issue!


---

### Answer by username_1 on 2023-02-27. Score: 3

Would you post this as an issue on the [banter Github repository](https://github.com/EricArcher/banter) and also send me your `bant.mdl` and `dets_banter` objects together in a single .rdata file so I can try to replicate and debug this error?

Eric

> **Comments:**
> **username_0**: Hi @username_1, I *think* I made some progress on this (I wasn't loading `rfPermute`). I want to run a few more tests and if it i still have a problem, will upload to GH and send you the data objects.  

---

