Skip to content

piti118/pyspr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pyspr

StatPatternRecognition python binding.

Requirement

My version of SPR at https://github.com/piti118/SPR (just 1 method added to access the variable names ordering)

Example

from pyspr import SPR
import numpy as np
spr = SPR('test/cleveland.spr')
print spr.varnames() #print variable names in the right order 
#['age', 'sex', 'cp', 'trestbps', 'chol', 'fbs', 'restecg', 'thalach', 'exang', 'oldpeak', 'slope', 'ca', 'thal']
#i know it needs 13
myvar = [0.5]*13
print spr.response(myvar)
#you can also give it a dictionary make sure you have all the variables or it will raise error
#numpy record works here as well
d ={'age':0.3, 'sex':1, 
    'cp':23, 'trestbps':1.0, 
    'chol':-1, 'fbs':10., 
    'restecg':0.2, 'thalach':0.1, 
    'exang':0.2, 'oldpeak':0.1, 
    'slope':1.0, 'ca':0.3, 
    'thal':0.6}
print spr.response_dict(d)
#vectorize response for recarray is also available with
#spr.vresponse(rec)
#and override column in recarray with keyword arguemnt like this
#spr.vresponse(rec,fbs=numpy_array_with_correct_len)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published