Beispiel #1
0
import numpy as np
import scipy as sp
import matplotlib as mpl
import matplotlib.cm as cm
import matplotlib.pyplot as plt
import pandas as pd
pd.set_option('display.width', 500)
pd.set_option('display.max_columns', 100)
pd.set_option('display.notebook_repr_html', True)
import seaborn as sns
sns.set_style("whitegrid")
sns.set_context("poster")

# RVM
from skrvm import RVC
clf = RVC()

### read data from single csv file and transform to a list
dir = '/Users/weng/Downloads/'
# raw = pd.read_csv(os.path.join(dir, 'test.txt'), header=0, delimiter=';')
raw_list = pd.read_csv(os.path.join(dir, 'test.txt'), sep="\t", header=None)
# array format is needed for further processing (df -> list -> matrix(array) )
raw_X = raw_list[0].values.tolist()
raw_X = np.asarray(raw_X)

raw_y = raw_list[1].values.tolist()
raw_y = np.asarray(raw_y)

print "Read %d rows of data\n" % len(raw)

clf.fit(raw_X, raw_y)