91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小:
    文件類型: .zip
    金幣: 1
    下載: 0 次
    發布日期: 2023-08-03
  • 語言: 其他
  • 標簽: 機器學習??

資源簡介

鄭捷《機器學習算法原理與編程實踐》第2-9章各章節的算法源碼及數據集

資源截圖

代碼片段和文件信息

from?numpy?import?*
import?matplotlib.pyplot?as?plt
import?sys

def?LongToInt(value):
????assert?isinstance(value?(int?long))
????return?int(value?&?sys.maxint)

def?loadDataSet(fileName)?:
recordlist?=?[]
fp?=?open(fileName“rb“)
content?=?fp.read()
fp.close()
rowlist?=?content.splitlines()
#print?rowlist
recordlist?=?[map(evalrow.split(“\t“))?for?row?in?rowlist?if?row.strip()]
#recordlist?=?[row.split(‘\t‘)?for?row?in?rowlist?if?row.strip()]
mn?=?shape(recordlist)
dataSet?=?mat(recordlist)[::-1]
for?i?in?xrange(m)?:
if?recordlist[i][-1]?==?0.0?:
recordlist[i][-1]?=?-1.0
labels?=?mat(recordlist)[:-1].T
return?dataSetlabels

def?plotROC(predStrengthsclassLabels)?:
# mn?=?shape(classLabels)
# print?mn
# print?type(classLabels)
# print?classLabels
cur?=?(1.01.0)
ySum?=?0.0
numPosClas?=?sum(array(classLabels)?==?1.0)
yStep?=?1/float(numPosClas)
xStep?=1/float(len(classLabels)?-?numPosClas)
sortedIndicies?=?predStrengths.argsort()
# print?sortedIndicies
fig?=?plt.figure()
fig.clf()
ax?=?plt.subplot(111)
for?index?in?sortedIndicies.tolist()[0]?:
if?classLabels[0index]?==?1.0?:
delX?=?0
delY?=?yStep
else?:
delX?=?xStep
delY?=?0
ySum?+=?cur[1]
ax.plot([cur[0]cur[0]?-?delX][cur[1]cur[1]-delY]c=‘b‘)
cur?=?(cur[0]?-?delXcur[1]-delY)
ax.plot([01][01]‘b--‘)
plt.xlabel(‘False?positive?rate‘)
plt.ylabel(‘True?positive?rate‘)
plt.title(‘ROC?curve?for?AdaBoost?horse?colic?datection?system‘)
ax.axis([0101])
plt.show()
print?“the?Area?Under?the?Cure?is:“ySum*xStep

def?decisionTree(dataSetlabellistD)?:
dataMat?=?mat(dataSet)
labelMat?=?mat(labellist).T
mn?=?shape(dataMat)
numSteps?=?10.0
bestFeat?=?{}
bestClass?=?mat(zeros((m1)))
minError?=?inf
for?i?in?xrange(n)?:
#rangeMin?=?dataMat[:i].min()
# print?dataMat[:i]
rangeMin?=?dataMat[:i].min()
rangeMax?=?dataMat[:i].max()
stepSize?=?(rangeMax?-?rangeMin)/numSteps
for?j?in?xrange(-1int(numSteps)?+?1)?:
for?operator?in?[‘lt‘‘gt‘]?:
threshVal?=?(rangeMin?+?float(j)?*?stepSize)
predictedVals?=?splitDataSet(dataMatithreshValoperator)
# print?predictedVals
# ddd
errSet?=?mat(ones((m1)))
errSet[predictedVals?==?labelMat]?=?0
weightedError?=?D.T*errSet
if?weightedError? minError?=?weightedError
bestClass?=?predictedVals.copy()
bestFeat[‘dim‘]?=?i
bestFeat[‘thresh‘]?=?threshVal
bestFeat[‘oper‘]?=?operator
return?bestFeatminErrorbestClass

