Skip to content

Instantly share code, notes, and snippets.

@geroembser
Last active April 1, 2021 16:00
Show Gist options
  • Save geroembser/7c7fa13aa3772dd0d719e53469d8ed81 to your computer and use it in GitHub Desktop.
Save geroembser/7c7fa13aa3772dd0d719e53469d8ed81 to your computer and use it in GitHub Desktop.
name: ml-environment
channels:
- conda-forge
dependencies:
- python
- numpy
- pip
- pip:
- nbgitpuller
- sphinx-gallery
- pandas
- matplotlib
- scikit-learn
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import numpy,matplotlib
import matplotlib.pyplot as plt
def render(x,w,h,vmax=0.1):
x = x.reshape([h,w,62,47])
z = numpy.ones([h,w,64,49])*vmax
z[:,:,1:-1,1:-1] = x
x = z.reshape([h,w,64,49]).transpose([0,2,1,3]).reshape([h*64,w*49])
plt.figure(figsize=(0.49*2*w,0.64*2*h))
plt.imshow(x,cmap=plt.cm.gray,vmin=-vmax,vmax=vmax)
plt.axis('off')
plt.show()
def scatterplot(x,y,xlabel='',ylabel=''):
plt.figure(figsize=(3,3))
plt.xlabel(xlabel)
plt.ylabel(ylabel)
plt.plot(x,y,'.')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment