<blockquote>
  <p>I am interested know out how they are calculated to see how I can interpret the results obtained.</p>
</blockquote>

<p>Unfortunately knowing the first does not lead to knowing the second.  </p>

<p>Your question is concerned with contextual bandits, but it is important to note that interpreting model parameters is an issue that also occurs in supervised learning. Machine learning has made progress recently (i.e., my lifetime) largely by focusing concern on quality of predictions rather than meaningfulness of model parameters.  In a <a href="https://towardsdatascience.com/predicting-vs-explaining-69b516f90796" rel="nofollow noreferrer">blog post</a>, Phoebe Wong outlines the issue while being entertaining.</p>

<p>The bottom line is that our models are not causal, so you simply cannot conclude because "the weight of feature X is for arm A is large means that if I were to intervene in the system and increase this feature value that I will get more reward for playing arm A".</p>

<p>We are currently working on tools for model inspection that leverage techniques such as <a href="https://scikit-learn.org/stable/modules/permutation_importance.html" rel="nofollow noreferrer">permutation importance</a> that will help you answer questions like "if I were to stop using a particular feature how would the frequency of playing each arm change for the trained policy".   We're hoping that is helpful information.</p>

<p>Having said all that, let me try to answer your original question ...</p>

<blockquote>
  <p>In vowpawabbit there is an option --audit that prints the weights of the features.</p>
  
  <p>If we have a vw contextual bandit model with four arms, how is this feature weight created?</p>
</blockquote>

<p>The format is documented <a href="https://github.com/VowpalWabbit/vowpal_wabbit/wiki/Audit" rel="nofollow noreferrer">here</a>.  Assuming you are using <code>--cb</code> (not <code>--cb_adf</code>) then there are a fixed number of arms and so the <code>offset</code> field will increment over the arms.  So for an example like </p>

<pre><code>1:2:0.4 |foo bar
</code></pre>

<p>with <code>--cb 4</code> you'll get an audit output with <code>namespace</code> of <code>foo</code>, <code>feature</code> of <code>bar</code>, and <code>offset</code> of 0, 1, 2, and 3.</p>

<p>Interpreting the output when using <code>--cb_adf</code> is possible but difficult to explain succinctly.</p>

<blockquote>
  <p>From what I understand vowpawabbit tries to fit one linear model to each arm.</p>
</blockquote>

<p><strong>Shorter answer</strong>: With <code>--cb_type dm</code>, essentially VW independently tries to predict the average reward for each arm using only examples where the policy played that arm.  So the weight you get from audit at a particular offset N is analogous to what you would get from a supervised learning model trained to predict reward on a subset of the historical data consisting solely of times the historical policy played arm N.  With other <code>--cb_type</code> settings the interpretation is more complicated.</p>

<p><strong>Longer answer</strong>: "Linear model" refers to the representation being used.  VW can incorporate nonlinearities into the model but let's ignore that for now.  "Fit" is where some important details are.  VW takes the partial feedback information of a CB problem (partial feedback = "for this example you don't know the reward of the arms not pulled") and reduces it to a full feedback supervised learning problem (full feedback = "for this example you do the reward of all arms").  The <code>--cb_type</code> argument selects the reduction strategy.  There are several papers on the topic, a good place to start is <a href="https://arxiv.org/abs/1103.4601" rel="nofollow noreferrer">Dudik et. al.</a> and then look for papers that cite this paper. In terms of code, ultimately things are grounded <a href="https://github.com/VowpalWabbit/vowpal_wabbit/blob/master/vowpalwabbit/cb_algs.cc" rel="nofollow noreferrer">here</a>,  but the code is written more for performance than intelligibility.</p>
How `vw --audit` internally computes the weights of the features?
<p>In vowpawabbit there is an option <code>--audit</code> that prints the weights of the features.</p>

<p>If we have a <code>vw</code> contextual bandit model with four arms, how is this feature weight created? </p>

<p>From what I understand vowpawabbit tries to fit one linear model to each arm.</p>

<p>So if weights were calculated using an average across all the arms, then they would correlate with getting a reward generally, instead of which features makes the model pick one variant from another. </p>

<p>I am interested know out how they are calculated to see how I can interpret the results obtained. I tried searching <a href="https://github.com/VowpalWabbit/vowpal_wabbit" rel="nofollow noreferrer">its Github repository</a> but could not find anything meaningful.</p>