摘要: # 习题2# 2.1x=c(1,2,3)y=c(4,5,6)e=c(rep(1,3))z=2*x+y+e;zx%*%y # 若x,y如答案那样定义为矩阵,则不能用%*%,因为,维数不对应,x%o%y # 答案x<-matrix(1:3,nrow=3)y<-matrix(4:6,nrow=3)e<-m... 阅读全文
posted @ 2015-02-28 17:25 monlh 阅读(1218) 评论(0) 推荐(0) 编辑
摘要: The time i have tried to install the package named 'PODBC' and it worked.But now i meet a problem with package named 'pmg' again.> install.packages('p... 阅读全文
posted @ 2015-02-09 13:51 monlh 阅读(190) 评论(0) 推荐(0) 编辑
摘要: Today, i try to install a package in R named 'DOBDC', while i meet a message:> install.packages('RODBC')package ‘RODBC’ is available as a source packa... 阅读全文
posted @ 2015-02-09 12:51 monlh 阅读(2154) 评论(0) 推荐(0) 编辑
摘要: 1 import tt 2 import numpy as np 3 import random 4 import time 5 st = time.time() 6 7 def wTx(alpha, trainx, trainy): return np.dot(trainx, n... 阅读全文
posted @ 2015-01-30 03:23 monlh 阅读(201) 评论(0) 推荐(0) 编辑
摘要: >>> map(int,'0')[0]>>> int('-1')-1>>> map(int, l[1])Traceback (most recent call last): File "", line 1, in ValueError: invalid literal for int() with... 阅读全文
posted @ 2015-01-28 00:40 monlh 阅读(2363) 评论(0) 推荐(0) 编辑
摘要: 1 >>> l 2 '3.542485\t1.977398\t-1\r\n' 3 >>> l.split() 4 ['3.542485', '1.977398', '-1'] 5 >>> l=l.split() 6 >>> l[:2] 7 ['3.542485', '1.977398'] 8 >>... 阅读全文
posted @ 2015-01-27 23:30 monlh 阅读(9093) 评论(0) 推荐(0) 编辑
摘要: 1 from numpy import * 2 import random 3 import time 4 st = time.time() 5 6 def loaddata(filename): 7 fr = open(''.join([filename, '.txt']... 阅读全文
posted @ 2015-01-27 02:39 monlh 阅读(234) 评论(0) 推荐(0) 编辑
摘要: from numpy import *import timestarttime = time.time()def loadDataSet(): postingList = [['my', 'dog', 'has', 'flea', 'problems',... 阅读全文
posted @ 2015-01-26 03:07 monlh 阅读(231) 评论(0) 推荐(0) 编辑
摘要: 1 ################################################## 2 # kNN : k Nearest Neighbour 3 # Author : Monne 4 # Date : 2015-01-24 5 # Email : 41660663... 阅读全文
posted @ 2015-01-24 21:46 monlh 阅读(241) 评论(0) 推荐(0) 编辑
摘要: 最近学习python,记录学习的点滴。>>> import numpy as np>>> a = np.array([[1,2],[3,4]])>>> b=a.tolist()>>> b[[1, 2], [3, 4]] 阅读全文
posted @ 2015-01-23 23:20 monlh 阅读(17554) 评论(3) 推荐(0) 编辑