- Notifications
You must be signed in to change notification settings - Fork0
wotzlaff/rusvm-python
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
A Python interface torusvm.
pip install rusvmSeesimple.py.
importrusvmimportnumpyasnpimportmatplotlib.pyplotasplt# generate sample datasetn=20np.random.seed(42)x=np.random.rand(n)y=np.sin(2.0*np.pi*x)# define parameters for training problem# regularization parameterlmbda=1.0# scaling parametergamma=10.0# solve training problemres=rusvm.solve_smo(x=np.sqrt(gamma)*x[:,None],y=y,params_problem=dict(lmbda=lmbda,kind='regression', ),params_smo=dict(time_limit=1.0, ))print(res['opt_status'])a=np.array(res['a'])/lmbdaa=a[:n]+a[n:]# generate reference pointsxplot=np.linspace(0.0,1.0,100)# evaluate decision function at reference pointsk=np.exp(-gamma* (xplot[:,None]-x[None, :])**2)yplot=k.dot(a)+res['b']# plot training points and decision functionplt.plot(x,y,'kx')plt.plot(xplot,yplot,'r')
maturin develop --releaseAbout
A Python interface to rusvm
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.