title: Why does function: Score return error: unable to find an inherited method for function ‘score’ for signature ‘"bn"’
body: <p>I want to show the score for a Bayesian network.</p>
  <p>I'm not yet experienced in correcting errors that occur, so I hope that someone here knows how to solve it.</p>
  <p>Here is the code I'm running:</p>
  <pre><code>library(bnlearn)
  library(Rgraphviz)
  library(gRain)
  library(graph)
  library(grid)
  library(snow)
  
  data(&quot;learning.test&quot;)
  bn.AB &lt;- gs(learning.test, blacklist = c(&quot;B&quot;, &quot;A&quot;))
  score(bn.AB, learning.test, type = &quot;bde&quot;)
  </code></pre>
  <p>The result should say: -24002.36</p>
  <p>This is the error that is produced:</p>
  <blockquote>
  <p>Error in (function (classes, fdef, mtable)  :<br />
  unable to find an inherited method for function ‘score’ for signature ‘&quot;bn&quot;’</p>
  </blockquote>
  <p>It seems to be a problem related to the <code>score</code> function, from the <code>bnlearn</code> package, asking for object of S4 form, but &quot;bn&quot; being S3.</p>
  <p>This is the post that pointed in that direction:
  <a href="https://stackoverflow.com/questions/36943201/what-does-this-mean-unable-to-find-an-inherited-method-for-function-a-for-sig">What does this mean: unable to find an inherited method for function ‘A’ for signature ‘&quot;B&quot;’</a></p>
  <p>I hope someone will assist in solving it.</p>