Testing your code

Once a solution seems interesting it's time to test its proper execution within the interface.

The crunch test command allows you to perform a local test of your code, on the public test set provided by the organizer. This test set is purposefully very small and will not be taken into account for the scoring on the public leaderboard.

# Run a local test in a notebook
crunch.test(force_first_train=True, train_frequency=2)
# Run a local test in your terminal
crunch test --no-force-first-train --train-frequency 2
  • This function of the crunch package will run your code locally, simulating how it is called in the cloud

  • You can set up the retraining frequency as you wish

  • A training frequency of 2 means that the system will retrain your model every two dates

  • In a notebook,force_first_train=True indicates that your model will be trained on the first date of the test set

  • Similarly, --no-force-first-train controls the same parameter for terminal calls to the function (Note that in this case, using this flag will do the opposite as force_first_train=True in the notebook case)

Usage: crunch test [OPTIONS]

  Test your code locally.

Options:
  -m, --main-file TEXT       Entrypoint of your code.  [default: main.py]
  --model-directory TEXT     Directory where your model is stored.  [default:
                             resources]

  --no-force-first-train     Do not force the train at the first loop.
  --train-frequency INTEGER  Train interval.  [default: 1]
  --help                     Show this message and exit.

Last updated