ubLIX has joined #racket
pierpal has quit [Read error: Connection reset by peer]
pierpal has joined #racket
aquiandres has joined #racket
aquiandres has quit [Read error: Connection reset by peer]
vraid has quit [Ping timeout: 245 seconds]
g00s has joined #racket
pie_ has quit [Remote host closed the connection]
pie_ has joined #racket
<lavaflow> if anybody here is familar with bayes theorem and willing to review my implementation of it, I would be very grateful: http://pasterack.org/pastes/47300
<lavaflow> Specifically I'm trying to find the probability of A given a list of B's. To do this I apply bayes theorem between A and the first B in the list of Bs, then use that result as my next P(A) and apply bayes again recursively using the subsequent B's in the list of B's.
pierpal has quit [Read error: Connection reset by peer]
<lavaflow> I'm really not sure that's the right way to use bayes thereom though... it gives me unintuitive results, probabilities well over 1.0
<lavaflow> the function that's giving me concern is the 10 line function 'bayes' at the top of the file. The rest of the file is basically just caching and plumbing, I'm pretty sure that part is fine.
dbmikus has joined #racket
pierpal has joined #racket
ziyourenxiang has quit [Quit: Leaving]
NB0X-Matt-CA has joined #racket
ziyourenxiang has joined #racket
pierpal has quit [Read error: Connection reset by peer]
pierpal has joined #racket
dan_f has joined #racket
pierpal has quit [Ping timeout: 245 seconds]
nckx has quit [Quit: Updating my GNU GuixSD server — gnu.org/s/guix]
nckx has joined #racket
dbmikus has quit [Ping timeout: 276 seconds]
dddddd has quit [Remote host closed the connection]
orivej has joined #racket
dbmikus has joined #racket
pierpal has joined #racket
pierpal has quit [Read error: Connection reset by peer]
pierpal has joined #racket
_whitelogger has joined #racket
Diagon has quit [Read error: Connection timed out]
<nisstyre> lavaflow: do you know the law of total probability?
Diagon has joined #racket
<nisstyre> I don't really have the brain cells to go over it in detail with your code but https://en.wikipedia.org/wiki/Law_of_total_probability
ubLIX has quit [Quit: ubLIX]
<lavaflow> nisstyre: I don't, thank you for bring my attention to it
<lavaflow> I'll dig into this
pie_ has quit [Ping timeout: 240 seconds]
dbmikus has quit [Ping timeout: 252 seconds]
dbmikus has joined #racket
dbmikus has quit [Remote host closed the connection]
Lowl3v3l has joined #racket
DGASAU has quit [Remote host closed the connection]
DGASAU has joined #racket
_whitelogger has joined #racket
_whitelogger has joined #racket
jao has quit [Ping timeout: 276 seconds]
pierpal has quit [Read error: Connection reset by peer]
dustyweb has quit [Ping timeout: 250 seconds]
vraid has joined #racket
DGASAU has quit [Ping timeout: 250 seconds]
DGASAU has joined #racket
dddddd has joined #racket
bor0 has joined #racket
mzan has left #racket [#racket]
dan_f has quit [Quit: dan_f]
mzan has joined #racket
iyzsong has joined #racket
g00s has quit [Quit: Textual IRC Client: www.textualapp.com]
ubLIX has joined #racket
iyzsong has quit [Ping timeout: 252 seconds]
DGASAU has quit [Ping timeout: 250 seconds]
ZombieChicken has quit [Ping timeout: 256 seconds]
bor0 has quit [Quit: Leaving]
eagleflo has joined #racket
confusedwanderer has joined #racket
iyzsong has joined #racket
confusedwanderer has quit [Quit: confusedwanderer]
confusedwanderer has joined #racket
badkins has quit [Remote host closed the connection]
Arcaelyx has quit [Quit: Textual IRC Client: www.textualapp.com]
rlp10 has joined #racket
rlp10 has quit [Client Quit]
iyzsong has quit [Quit: ZNC 1.7.1 - https://znc.in]
badkins has joined #racket
badkins_ has joined #racket
badkins has quit [Ping timeout: 260 seconds]
ubLIX has quit [Quit: ubLIX]
Lowl3v3l has quit [Quit: Leaving.]
vraid has quit [Quit: Leaving]
Sgeo__ has joined #racket
Sgeo_ has quit [Ping timeout: 260 seconds]
badkins_ is now known as badkins
dbmikus has joined #racket
<nisstyre> lavaflow: this might be an easier to understand explanation https://www.statisticshowto.datasciencecentral.com/total-probability-rule/
<nisstyre> lavaflow: basically the idea is that you're calculating P(A) by calculating P(A & B) + P(A & ~B)
<nisstyre> so you just do that for every B and then add them up to get the probability of P(A)
<nisstyre> so that would really be B_n or whatever
<nisstyre> oh I misunderstood, you just want to add up all the P(B_n) and then plug that into bayes theorem?
<nisstyre> it depends if you're calculating the disjunction or conjunction of those events though
sleepnap has joined #racket
johnjay has joined #racket
pierpal has joined #racket
dbmikus_ has joined #racket
ziyourenxiang has quit [Ping timeout: 272 seconds]
dbmikus has quit [Ping timeout: 272 seconds]
vraid has joined #racket
jao has joined #racket
YuGiOhJCJ has joined #racket
Lowl3v3l has joined #racket
nitrowheels has joined #racket
dbmikus_ has quit [Quit: WeeChat 2.3]
dbmikus has joined #racket
rnmhdn has joined #racket
sauvin has quit [Ping timeout: 244 seconds]
YuGiOhJCJ has quit [Quit: YuGiOhJCJ]
<rnmhdn> I have to make a program
<rnmhdn> that get's something like this: '(+ 1 2) and gives 3
orivej_ has joined #racket
<rain1> hey
<rain1> were we talking yesterday?
orivej has quit [Ping timeout: 268 seconds]
<rnmhdn> of more complicated like '(+ - 2 * 3 1 4)
<rnmhdn> yes
<rnmhdn> yaaaay
<rnmhdn> I needed you
<rnmhdn> here is the code I made
<rain1> ah
<rnmhdn> I know it's sooooo bad
<rain1> it looks ok!
<rain1> it's a good start
<rnmhdn> my first question is how should I do something like this in functional programing?
<rnmhdn> f(a) -> b,c
<rain1> so the main problem with the code you have written is that it only returns 1 value
<rain1> for this task you need to return 2 values
<rain1> to do that you can use VALUES and LET-VALUES
<rnmhdn> lol
<rnmhdn> good point
<rnmhdn> but first can you help me with this
<rnmhdn> (pop-and-return (cdr lst)) is like a transitional value
<rnmhdn> that I need to calculate only once
<rnmhdn> but now I'm calulating it twice
<rnmhdn> is there anyway to work around this?
<rnmhdn> but really, you are so smart!
<rain1> wait a second, i think you're skipping ahead of what i said onto the next thing
<rnmhdn> You could remember everything and understand my code in less than a minute!
nitrowheels has quit [Quit: Leaving]
<rnmhdn> but your issue is correct
<rnmhdn> that was my next question
<rnmhdn> :D first can you help me with this,
<rain1> ok
<rnmhdn> what I need is something like a variable so I can do something like this:
<rain1> you can use LET for that
<rnmhdn> a = (car (pop-and-return (cdr lst))
<rain1> (let ((tmp (pop-and-return (cdr lst)))) ... then use tmp twice in here ..)
<rnmhdn> and then do (+ a (car (pop-and-return (cdr a))))
<rnmhdn> is let different from define?
<rnmhdn> does it actually just make an alias or does it actually store the result?
<rain1> yeah it's different, but they both bring a variable into scope
<rnmhdn> but if I use let
<rnmhdn> do I actually run (car (pop-and-return (cdr lst))) twice or not?
<rain1> it will only do it once
<rnmhdn> also why use values instead of returning a pair?
<rnmhdn> rain1: great:D
<rain1> oh returning a pair will work perfectly well too
<rain1> you can do that
<rnmhdn> what is the racket way of doing it?
<rnmhdn> racket way as in like pythonic :D
<bremner> let-values is _slightly_ more convenient, but it is a new language feature to learn
<bremner> IMHO
<rnmhdn> rain1: should I insert that let before (case?
<rain1> yeah
<rnmhdn> ok good
<rnmhdn> now
<rnmhdn> as you said I'm only returning one value
<rnmhdn> how can I append
<rnmhdn> (cdr (pop-and-return (cdr tmp)))
<rnmhdn> to the result in the cases
pera has joined #racket
<rain1> I'm not sure what you mean
<rain1> why don't you paste the changes you've made so far
g00s has joined #racket
<rnmhdn> as you can see I've written (cdr (pop-and-return (cdr tmp)))) four times
<rnmhdn> I could make it a bit shorter with another let
<rnmhdn> but I was wondering if there was a better way
<rain1> that's looking good
<rain1> you can change all 4 cases into 1 case
<rain1> by using the trick to turn the symbol + into the function + that I showed yesterday
<rain1> but you don't have to do that now
<rain1> the important thing to consider is that the function 'eats' how many items off the list that it needs to
<rain1> and it returns the rest of the list with those items gone
<rnmhdn> sorry
<rnmhdn> shit came up brb 5 mins
<rnmhdn> so sorry
<rain1> that'sfine
<rnmhdn> yes
<rnmhdn> am I not doing the important thing already?
<rain1> currently it only returns one value
<rnmhdn> but
<rain1> oh wait i see
<rain1> you are
<rnmhdn> the car of that value is the actual thing that it eats
<rain1> that's good, but you need to use CONS instead of APPEND
<rnmhdn> and the cdr is the remaining stuff
<rnmhdn> ok
<rnmhdn> let me change that and also implement that (define (get-operator sym) (cond ((eq? sym '+) +) ((eq? sym '-) -)
<rnmhdn> is there a shortcut to get the case value within a case?
<rnmhdn> or do I have to use let again if I want to do it?
<rnmhdn> let me post
<rnmhdn> in my case it's really useless but I was wondering if there was a way to not type the second (car lst)
<rnmhdn> like tell case, whatever it is that you have matched with and came here, give me that.
pera has quit [Ping timeout: 246 seconds]
<rain1> ah i don't think there's any way to do that unfortunately
<rain1> that code is looking really good
<rain1> you can use another LET to avoid doing the second recursion twice
<rnmhdn> I have to type let twice right?
dustyweb has joined #racket
<rnmhdn> I can't find any way to do multiple assignments in one let
<rnmhdn> anyway
<rnmhdn> I get an error
<rnmhdn> :-"
<rnmhdn> I think I should be able to figure it out myself
<rnmhdn> I think when arg-2-r becomes just one number
<rnmhdn> I get an error because (cdr '()) is meaningless...
<rnmhdn> so I add a if:D
aeth has quit [Ping timeout: 246 seconds]
aeth has joined #racket
rnmhdn has quit [Ping timeout: 240 seconds]
rnmhdn has joined #racket
confusedwanderer has quit [Quit: confusedwanderer]
pie_ has joined #racket
pera has joined #racket
mzan has left #racket [#racket]
rnmhdn has quit [Ping timeout: 252 seconds]
g00s has quit [Quit: Textual IRC Client: www.textualapp.com]
ZombieChicken has joined #racket
pie_ has quit [Quit: Leaving]
Fernando-Basso has joined #racket
<lavaflow> nisstyre: I wasn't able to get the total probability rule generating the results I was looking for, but it occurred to me that my problem is very similar to using a naive bayes classifier to classify spam emails
<lavaflow> instead of looking at each word in an email, I look at each tag on the file. I have one classifier trained for each possible tag, so I loop through all possible tags and see if the classifier for that tag returns a high probability for that file's existing tag-set.
<lavaflow> I implemented paul graham's formula for it given here: http://cs.wellesley.edu/~anderson/writing/naive-bayes.pdf
<lavaflow> (on the last page) I'm also going to try the other form which reputes to give better results though I'm skeptical. After I settle on one I think I'm going to try classifier chains (https://www.cs.waikato.ac.nz/~eibe/pubs/chains.pdf) to tackle label independance.
badkins has quit [Ping timeout: 268 seconds]
sleepnap has quit [Quit: Leaving.]
pera has quit [Quit: leaving]
Fernando-Basso has quit [Remote host closed the connection]
dbmikus has quit [Ping timeout: 252 seconds]