Flash Sale: Flat 70% + Addl. 25% Off on all Courses | Use Coupon DS25 in Checkout | Offer Expires In

  Enroll Now

Splitting the Data

Let us split the closing_stock into 3 parts, for training, validation, and testing purposes.

Let us have 80% of the data in the train set, 10% in the validation set, and the remaining 10% in the test set.

INSTRUCTIONS
  • Copy-paste the following to get the lengths of each set.

    n_train = int(len(closing_stock) * 0.80)
    n_remaining = len(closing_stock) - n_train
    
    n_val = int(n_remaining*0.50)
    n_test = n_remaining - n_val 
    print("Train samples:",n_train, "Validation Samples:",n_val,"Test Samples:", n_test)
    
  • Now, slice the closing_stock from 0 till n_train to form the train_data set.

    train_data = closing_stock[0:n_train]
    print(train_data.shape)
    
  • Similarly, slice the closing_stock from n_train till n_train+n_val to form the val_data, the validation set.

    val_data = closing_stock<< your code comes here >>
    print(val_data.shape)
    
  • Very similarly, slice the closing_stock from n_train+n_val till the end to form the test_data set.

    test_data = closing_stock<< your code comes here >>
    print(test_data.shape)
    

No hints are availble for this assesment

Answer is not availble for this assesment


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

Loading comments...