GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — machinelearningclassification/module6.py at master · cambridgecoding/machinelearningclassification Expand file tree/ Copy pathmodule6.pyMore file actions 33 lines (28 loc) · 980 Bytes / Copy pathmodule6.pyFile metadata and controls33 lines (28 loc) · 980 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 import csv import numpy import scipy import matplotlib.pyplot as plt from sklearn import preprocessing from sklearn.cross_validation import train_test_split from sklearn import metrics from sklearn import neighbors import knnplots from sklearn.naive_bayes import GaussianNB from sklearn import cross_validation from sklearn.grid_search import GridSearchCV #Code common to all modeles from module 3 onwards ##NB. The X and yTransformed variables come from the preprocessing in the previous module. fileName = "wdbc.csv" fileOpen = open(fileName, "rU") csvData = csv.reader(fileOpen) dataList = list(csvData) dataArray = numpy.array(dataList) X = dataArray[:,2:32].astype(float) y = dataArray[:, 1] le = preprocessing.LabelEncoder() le.fit(y) yTransformed = le.transform(y) XTrain, XTest, yTrain, yTest = train_test_split(X, yTransformed) knnK3 = neighbors.KNeighborsClassifier(n_neighbors = 3) knnK15 = neighbors.KNeighborsClassifier(n_neighbors = 15) nbmodel = GaussianNB() |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |