Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
; bayeselo (https://www.remi-coulom.fr/Bayesian-Elo/) will read this file properly. | |
; | |
; Notes | |
; | |
; 1. Use typical chess notation for game results: | |
; - "1-0" for a white win | |
; - "0-1" for a black win | |
; 2. It seems like some chess moves are needed for it to parse properly, which is why | |
; the end of each line has `1. c4 Nf6`. | |
; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
// MIT License | |
// | |
// Copyright (c) 2018 Yuze Huang ([email protected]) | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is | |
// furnished to do so, subject to the following conditions: |
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
# MIT License | |
# | |
# Copyright (c) 2018 Yuze Huang ([email protected]) | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: |
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 cvxopt import matrix, solvers | |
def solve(X, y, l = 0.0): | |
'''Solves the LAD regression problem, which can be formulated as: | |
minimize || X a - y ||_1 + l * || a ||_1 | |
a | |
X: numpy ndarray with shape (n, m) |
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
object LengauerTarjan { | |
// Implement these three yourself | |
def successors(v: Int): Iterable[Int] = ??? | |
def predecessors(v: Int): Iterable[Int] = ??? | |
def numNodes: Int = ??? | |
// Lifted from "Modern Compiler Implementation in Java", 2nd ed. chapter 19.2 | |
def computeDominatorTree(): Array[Int] = { | |
var N = 0 |