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
function[]=visualize_2D_optimizer(f,traj) | |
%input - trajectory matrix of size (2,n) containing n iterates of 2D optimizer's trajectory, f is a function which evaluates pointwise. | |
x = linspace(-3,3,30); | |
y = linspace(-3,3,30); | |
[X,Y] = meshgrid(x,y); %creating grid of points to evaluate f for the contour. | |
val=zeros(size(X)); | |
for m=1:size(X,1) | |
for n=1:size(X,2) | |
val(m,n)=f([X(m,n);Y(m,n)]); |
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
#improved GIST of https://gist.github.com/MikeOuimet/f50904374651c9c15f236aef3109d57 | |
#allowed backwards compatability by refactoring code involving tf.diag gradients | |
import numpy as np | |
import gym | |
import tensorflow as tf | |
import matplotlib.pyplot as plt | |
def weight_variable(shape): | |
initial = tf.truncated_normal(shape, stddev=0.1) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.