Skip to main content

ml4t-coursework

Support package for the ML for Trading courses. It is the plumbing their notebooks run on: the student's project folder, the conformance checks that run when they save a piece of the pipeline they have written, the results log the closing unit reads, and the report they submit. It is named for what it holds rather than for a course, because more than one course installs it.

It is published here so that the first cell of a notebook on a free Colab runtime can be

!pip install -q "ml4t-coursework[data]"

with no account, no credential and no repository to clone. That is the whole reason it is on PyPI.

It also owns the course price panel: the symbol list, the window, the one-time fetch and a one-way fingerprint to check a download against. The dataset note explains what that panel is and why a fresh download differs from the slides in the fourth decimal place. More than one course reads it, which is why the machinery is here rather than inside either of them.

This package is not the course. The video, the reading, the exercises, the checks for understanding and the market data all live elsewhere. What is here is useful mainly to someone enrolled; it is installable by anyone, and it will not teach you anything on its own.

What it does

A notebook opens by saying which course it belongs to. That is what decides the project folder on the student's Drive and which stage names their results rows may carry, so two courses on one Drive never write over each other:

import ml4t_coursework as mlc
mlc.use("foundations")

from ml4t_coursework import save_component, load_component, append_result, report
  • save_component(name, obj) runs the component's contract test, prints what passed and what did not, stamps the verdict, and writes the student's own source to their project folder.
  • load_component(name) returns their implementation when it is conformant and the shipped reference when it is not, and always says which. A wrong Part 4 does not block Part 7.
  • append_result(row) appends one row per pipeline run. The final unit reads three of them against each other and they are written weeks apart, so what persists is the numbers.
  • report(answers) writes the submission report: every component's verdict, the results rows, and the written answers.

status() shows where every component stands; contract(name).describe() shows what any one of them has to satisfy; catalog() lists them all.

A course adds its own components and its own stage names without a change here:

from ml4t_coursework import Course, register_course, add_source

register_course(Course(key="...", title="...", folder="ml4t-...", env_var="ML4T_..._HOME",
                       stages=("...",), terminal_stages=("...",)))
add_source("your_package.components")   # every module in it registers one contract

How the checks work, and what they deliberately do not do

Each component carries a contract asserting properties, never equality with a reference output. Two correct fold splitters legitimately differ, and an equality check would fail correct work and teach the student to copy. Every contract runs the same four gating checks - interface, a leakage probe, determinism, and the component's own domain invariants - plus a reference delta that is reported and never enforced.

A component is validated on its source re-executed in an empty namespace, not on the object in memory, because what a later notebook loads on a cold session is the file. Something that only works because of another cell in the same session fails at save time, with a message naming the missing symbol.

Reference implementations ship with the package. That is by design rather than an oversight: the fallback is what stops one wrong component from blocking the rest of the course, so there is nothing here that could be leaked.

Data

The course's price panel is not distributed with this package and is not ours to redistribute. What ships is everything else - the symbol list, the window, the fetch, and a one-way fingerprint to check a download against:

from ml4t_coursework import data
data.download()     # once, into the project folder
data.load()         # what every notebook reads

Licence

MIT, in line with the other ml4t-* libraries. See LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ml4t_coursework-0.3.0.tar.gz (208.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ml4t_coursework-0.3.0-py3-none-any.whl (73.2 kB view details)

Uploaded Python 3

File details

Details for the file ml4t_coursework-0.3.0.tar.gz.

File metadata

  • Download URL: ml4t_coursework-0.3.0.tar.gz
  • Upload date:
  • Size: 208.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for ml4t_coursework-0.3.0.tar.gz
Algorithm Hash digest
SHA256 2aec38933374430193bba7e26f57f6ce1b9a8a2fbb0d8b22fbf21e986308a448
MD5 7a0ed38333b19f3b716c3109420af8af
BLAKE2b-256 f13252f167e99201de2017f7216b5b6c4d583feb8c80dbf0e9f376899611b14f

See more details on using hashes here.

Provenance

The following attestation bundles were made for ml4t_coursework-0.3.0.tar.gz:

Publisher: release.yml on ml4t/coursework

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ml4t_coursework-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ml4t_coursework-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 be54430ebce00d30b11603c6a93f462ca5138e482cc3c5726c05f9cb4cfdeb59
MD5 bd13c7427372de99f89ddee503441911
BLAKE2b-256 14df43b4c45b31f4021dc51f65eaee7110711c54c2e41a499177c60724ea51dd

See more details on using hashes here.

Provenance

The following attestation bundles were made for ml4t_coursework-0.3.0-py3-none-any.whl:

Publisher: release.yml on ml4t/coursework

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 files

0.2.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page