Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A Python interface to rusvm

NotificationsYou must be signed in to change notification settings

wotzlaff/rusvm-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Python interface torusvm.

Installation

pip install rusvm

Example

Seesimple.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')

Build

maturin develop --release

Languages


[8]ページ先頭

©2009-2025 Movatter.jp