Skip to content

Instantly share code, notes, and snippets.

@peiqiuhuang
peiqiuhuang / check_convex.py
Created December 23, 2019 13:26 — forked from mblondel/check_convex.py
A small script to get numerical evidence that a function is convex
# Authors: Mathieu Blondel, Vlad Niculae
# License: BSD 3 clause
import numpy as np
def _gen_pairs(gen, max_iter, max_inner, random_state, verbose):
rng = np.random.RandomState(random_state)
# if tuple, interpret as randn
@peiqiuhuang
peiqiuhuang / neat.py
Created September 4, 2019 03:32 — forked from wellecks/neat.py
"""Implementation of NEAT.
python neat.py --task {xor, lunar, cartpole}
See the post at https://wellecks.wordpress.com/ for details.
Parts of this implementation are based on Neat-Python.
"""
from itertools import count
import numpy as np
import math