Skip to content

Instantly share code, notes, and snippets.

denis-bz

Block or report user

Report or block denis-bz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@denis-bz
denis-bz / 0-mopta08-py.md
Last active Nov 3, 2018
Optimizing MOPTA08 (128 variables, 68 constraints) with SLSQP from python
View 0-mopta08-py.md
@denis-bz
denis-bz / Coord-sketch.py
Created Sep 30, 2018
Trivial sketch of a function of n variables: vary one at a time
View Coord-sketch.py
#!/usr/bin/env python2
""" coord_sketch: k * dim func() values, varying one coordinate at a time,
give a cheap starting point for further optimization
especially if func() is monotone, up or down, in each coordinate.
"""
from __future__ import division
import sys
import numpy as np
# from https://github.com/SMTorg/smt Surrogate Modeling Toolbox
@denis-bz
denis-bz / Test-pybobyqa.py
Created Sep 28, 2018
Test Py-BOBYQA sensitivity to rhobeg and rhoend 2018-09-28 Sep
View Test-pybobyqa.py
# Py-BOBYQA example: minimize the Rosenbrock function
# from https://github.com/numericalalgorithmsgroup/pybobyqa
# run this.py [dim= lo= hi= ...] in sh or ipython
# sensitive to rhobeg rhoend:
# $nlopt/bobyqa/bobyqa.c --
# Typically, RHOBEG should be about one tenth of the greatest expected change to a variable,
# while RHOEND should indicate the accuracy that is required in the final values of the variables.
from __future__ import print_function
@denis-bz
denis-bz / Bump.md
Last active Sep 5, 2018
bump.py: Keane's hard-to-optimize function, constrained-random 2018-09-05 Sep
View Bump.md

bump2: an optimization problem from A.J.Keane, https://www.southampton.ac.uk/~ajk/bump.html .

Keywords: optimization, test case, random search, python

Problems in mathematical optimization have several different aspects:

  • contest: whose program reaches minimum __ in cpu time __ and time-to-understand __
  • learning how to explore particular function terrains
  • learning how to constrain.
@denis-bz
denis-bz / Gish.md
Created Jul 10, 2018
Gish: sharing files on gist.github by name 10jul
View Gish.md

Gish: sharing files on gist.github by name

Keywords: file sharing, gist, github, CLI, python, remote file server

gish is a command-line program to copy files between local computers and gist.github.com, using file names or gist ids. An example:

Alice:  gish put @Alice AA.md aa.py bb.py  # upload a gist with 3 files
@denis-bz
denis-bz / noisyUSV.py
Created May 15, 2018
noisyUSV: what is the effect of noise on the covariance of n x d rank r ?
View noisyUSV.py
#!/usr/bin/env python2
""" A = noisyUSV( n, d, r, noise ): U S V + noise, n x d, rank r """
from __future__ import division
import numpy as np
from numpy.linalg import norm
from etc import znumpyutil as nu
__version__ = "2018-05-15 May denis-bz-py t-online de" # scale noise * S.max
@denis-bz
denis-bz / Munich-NO2.md
Last active Aug 26, 2017
NO2 in Munich, 2016
View Munich-NO2.md

NO2 in Munich 2016: high traffic => high NO2

2016-mu5-hours-junedec

This plot shows NO2 levels over the day in Munich in June and December 2016. München-Landshuter-Allee on the left has about the highest NO2 levels in all Germany, and a lot of traffic — 120,000 to 150,000 cars and light trucks per day.
Surprise: high traffic => high NO2.

@denis-bz
denis-bz / 0-EPA-air-quality.md
Last active Jul 29, 2017
EPA air quality: NO2 in Phoenix New York San Diego 2016 2017-07-29 Jul
View 0-EPA-air-quality.md
@denis-bz
denis-bz / 0-Gradient-descent-with-0-crossing.md
Last active Jun 20, 2017
Gradient descent with 2-point line fit where gradients cross 0 2017-06-20 Jun
View 0-Gradient-descent-with-0-crossing.md

Gradient descent with 2-point line fit where gradients cross 0

The Gradient_descent method iterates

xnew = xold - rate(t) * grad(xold)

GD is a workhorse in machine learning, because it's so simple, uses gradients only (not function values), and can do very big x.

rate(t) is a step-size or "learning rate" (aka η, Greek eta).

@denis-bz
denis-bz / half-brokenstick.py
Created Apr 29, 2017
How many of the longest pieces of a randomly-broken stick add up to half its length ?
View half-brokenstick.py
#!/usr/bin/env python2
""" How many of the longest pieces of a randomly-broken stick add up to half its length ? """
# http://demonstrations.wolfram.com/BrokenStickRule
from __future__ import division
import sys
import numpy as np
__version__ = "2014-10-26 oct denis-bz-py t-online de"
np.set_printoptions( 1, threshold=100, edgeitems=5, suppress=True )
You can’t perform that action at this time.