Skip to content

Instantly share code, notes, and snippets.

{
"cells": [
{
"cell_type": "code",
"execution_count": 125,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
vw train.vw -c --passes 4 -f model.vw --loss_function logistic --interactions ci -b 26
package vw;
import java.io.*;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
def lin(params,x):
return params[0]*x + params[1]
def linear_gradients(params_to_learn,x,y):
a = params_to_learn[0]
b = params_to_learn[1]
de_da = 2*x*(a*x+b-y)
de_db = 2*(a*x+b-y)
return [de_da,de_db]