亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? decision-trees.lisp

?? 決策樹lisp代碼 決策樹lisp代碼
?? LISP
字號:
#| This file contains Decision tree learning code to accompany thetextbook "Machine Learning," Tom M. Mitchell, McGraw Hill, 1997.Copyright 1998 Tom M. Mitchell.  This code may be freely distributedand used for any non-commericial purpose, as long as this copyrightnotice is retained.  The author assumes absolutely no responsibilityfor any harm caused by bugs in the code. 1. OVERVIEWThis file contains a Lisp implementation of the ID3 program forlearning decision trees, as described in Table 3.1 of the textbook"Machine Learning," Tom Mitchell, McGraw Hill, 1997.  It also containsthe set of training examples given in Table 3.2.The code is simple enough that you should be able to inspect andmodify it for your own use.The six key functions are:1. ID3(examples target.attribute attributes)   learns a decision tree, using the algorithm from Table 3.1 in the book2. Classify(instance tree)   Given a new instance and a previously learned tree, returns the    classification of that instance produced by the tree.3. Print.tree(tree)   Prints a tree in human readable form4. Print.entity(instance)   Prints an instance (e.g., one of your training examples)5. Get.value(attribute instance)   Get the value of some ATTRIBUTE of INSTANCE6. Put.value(attribute instance value)   Assign VALUE to ATTRIBUTE of INSTANCE2. EXAMPLE TRACE:After loading this file into CommonLisp, you should be able toduplicate the following trace:;; FIRST LOOK AT THE PROVIDED TRAINING EXAMPLES>> *training.examples*(D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 ...);; USE THE FUNCTION PRINT.ENTITY TO EXAMINE JUST ONE OF THEM>> (print.entity 'd6)(PLAY.TENNIS? NO WIND STRONG HUMIDITY NORMAL TEMPERATURE COOL OUTLOOK RAIN) ;; NOW USE ID3 TO LEARN A TREE>> (setq tree (id3 *training.examples* 		'play.tennis? 		'(outlook temperature humidity wind)))(OUTLOOK (SUNNY (HUMIDITY (NORMAL YES) (HIGH NO)))          (OVERCAST YES)         (RAIN (WIND (STRONG NO) (WEAK YES))));; LOOK AT THE TREE IN A MORE HUMAN-FRIENDLY FORM>> (print.tree tree)OUTLOOK = SUNNY     HUMIDITY      = NORMAL => YES      = HIGH => NO = OVERCAST => YES = RAIN     WIND      = STRONG => NO      = WEAK => YES;; FINALLY, USE THIS LEARNED TREE TO CLASSIFY AN INSTANCE>> (classify 'd6 tree)NO|#;;; General utility functions;; use (print.entity instance) to see the definition of entity (defun put.value (attribute instance val)  "assign a value to an attribute of an instance"  (setf (get instance attribute) val))(defun get.value (attribute instance)  "retrieve the value of attribute of instance"  (get instance attribute))(defun print.entity (instance)  "print the description of instance to the screen"  (print (symbol-plist instance)))(setf *data* ;;;     day outlook temperature humidity wind play.tennis?      '((d1 sunny hot high weak no)        (d2 sunny hot high strong no)        (d3 overcast hot high weak yes)        (d4 rain mild high weak yes)        (d5 rain cool normal weak yes)        (d6 rain cool normal strong no)        (d7 overcast cool normal strong yes)        (d8 sunny mild high weak no)        (d9 sunny cool normal weak yes)        (d10 rain mild normal weak yes)        (d11 sunny mild normal strong yes)        (d12 overcast mild high strong yes)        (d13 overcast hot normal weak yes)        (d14 rain mild high strong no)))(defvar *training.examples* nil);; set up each training example so that GET.VALUE(attribute example) can be used;; to retrieve the value of ATTRIBUTE for EXAMPLE(loop for d in *data* do      (setf *training.examples* (cons (first d) *training.examples*))      (loop for attribute in '(outlook temperature humidity wind play.tennis?)            as value in (cdr d)            do (put.value attribute (first d) value)))(put.value 'legal.values 'play.tennis? '(yes no));;; Top level ID3 Decision Tree learning algorithm;; Tree Representation: each non-terminal tree node is a list of the form ;  (attribute (value1 subtree1)(value2 subtree2)...);  where subtree-n is either a non-terminal node, or a value signifying the ;  target value associated with that terminal node(defun id3 (examples target.attribute attributes)  "TARGET.ATTRIBUTE is the attribute to be predicted by the learned tree.   EXAMPLES are training examples.  ATTRIBUTES is a list of attributes (not   including TARGET.ATTRIBUTE) that may be included in the learned decision    tree.   Returns: a decision tree that predicts the TARGET.ATTRIBUTE over EXAMPLES"  (let (firstvalue a partitions)    (setq firstvalue (get.value target.attribute (first examples)))    (cond      ;; if every example has the same target attribute value, return it as     ;; a leaf node     ((every #'(lambda(e)(eq firstvalue (get.value target.attribute e)))             examples)      firstvalue)     ;; if no attributes, return the most common target attribute value     ((null attributes)      (most.common.value target.attribute examples))     ;; otherwise, pick the best attribute, partition training data, and call     ;; ID3 recursively to grow subtrees below this node     (t      (setq partitions            (loop for a in attributes collect (partition a examples)))      (setq a (choose.best.partition target.attribute partitions))      (cons (first a)            (loop for branch in (cdr a) collect                  (list (first branch)                        (id3 (cdr branch)                              target.attribute                              (remove (first a) attributes)))))))))                  (defun partition (attribute instances)  "returns a partion of INSTANCES according to their values for ATTRIBUTE.    Returns a list (attribute (value1 e11 e12 ...)(value2 e21 e22 ...)...)"  (let (result vlist v)    (loop for e in instances do          (setq v (get.value attribute e))          (if (setq vlist (assoc v result))            (rplacd vlist (cons e (cdr vlist)))            (setq result (cons (list v e) result))))    (cons attribute result)))(defun choose.best.partition (target.attribute partitions)  "return the partition with the highest information gain.     PARTITIONS is of the form ((attribute1 (val1 e11 e12 ...)(val2 e21 e22 ...)...)                              (attribute2 (...  ...........)(...  ...  )...)).   Note for efficiency, we compute only the expected value of the entropy of the   partition, because this is the only term in information gain that varies from   one attribute to another"  (let ((lowest.exp.entropy 9999) exp.entropy best.partition)    (loop for att.partition in partitions do          (when (< (setq exp.entropy                          (expected.entropy target.attribute (cdr att.partition)))                   lowest.exp.entropy)            (setq lowest.exp.entropy exp.entropy)            (setq best.partition att.partition)))    best.partition))(defun expected.entropy (att partition)  "returns the sum over possible values of att of the quantity    number.of.instances.with.this.value x sample.entropy.of.this.partition"  (loop for p in partition sum        (* (length (cdr p))           (loop for v in (get.value 'legal.values att) sum                 (let ((vcount (loop for e in (cdr p) count                                      (eq v (get.value att e))))                       proportion)                   (setq proportion (/ vcount (length (cdr p))));;                   (format t "p: ~S, vcount: ~d, proportion: ~S~%";;                           p vcount proportion)                   (* -1.0 proportion                       (if (zerop proportion) 0 (log proportion 2))))))))(defun most.common.value (attribute instances)  (let ((length 0) longest)    (loop for p in (partition attribute instances) do          (when (> (length p) length)            (setq length (length p))            (setq longest p)))    (car longest)))                   (defun print.tree (tree &optional (depth 0))  (tab depth)  (format t "~A~%" (first tree))  (loop for subtree in (cdr tree) do        (tab (+ depth 1))        (format t "= ~A" (first subtree))        (if (atom (second subtree))          (format t " => ~A~%" (second subtree))          (progn (terpri)(print.tree (second subtree) (+ depth 5))))))(defun tab (n)  (loop for i from 1 to n do (format t " ")));;;******;;  Code to classify a new instance given a tree output by ID3;;(defun classify (instance tree)  (let (val branch)    (if (atom tree) (return-from classify tree))    (setq val (get.value (first tree) instance))    (setq branch (second (assoc val (cdr tree))))    (classify instance branch)))(defun entropy (p)  (+ (* -1.0 p (log p 2))     (* -1.0 (- 1 p) (log (- 1 p) 2))))

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
午夜精品久久久久久不卡8050| 国产精品理伦片| 亚洲免费观看视频| 欧美揉bbbbb揉bbbbb| 免费高清不卡av| 国产欧美一区二区精品忘忧草| 成人免费av资源| 亚洲国产精品欧美一二99| 精品久久一区二区三区| 91在线精品一区二区三区| 日韩精品电影在线观看| 欧美激情在线一区二区| 欧美人体做爰大胆视频| 成人动漫一区二区在线| 美女视频黄免费的久久| 亚洲最新视频在线播放| 精品久久久久久久久久久久久久久| 欧美久久久久久久久中文字幕| 99国产欧美另类久久久精品| 色综合久久中文字幕| 粉嫩av一区二区三区| 麻豆精品视频在线观看免费| 国产自产高清不卡| 久久66热偷产精品| 男人的天堂久久精品| 国产美女av一区二区三区| 美女脱光内衣内裤视频久久网站 | 69堂成人精品免费视频| 成人美女视频在线看| 91老司机福利 在线| 国产69精品久久久久毛片| av中文字幕在线不卡| 成人av影视在线观看| 欧美巨大另类极品videosbest | 久久一区二区三区四区| 日韩亚洲欧美在线观看| 欧美精品一卡两卡| 国产欧美日韩综合精品一区二区| 亚洲乱码国产乱码精品精的特点| 国产色产综合色产在线视频| 久久久不卡影院| 久久综合色一综合色88| 亚洲视频一区二区在线| 亚洲精品日产精品乱码不卡| 久久av资源网| 国产高清久久久| 国产福利视频一区二区三区| 欧美午夜精品久久久| 欧美人成免费网站| 欧美激情一区不卡| 精品一区二区三区免费观看| 在线看日韩精品电影| 欧美精品免费视频| 国产精品久久久一区麻豆最新章节| 亚洲图片有声小说| av动漫一区二区| 2欧美一区二区三区在线观看视频| 亚洲一区二区三区在线| 日本aⅴ亚洲精品中文乱码| 99精品视频在线免费观看| 久久免费视频一区| 蜜桃视频一区二区三区| 欧美日韩精品是欧美日韩精品| 日本一区二区三区免费乱视频| 免费观看久久久4p| 欧美精品自拍偷拍动漫精品| 亚洲一区免费在线观看| 一本到三区不卡视频| 国产精品国产三级国产三级人妇| 国产一区二区久久| 精品成人在线观看| 中文字幕在线不卡一区| 日韩av一区二| 91亚洲男人天堂| 国产精品久久久久久久久动漫| 成人激情午夜影院| 久久精品一区二区三区不卡牛牛| 国产一区二区三区电影在线观看| 日韩免费看网站| 一区在线播放视频| 不卡视频免费播放| 亚洲欧美偷拍三级| 色婷婷久久久综合中文字幕| 亚洲四区在线观看| 色婷婷亚洲婷婷| 五月天视频一区| 91精品一区二区三区在线观看| 日本va欧美va欧美va精品| 欧美一区永久视频免费观看| 亚洲天堂中文字幕| 色婷婷久久久综合中文字幕| 亚洲综合视频网| 91精品国产高清一区二区三区蜜臀 | 欧美精品乱人伦久久久久久| 午夜电影久久久| 精品人在线二区三区| 大胆亚洲人体视频| 亚洲欧美中日韩| 欧美喷潮久久久xxxxx| 久久草av在线| 综合欧美一区二区三区| 欧美日韩国产精品成人| 激情图区综合网| 亚洲欧美日韩国产一区二区三区| 欧美日韩精品一区二区三区蜜桃| 伦理电影国产精品| **欧美大码日韩| 欧美放荡的少妇| 成人av电影在线网| 日本aⅴ精品一区二区三区| 中文字幕的久久| 欧美无砖砖区免费| 国产高清精品久久久久| 亚洲福中文字幕伊人影院| 久久久激情视频| 欧美色综合网站| 国产a级毛片一区| 午夜久久久久久电影| 国产精品美女久久久久高潮| 国产成人精品综合在线观看| 视频一区国产视频| 国产婷婷一区二区| 欧美片在线播放| 色网综合在线观看| 国产美女久久久久| 日韩成人免费电影| 一区二区三区91| 中文字幕欧美日韩一区| 欧美一区二区精美| 欧美日韩一区精品| www.久久精品| 国产福利精品导航| 美腿丝袜亚洲综合| 亚洲成人av中文| 日韩欧美成人一区二区| 91久久免费观看| 免费高清在线一区| 亚洲高清三级视频| 亚洲免费大片在线观看| 一区视频在线播放| 亚洲国产成人一区二区三区| 久久伊人蜜桃av一区二区| 日韩一级片在线观看| 在线播放中文一区| 欧美日韩国产电影| 欧美日本在线一区| 欧美性做爰猛烈叫床潮| 在线免费精品视频| 在线观看www91| 欧亚洲嫩模精品一区三区| 色呦呦一区二区三区| 色一情一乱一乱一91av| 91在线国产福利| 日韩欧美中文字幕精品| 日韩午夜av电影| 欧美精品一区二区三区蜜臀| 日韩一区二区免费视频| 精品免费一区二区三区| 日韩精品一区二区在线观看| 2024国产精品视频| 久久久久99精品一区| 欧美极品xxx| 中文字幕一区不卡| 亚洲一区二区3| 午夜电影网亚洲视频| 精品一区二区三区在线播放| 国产精品影音先锋| 亚洲第一综合色| 午夜精品aaa| 久久精品国产**网站演员| 国产一区二区三区在线观看免费视频| 国产一区视频在线看| 成年人网站91| 欧美三级三级三级爽爽爽| 欧美一级精品大片| 久久精品夜色噜噜亚洲a∨| 国产欧美日韩在线视频| 亚洲欧洲av在线| 婷婷激情综合网| 国产一区二区成人久久免费影院| 成人开心网精品视频| 欧美日韩中文字幕一区| 精品国产露脸精彩对白| 中文字幕av一区二区三区高 | 欧美熟乱第一页| 欧美成人a∨高清免费观看| 中文字幕欧美日本乱码一线二线| 亚洲免费在线电影| 日本成人在线视频网站| 粉嫩欧美一区二区三区高清影视| 一本久久a久久精品亚洲| 精品日韩在线观看| 一区二区在线观看视频| 久久99精品久久久久久久久久久久| 成人高清视频免费观看| 4hu四虎永久在线影院成人| 国产精品―色哟哟| 蜜桃视频第一区免费观看| 91在线丨porny丨国产| 欧美不卡一区二区三区四区|