Skip to main content

API of gradient descent.

Project description

Usage:

>>> from gradient_api import gradient
>>> r1 = gradient.generate(expr_or_poly1d='x**2+1')
>>> r2 = gradient.generate(expr_or_poly1d=[1,0,1])
>>> print(r1 == r2)
True
>>> print(r1)
{'X': -0.00011417981541647683, 'Y': 1.0000000130370303, 'Gradient': -0.00022835963083295366, 'Numloop': 51}
>>> trainData = pandas.DataFrame(numpy.array([[1,3,5,7],[2,4,6,8]]))
>>> r3 = gradient.generate_2d(trainData)
>>> print(r3)
{'Gradient': array([-1020.54, -1589.21, -3630.29, -5671.37]),
 'Linear_Coef': array([-16.94, -38.6 , -60.26]),
 'Linear_Intercept': -10.83,
 'Numloop': 2,
 'Y': 263786.0329,
 'theta': array([-10.83, -16.94, -38.6 , -60.26])}

Tips:

>>> generate_1d(expr_or_poly1d,init_x=-0.5,step=0.01,num_iters=1e4,showPlot=False,xlimArr=None,ylimArr=None)
>>> generate_2d(dataFrame,step=0.1,num_iters=1e4)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for gradient-api, version 1.2.2
Filename, size & hash File type Python version Upload date
gradient_api-1.2.2-py3.5.egg (5.4 kB) View hashes Egg 3.5
gradient_api-1.2.2.tar.gz (3.8 kB) View hashes Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page