Project - Reinforcement Learning - How to make computer learn to play CartPole game

5 / 24

Importing the Modules

  • First, let's import a few common modules.

  • Also, we need to makesure Python 3.5 or later is installed, as well as Scikit-Learn >=0.20 and TensorFlow >= 2.0.

INSTRUCTIONS
  • Import sys and check version:

    import sys
    assert sys.version_info >= (3, 5)
    
  • Import numpy as np.

    import << your code comes here >> as << your code comes here >>
    
  • Import tensorflow as tf.

    import << your code comes here >> as << your code comes here >>
    assert tf.__version__ >= "2.0"
    
  • Import keras from tensorflow.

    from << your code comes here >>  import << your code comes here >>
    
  • Import sklearn.

    import << your code comes here >>
    assert sklearn.__version__ >= "0.20"
    
  • Set the random seed:

    np.random.seed(42)
    tf.random.set_seed(42)
    
  • Import matplotlib.pyplot as plt.

    import << your code comes here >> as << your code comes here >>
    
  • Import matplotlib as mpl.

    import << your code comes here >> as << your code comes here >>
    
  • Set the following for matplotlib figures:

    %matplotlib inline
    mpl.rc('axes', labelsize=14)
    mpl.rc('xtick', labelsize=12)
    mpl.rc('ytick', labelsize=12)
    
Get Hint See Answer


Note - Having trouble with the assessment engine? Follow the steps listed here

Loading comments...