Loading Training and Testing Data sets



    The code reads in two CSV files and stores the data into two arrays. The first array, x_train, stores the training data and the second, y_train, stores the testing data. The code then returns the arrays x and y. x stores the input data and y stores the output data.

    def readucr(filename):
      data = np.loadtxt(filename, delimiter=",")
      y = data[:, 0]
      x = data[:, 1:]
      return x, y.astype(int)
    x_train, y_train = readucr("EDXRF_HC_TRAINING.csv")
    x_test, y_test = readucr("EDXRF_HC_TESTING.csv")
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.