docstr: Tests that expected continuation works in V=1 case.
  
  In particular this verifies that the regression done to get the expected
  continuation value is performed on those elements which have a positive
  exercise value.
docstr_tok: ["Tests","that","expected","continuation","works","in","V=1","case",".","In","particular","this","verifies","that","the","regression","done","to","get","the","expected","continuation","value","is","performed","on","those","elements","which","have","a","positive","exercise","value","."]
code: def test_expected_continuation(self):
      """Tests that expected continuation works in V=1 case.
  
      In particular this verifies that the regression done to get the expected
      continuation value is performed on those elements which have a positive
      exercise value.
      """
      for dtype in (np.float32, np.float64):
          a = tf.range(start=-2, limit=3, delta=1, dtype=dtype)
          design = tf.concat([a, a], axis=0)
          design = tf.concat([[tf.ones_like(design), design]], axis=1)
  
          # These values ensure that the expected continuation value is `(1,...,1).`
          exercise_now = tf.expand_dims(
              tf.concat([tf.ones_like(a), tf.zeros_like(a)], axis=0), -1
          )
          cashflow = tf.expand_dims(
              tf.concat([tf.ones_like(a), -tf.ones_like(a)], axis=0), -1
          )
  
          expected_exercise = lsm.expected_exercise_fn(
              design, cashflow, exercise_now
          )
          self.assertAllClose(expected_exercise, tf.ones_like(cashflow))
  
file_path: tf-quant-finance/tf_quant_finance/experimental/lsm_algorithm/lsm_test.py
imports: import numpy
  import tensorflow.compat.v2
  from tf_quant_finance.experimental.lsm_algorithm import lsm
  from tf_quant_finance.experimental.lsm_algorithm import payoff
  from tensorflow.python.framework import test_util
label_desc: Use image node_id 4 for calling the LsmTest obj's underlying member method code with example usage: obj.test_expected_continuation() without return types