This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from sklearn.tree import DecisionTreeRegressor | |
class LeastSquares: | |
@staticmethod | |
def negative_gradient(preds, y): | |
return y - preds | |
class GradientBoostingRegressor: | |
models = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# pylint: disable=line-too-long, unused-argument, invalid-name, too-many-arguments, too-many-locals | |
""" | |
Utilities to support integration of Vowpal Wabbit and scikit-learn | |
""" | |
import numpy as np | |
import sklearn | |
from pyvw import vw | |
import re |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import networkx as nx | |
def hamilton(G): | |
F = [(G,[list(G.nodes())[0]])] | |
n = G.number_of_nodes() | |
while F: | |
graph,path = F.pop() | |
confs = [] | |
neighbors = (node for node in graph.neighbors(path[-1]) | |
if node != path[-1]) #exclude self loops |