Skip to content

Instantly share code, notes, and snippets.

@allisterb
Last active August 23, 2018 16:58
Show Gist options
  • Save allisterb/82f9d6750f1edda047f92a6d3aa9c49b to your computer and use it in GitHub Desktop.
Save allisterb/82f9d6750f1edda047f92a6d3aa9c49b to your computer and use it in GitHub Desktop.
Lokad Logistic Regression kernel using Adrien
int ClientsDim = 2276210, ProductsDim = 58989, HDim = 24, LDim = 1;
Vector clients = new Vector("clients", ClientsDim), products = new Vector("products", ProductsDim), labels = new Vector(HDim);
var (W0, W1) = Tensor.TwoD("W0", (HDim, ClientsDim), "i", out Index i, out Index j).Two();
var (b0, b1) = new Scalar("b0", HDim).Two();
var E1 = W0 * clients + b0;
var E2 = W1 * products + b1;
var z = new Scalar("z", SUM[E1 * E2]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment