import tensorflow as tf

    # The final prediction is the average of the predictions for each word
    # weighted by the individual confidence/utility scores.

    wvs = tf.pack(self._inputs)
    wvs_weighted = tf.mul(tf.reshape(tf.transpose(self.cs), [-1, 1]),
                          tf.reshape(wvs, [-1, in_size]))
    wvs_weighted_reshaped = tf.reshape(wvs_weighted, wvs.get_shape())
    wvsum = tf.reduce_sum(wvs_weighted_reshaped,0)

    pred_mat = tf.get_variable('pred_mat', [in_size, self._out_vocab_size])
    pred_bias = tf.get_variable('pred_bias', [self._out_vocab_size])

    # Make a prediction for each tweet.
    def GetWordPred(o_):
      logits = tf.nn.xw_plus_b(o_, pred_mat, pred_bias)
      return tf.nn.softmax(logits)

    preds = GetWordPred(wvsum)
    z = tf.tile(tf.reshape(tf.reduce_sum(preds,1),[-1,1]), [1, out_vocab_size])
    self.preds, self.z = preds, z
    self.probs = tf.div(preds, z) #normalize
    self.unweighted_xent = _SafeXEnt(self.y, self.probs)

    self._xent = _SafeXEnt(self.y, self.probs, class_weights=weights)

    self.cost = tf.reduce_mean(self.example_weights * self._xent)


