Homework Week3

Todo

  1. Ensure Rahul is added as a collaborator to your Github repo
  2. In a new directory w3, using the test engine from week1, address the following problems. Write code and unit tests. Collect out from your system that shows things load and run. Submit a pointer to that w3 directory.

Note that the following offers a full implementation of everything you need to do... in another language (Lua). Your job is to use the Lua code as inspiration to build your Python.

Fear not the Lua. Its a pretty simple language. Very Python-like. But it has no classes so it has certain kuldges.

We'll talk to it in class.

Three Incremental Sampling Methods

An incremental sampling methods runs over the data once, updating its internal measures as it goes.

A reservoir sampler keeps a fixed number of items (and if it sees more, it deletes existing ones at random).

A Gaussian sampler incrementally updated means and standard deviations.

A entropy sampler incrementally updates the ratios at which various symbols are used.

The first two are for numbers and the last is for symbols.

FYI: my implementation of the second uses the first as a sub-routine.

The directory https://github.com/timm/lean/blob/master/tests/ contains unit tests for in sample.lua, num.lua, sym.lua. which are (respectively) a reservoir sampler ; a Gaussian sampler; and a entropy sampler.

Port the unit tests to my test engine method O.k. Use those tests to check your Python versions of sample.lua, num.lua, sym.lua in https://github.com/timm/lean/blob/master/src/. the directory