Machine Learning An Algorithmic Perspective

ch2.py

# Code from Chapter 2 of Machine Learning: An Algorithmic Perspective (2nd Edition)

# by Stephen Marsland (http://stephenmonika.net)


# You are free to use, change, or redistribute the code in any way you wish for

# non-commercial purposes, but please maintain the name of the original author.

# This code comes with no warranty of any kind.


# Stephen Marsland, 2008, 2014


# Plots a 1D Gaussian function

from matplotlib import pylab

import pylab as pl

import numpy as np


gaussian = lambda x: 1/(np.sqrt(2*np.pi)*1.5)*np.exp(-(x-0)**2/(2*(1.5**2)))

x = np.arange(-5,5,0.01)

y = gaussian(x)

pl.ion()

pl.plot(x,y,'k',linewidth=3)

pl.xlabel('x')

pl.ylabel('y(x)')

pl.axis([-5,5,0,0.3])

pl.title('Gaussian Function (mean 0, standard deviation 1.5)')

pl.show()

----------------------------------------------------------------------

(base) C:\Users\USERNAME\Desktop>conda activate VIRTUALENV_NAME


(VIRTUALENV_NAME) C:\Users\USERNAME\Desktop>python ch1.py


(VIRTUALENV_NAME) C:\Users\USERNAME\Desktop>python -i ch1.py


- Run cmd

> python -i ch2.py

----------------------------------------------------------------------







댓글

이 블로그의 인기 게시물

WSL2에서 X window를 세팅하는 법

[도서 목차]Do it! 프로그레시브 웹앱 만들기 반응형 웹 개발부터 하이브리드 앱 배포까지 PWA 완전 정복!

메쉬믹서(Meshmixer)] 모델링 부분 제거와 부드럽게 만들기