Nonsense Contest!
<div class="IPBDescription">with a nod to CRFH!!!</div> The "Off-Topic" summary includes a command to "be random", so I'm going to take that at face value.
Welcome to NS.org's first nonsense contest (that I know of). The rules are simple. No post shall have any logical connection to the one that came before it. Be original. Don't make sense.
I start off with minus ten points for explaining the rules. For future reference, if at any point you walk into a nonsense contest and say "what's going on here?" or "is this a nonsense contest?", you're at minus twenty.
Guitar strings taste like steel vermicelli.
Welcome to NS.org's first nonsense contest (that I know of). The rules are simple. No post shall have any logical connection to the one that came before it. Be original. Don't make sense.
I start off with minus ten points for explaining the rules. For future reference, if at any point you walk into a nonsense contest and say "what's going on here?" or "is this a nonsense contest?", you're at minus twenty.
Guitar strings taste like steel vermicelli.
This discussion has been closed.
Comments
Einstein: A resonance cascade? Well, I never.
Luther: Yes.
Einstein: I tried to warn them this would happen, but the administrator just wouldn't listen.
Luther: Wouldn't you like to get one of these specimens under a microscope?
Einstein: I couldn't agree more.
Luther: Well, you lead the way.
Einstein: Oh, another headcrab.
I ALSO LIKE PORK
PORKPORKPORKPORK
<img src='http://www.fanandmore.de/eurosport/media/s04-hose-away-00.jpg' border='0' alt='user posted image'>
See what I mean?
(load "a6code")
(load "a6data")
(define (corresponding-min values Lst)
(let* ((inexact-values (map exact->inexact values))
(best-position (- (length values)
(length (member (apply min
inexact-values)
inexact-values)))))
(first (list-tail Lst best-position))))
(define (information first-count second-count)
(let ((first-prob (/ first-count
(+ first-count second-count)))
(second-prob (/ second-count
(+ first-count second-count))))
(if (or (= first-prob 0)
(= second-prob 0))
0
(+ (- (* first-prob
(log2 first-prob)))
(- (* second-prob
(log2 second-prob)))))))
(define (all-splits training-data attribute-names)
(map (lambda(x) (split training-data attribute-names x))
attribute-names))
(define (all-tallies training-data attribute-names)
(map tally-helper
(all-splits training-data
attribute-names)))
(define (tally-helper data-list)
(map (lambda (x)
(append (list (first x))
(tallynumbers (second x))))
data-list))
(define (tallynumbers data-list)
(let ((tallies (tally data-list)))
(if (= (length tallies)
2)
(list (second (first tallies))
(second (second tallies))
(+ (second (first tallies))
(second (second tallies))))
(list (second (first tallies))
0
(second (first tallies))))))
(define (information-from-tally tallylist)
(* (fourth tallylist)
(information (second tallylist)
(third tallylist))))
(define (information-list data-list attribute-names)
(let ((tallies (all-tallies data-list attribute-names)))
(map (lambda (x) (apply +
(map information-from-tally
x)))
tallies)))
(define (remove-position Lst pos)
(append (list-head Lst pos)
(list-tail Lst (+ pos 1))))
(define (remove-all-elements Lst pos)
(map (lambda (x)
(list (first x)
(remove-position (second x)
pos)))
Lst))
; Problem 2
;
;
(define (learn-dtree training-data attribute-names)
(let ((tally-list (tally training-data)))
(if (= (length tally-list) 1)
(first (first tally-list))
(if (null? attribute-names)
(pick-majority tally-list)
(let* ((best-attrib (corresponding-min (information-list training-data
attribute-names)
attribute-names))
(new-attributes (remove-element best-attrib
attribute-names))
(attrib-to-remove (- (length attribute-names)
(length (member best-attrib
attribute-names))))
(split-data (split training-data
attribute-names
best-attrib)))
(cons best-attrib
(map (lambda (x)
(list (first x)
(learn-dtree (remove-all-elements (second x)
attrib-to-remove)
new-attributes)))
split-data)))))))
; Problem 3
;
;
(define (chi-error pos neg pi ni)
(let ((pihat (* (/ pos (+ pos neg))
(+ pi ni)))
(nihat (* (/ neg (+ pos neg))
(+ pi ni))))
(+ (/ (* (- pi pihat)
(- pi pihat))
pihat)
(/ (* (- ni nihat)
(- ni nihat))
nihat))))
(define (compute-chi-squared datalist attributes best-attrib-number)
(let* ((tally-list (all-tallies datalist attributes))
(split-tally (first (list-tail tally-list
best-attrib-number)))
(pos (second (first (tally datalist))))
(neg (second (second (tally datalist)))))
(chi^2 (- (length split-tally) 1)
(apply + (map (lambda (x) (chi-error pos
neg (second x)
(third x)))
split-tally)))))
(define (chi^2-learn-dtree training-data attribute-names)
(let ((tally-list (tally training-data)))
(if (= (length tally-list) 1)
(first (first tally-list))
(if (null? attribute-names)
(pick-majority tally-list)
(let* ((best-attrib (corresponding-min (information-list training-data
attribute-names)
attribute-names))
(new-attributes (remove-element best-attrib
attribute-names))
(attrib-to-remove (- (length attribute-names)
(length (member best-attrib
attribute-names))))
(split-data (split training-data
attribute-names
best-attrib))
(chi-value (compute-chi-squared training-data
attribute-names
attrib-to-remove)))
(if (<= chi-value .001)
(cons best-attrib
(map (lambda (x)
(list (first x)
(chi^2-learn-dtree (remove-all-elements (second x)
attrib-to-remove)
new-attributes)))
split-data))
(pick-majority tally-list)))))))
(define (learning-curve setsize)
(let* ((subset (pick-random-subset mushroom-data1
setsize))
(tree (learn-dtree subset mushroom-names)))
(list (test tree subset mushroom-names)
(test tree mushroom-data2 mushroom-names))))
<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->
This is not random letters btw!
<a href='http://www.gamedesigner.net/news.phtml?id=41' target='_blank'>http://www.gamedesigner.net/news.phtml?id=41</a>
PE <!--emo&::gorge::--><img src='http://www.unknownworlds.com/forums/html/emoticons/pudgy.gif' border='0' style='vertical-align:middle' alt='pudgy.gif'><!--endemo--> I
TAKLE THAT, LAWS OF CONSERVATION OF ENERGY/MOTION/MATTER/MOMENTUM!!!!