def?adaBoostTrain(dataSetlabellistnumIt=40)?:
weakClassSet?=?[]
m?=?shape(dataSet)[0]
D?=?mat(ones((m1))/m)
# print?“D?=?“D
aggClassSet?=?mat(zeros((m1)))
for?i?in?xrange(numIt)?:
bestFeaterrorEstClass?=?decisionTree(dataSetlabellistD)
alpha?=?float(0.5?*?log((1-error)/max(error1e-16)))
bestFeat[‘alpha‘]?=?alpha
weakClassSet.append(bestFeat)
wtx?=?multiply(-1*alpha*mat(labellist)

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2017-11-11?10:04??鄭捷《機器學習算法原理與編程實踐》第2-9章節的源代碼及數據集\
?????目錄???????????0??2017-10-01?22:38??鄭捷《機器學習算法原理與編程實踐》第2-9章節的源代碼及數據集\KNN\
?????文件????????2746??2017-10-01?22:38??鄭捷《機器學習算法原理與編程實踐》第2-9章節的源代碼及數據集\KNN\KNN.py
?????目錄???????????0??2017-09-24?16:34??鄭捷《機器學習算法原理與編程實踐》第2-9章節的源代碼及數據集\KNN\__pycache__\
?????文件????????3503??2017-09-24?16:34??鄭捷《機器學習算法原理與編程實踐》第2-9章節的源代碼及數據集\KNN\__pycache__\Nbayes_lib.cpython-34.pyc
?????目錄???????????0??2017-11-11?10:04??鄭捷《機器學習算法原理與編程實踐》第2-9章節的源代碼及數據集\PCA\
?????文件????????2882??2017-11-06?17:26??鄭捷《機器學習算法原理與編程實踐》第2-9章節的源代碼及數據集\PCA\MyPCA.py
?????文件????????4399??2017-11-06?17:26??鄭捷《機器學習算法原理與編程實踐》第2-9章節的源代碼及數據集\PCA\MyPCA.pyc
?????目錄???????????0??2017-11-11?10:04??鄭捷《機器學習算法原理與編程實踐》第2-9章節的源代碼及數據集\PCA\att\
?????目錄???????????0??2017-11-11?10:04??鄭捷《機器學習算法原理與編程實踐》第2-9章節的源代碼及數據集\PCA\att\s1\
?????文件???????10318??1994-04-18?14:17??鄭捷《機器學習算法原理與編程實踐》第2-9章節的源代碼及數據集\PCA\att\s1\1.pgm
?????文件???????10318??1994-04-18?14:07??鄭捷《機器學習算法原理與編程實踐》第2-9章節的源代碼及數據集\PCA\att\s1\10.pgm
?????文件???????10318??1994-04-18?14:17??鄭捷《機器學習算法原理與編程實踐》第2-9章節的源代碼及數據集\PCA\att\s1\2.pgm
?????文件???????10318??1994-04-18?14:17??鄭捷《機器學習算法原理與編程實踐》第2-9章節的源代碼及數據集\PCA\att\s1\3.pgm
?????文件???????10318??1994-04-18?14:17??鄭捷《機器學習算法原理與編程實踐》第2-9章節的源代碼及數據集\PCA\att\s1\4.pgm
?????文件???????10318??1994-04-18?14:17??鄭捷《機器學習算法原理與編程實踐》第2-9章節的源代碼及數據集\PCA\att\s1\5.pgm
?????文件???????10318??1994-04-18?14:07??鄭捷《機器學習算法原理與編程實踐》第2-9章節的源代碼及數據集\PCA\att\s1\6.pgm
?????文件???????10318??1994-04-18?14:07??鄭捷《機器學習算法原理與編程實踐》第2-9章節的源代碼及數據集\PCA\att\s1\7.pgm
?????文件???????10318??1994-04-18?14:07??鄭捷《機器學習算法原理與編程實踐》第2-9章節的源代碼及數據集\PCA\att\s1\8.pgm
?????文件???????10318??1994-04-18?14:07??鄭捷《機器學習算法原理與編程實踐》第2-9章節的源代碼及數據集\PCA\att\s1\9.pgm
?????目錄???????????0??2017-11-11?10:04??鄭捷《機器學習算法原理與編程實踐》第2-9章節的源代碼及數據集\PCA\att\s10\
?????文件???????10318??1994-04-18?14:18??鄭捷《機器學習算法原理與編程實踐》第2-9章節的源代碼及數據集\PCA\att\s10\1.pgm
?????文件???????10318??1994-04-18?14:07??鄭捷《機器學習算法原理與編程實踐》第2-9章節的源代碼及數據集\PCA\att\s10\10.pgm
?????文件???????10318??1994-04-18?14:18??鄭捷《機器學習算法原理與編程實踐》第2-9章節的源代碼及數據集\PCA\att\s10\2.pgm
?????文件???????10318??1994-04-18?14:18??鄭捷《機器學習算法原理與編程實踐》第2-9章節的源代碼及數據集\PCA\att\s10\3.pgm
?????文件???????10318??1994-04-18?14:18??鄭捷《機器學習算法原理與編程實踐》第2-9章節的源代碼及數據集\PCA\att\s10\4.pgm
?????文件???????10318??1994-04-18?14:18??鄭捷《機器學習算法原理與編程實踐》第2-9章節的源代碼及數據集\PCA\att\s10\5.pgm
?????文件???????10318??1994-04-18?14:07??鄭捷《機器學習算法原理與編程實踐》第2-9章節的源代碼及數據集\PCA\att\s10\6.pgm
?????文件???????10318??1994-04-18?14:07??鄭捷《機器學習算法原理與編程實踐》第2-9章節的源代碼及數據集\PCA\att\s10\7.pgm
?????文件???????10318??1994-04-18?14:07??鄭捷《機器學習算法原理與編程實踐》第2-9章節的源代碼及數據集\PCA\att\s10\8.pgm
?????文件???????10318??1994-04-18?14:07??鄭捷《機器學習算法原理與編程實踐》第2-9章節的源代碼及數據集\PCA\att\s10\9.pgm
............此處省略5190個文件信息

評論

共有 條評論