Module 4 - Hands-On Deep Learning


Back to Package

Deep learning (DL) is a driving force for many of the artificial intelligence applications changing the world today in areas like image recognition and self-driving cars. In this hands-on module you will apply neural networks to practical examples.

Learning Outcomes
  • Select the appropriate deep learning task for a real-world application
  • Use a dataset to fit a new model  
  • Build a deep learning model based on business application
  • Assess the model performance in terms by error metrics for the DL task.

Key:

Complete
Failed
Available
Locked
Session 1(Slides & Replay): Hands-On Deep Learning
Click on View to access the replay and the slides
Click on View to access the replay and the slides Slides and Replay of our first ML Foundations Course session Module 4.
Deep Learning Walkthrough Hands-On Assignment in H2O-3
Select the "Read" button to begin.
Select the "Read" button to begin. This is the hands-on exercise wherein you will be doing a walkthrough to observe how to train a Deep Neural Network using H2O-3.
Quiz 1: First Look at Neural Networks & Intro to H2O-3 Deep Learning
10 Questions  |  5 attempts  |  8/10 points to pass
10 Questions  |  5 attempts  |  8/10 points to pass
Session 2(Slides and Replay): Diving into Deep Learning: PyTorch & TensorFlow Models with Driverless AI
Click on View to access the replay and the slides
Click on View to access the replay and the slides Slides and Replay of our second ML Foundations Course session Module 4.
Deep Learning Walkthrough Hands-On Assignment Part 2
Select the "Read" button to begin.
Select the "Read" button to begin.
You must be logged in to post to the discussion
  • SB

    Hi Rino, Terrance

    Based on first scan, I think the errors are due to executing the code out of order, I'd be happy to assist in debugging this code during the weekly AMA call

    Reply
  • RS

    I cannot find the Tutorial notebook for the

    Session 10: ML Foundations Course - PyTorch & TensorFlow Models with Driverless AI Reply
  • TR

    By the way this is from "Deep Learning Walkthrough Hands-On Assignment in H2O-3

    Reply
  • TR

    As with Rino, I could not execute the code in the last section "Task 8: Evaluation".  The  following command errors out:

    h2o_predictions = predictions.as_data_frame()

    I get the following error.

    NameError Traceback (most recent call last) <ipython-input-26-4b95907fd17b> in <module>() 58 ---> 59 h2o_predictions = predictions.as_data_frame() 60 61 figure() NameError: name 'predictions' is not defined Reply
  • RS

    %matplotlib inline
    from sklearn.metrics import roc_curve, precision_recall_curve, auc
    import matplotlib.pyplot as plt
    import numpy as np
     
     
    def get_auc(labels, scores):
        fpr, tpr, thresholds = roc_curve(labels, scores)
        auc_score = auc(fpr, tpr)
        return fpr, tpr, auc_score
     
     
    def get_aucpr(labels, scores):
        precision, recall, th = precision_recall_curve(labels, scores)
        aucpr_score = np.trapz(recall, precision)
        return precision, recall, aucpr_score
     
     
    def plot_metric(ax, x, y, x_label, y_label, plot_label, style="-"):
        ax.plot(x, y, style, label=plot_label)
        ax.legend()
        
        ax.set_ylabel(x_label)
        ax.set_xlabel(y_label)
     
     
    def prediction_summary(labels, predicted_score, predicted_class, info, plot_baseline=True, axes=None):
        if axes is None:
            axes = [plt.subplot(1, 2, 1), plt.subplot(1, 2, 2)]
     
        fpr, tpr, auc_score = get_auc(labels, predicted_score)
        plot_metric(axes[0], fpr, tpr, "False positive rate",
                    "True positive rate", "{} AUC = {:.4f}".format(info, auc_score))
        if plot_baseline:
            plot_metric(axes[0], [0, 1], [0, 1], "False positive rate",
                    "True positive rate", "baseline AUC = 0.5", "r--")
     
        precision, recall, aucpr_score = get_aucpr(labels, predicted_score)
        plot_metric(axes[1], recall, precision, "Recall",
                    "Precision", "{} AUCPR = {:.4f}".format(info, aucpr_score))
        if plot_baseline:
            thr = sum(labels)/len(labels)
            plot_metric(axes[1], [0, 1], [thr, thr], "Recall",
                    "Precision", "baseline AUCPR = {:.4f}".format(thr), "r--")
     
        plt.show()
        return axes
     
     
    def figure():
        fig_size = 4.5
        f = plt.figure()
        f.set_figheight(fig_size)
        f.set_figwidth(fig_size*2)
     
     
    h2o_predictions = predictions.as_data_frame()
     
    figure()
    axes = prediction_summary(
        h2o_predictions["class"], h2o_predictions["predict"], h2o_predictions["predicted_class"], "h2o")


    gives this error:

    --------------------------------------------------------------------------- NameError Traceback (most recent call last) <ipython-input-34-aa4f7c225563> in <module> 55 56 ---> 57 h2o_predictions = predictions.as_data_frame() 58 59 figure() NameError: name 'predictions' is not defined
    Reply
  • RS

    Same as below, the following script:


    #Epochs, Overfit and Dropout
    cars_dl = H2ODeepLearningEstimator(activation='tanhwithdropout',
                                       epochs=20,
                                       hidden=[200,200],
                                       hidden_dropout_ratios=[0.5,0.5],
                                       seed=1234,
                                       mini_batch_size=32,
                                       rate=0.01,
                                       l2=1e-5,
                                       #l1=1e-5)

    cars_dl.train(x=predictors,
                  y=response,
                  training_frame=train,
                  validation_frame=valid)
                                       
    cars_dl.mse()

    gives this error: File "<ipython-input-20-b8ca4bbe0eff>", line 17 cars_dl.mse() ^ SyntaxError: invalid syntax


    Reply
  • RS

    The script blow:

    import h2o
    h2o.init()

    train = h2o.import_file("https://s3.amazonaws.com/h2o-public-test-data/bigdata/laptop/mnist/train.csv.gz")
    test = h2o.import_file("https://s3.amazonaws.com/h2o-public-test-data/bigdata/laptop/mnist/test.csv.gz")
    predictors = list(range(0,784))
    resp = 784
    train[resp] = train[resp].asfactor()
    test[resp] = test[resp].asfactor()
    nclasses = train[resp].nlevels()[0]
    model = H2ODeepLearningEstimator(activation="RectifierWithDropout",
                                     adaptive_rate=False,
                                     rate=0.01,
                                     rate_decay=0.9,
                                     rate_annealing=1e-6,
                                     momentum_start=0.95,
                                     momentum_ramp=1e5,
                                     momentum_stable=0.99,
                                     nesterov_accelerated_gradient=False,
                                     input_dropout_ratio=0.2,
                                     train_samples_per_iteration=20000,
                                     classification_stop=-1,
                                     l1=1e-5)
    model.train (x=predictors,y=resp, training_frame=train, validation_frame=test)
    model.model_performance(valid=True)

    gives this error:

    Parse progress: |█████████████████████████████████████████████████████████| 100% Parse progress: |█████████████████████████████████████████████████████████| 100% --------------------------------------------------------------------------- NameError Traceback (most recent call last) <ipython-input-1-ae62cb726de2> in <module> 9 test[resp] = test[resp].asfactor() 10 nclasses = train[resp].nlevels()[0] ---> 11 model = H2ODeepLearningEstimator(activation="RectifierWithDropout", 12 adaptive_rate=False, 13 rate=0.01, NameError: name 'H2ODeepLearningEstimator' is not defined Reply
  • RS

    Always in: Deep Learning Walkthrough Hands-On Assignment in H2O-3


    "Here we are trying to predict the response variable, i.e. the number of cylinders based on other properties of the (blank)"

    Reply
  • RS

    http://docs.h2o.ai/h2o/latest-...

    Getting Started with Sparkling Water

    Wrong word with link: should be

    Download Sparkling Water: go here to download Sparkling Water.

    Reply
  • RS

    Same as below:

    1. Startup an H2O Cluster
    2. Import necessary packages
    3. Import the Credit Card dataset
    4. Train an isolation forest
    5. Inspect the Predictions

    Should be:

    1. Import the cars-mileage datase;
    2. Train a DNN model;
    Reply
  • RS

    https://training.h2o.ai/webina... (DL Walkthrough in Sparkpling Water tutorial). Faulty description ?

    In this notebook, you will:

    1. Startup an H2O Cluster
    2. Import necessary packages
    3. Import the Credit Card dataset
    4. Train an isolation forest
    5. Inspect the Predictions

    in contrast with the following one:

    #Import the dataset cars = h2o.import_file("https://s3.amazonaws.com/h2o-public-test-data/smalldata/junit/cars_20mpg.csv") cars Reply
  • FV

    All, quiz 1 has been revised and has been updated accordingly. We have also granted 2 extra attempts for everyone. 

    Reply
  • rn

    I somehow felt that some of the questions in this particular quiz are really ambiguous. Appreciate if you can please look in to it. I could score only a max of 7 in 3 attempts. 

    Reply
  • AA

    I also had the same problem, it may be that I did not actually understand certain issues, but in this case I ask you the courtesy to review the wrong answers together

    Reply