摘要:
from sklearn import neighbors from sklearn import datasets knn = neighbors.KNeighborsClassifier() iris = datasets.load_iris() print (iris) knn.fit(iris.data, iris.target) predictedLabel ... 阅读全文
摘要:
from sklearn.feature_extraction import DictVectorizer import csv from sklearn import tree from sklearn import preprocessing from sklearn.externals.six import StringIO allElectro... 阅读全文
摘要:
网上教程太啰嗦,本人最讨厌一大堆没用的废话,直接上,就是干! 网络爬虫?非监督学习? 只有两步,只有两个步骤? Are you kidding me? Are you ok? 来吧,follow me, come on! 第一步:首先,我们从网上获取图片自动下载到自己电脑的文件内,如从网址,下载到F 阅读全文
摘要:
#!/usr/bin/python # coding:utf-8 from PIL import Image, ImageDraw from HierarchicalClustering import hcluster from HierarchicalClustering import getheight from HierarchicalClustering import get... 阅读全文
摘要:
from numpy import * class cluster_node: def __init__(self,vec,left=None,right=None,distance=0.0,id=None,count=1): self.left=left self.right=right self.vec=vec ... 阅读全文
摘要:
# coding=gbk import urllib.request import re import os import urllib def getHtml(url): #指定网址获取函数 page = urllib.request.urlopen(url) html = page.read() return html.decode('UTF-8') def g... 阅读全文
摘要:
import numpy as np def kmeans(X, k, maxIt): numPoints, numDim = X.shape dataSet = np.zeros((numPoints, numDim + 1)) dataSet[:, :-1] = X centroids = dataSet[np.random.randint... 阅读全文
摘要:
import numpy as np from astropy.units import Ybarn import math from statsmodels.graphics.tukeyplot import results def computeCorrelation(X, Y): xBar = np.mean(X) yBar = np.mean(Y) SS... 阅读全文
摘要:
import numpy as np from sklearn.datasets import load_digits from sklearn.metrics import confusion_matrix, classification_report from sklearn.preprocessing import LabelBinarizer from NeuralNetwork ... 阅读全文
摘要:
from numpy import genfromtxt from sklearn import linear_model datapath=r"Delivery_Dummy.csv" data = genfromtxt(datapath,delimiter=",") x = data[1:,:-1] y = data[1:,-1] print (x) print (y) m... 阅读全文