« first day (76 days earlier)      last day (3147 days later) » 
03:00 - 22:0022:00 - 00:00

3:00 AM
@rayryeng hey ray, I have a quick question about something I read on the ML wiki page: share.coursera.org/wiki/index.php/ML:Logistic_Regression
It says in the "Cost Function" portion of the wiki that: Cost(hθ(x),y)=−log(hθ(x))
why are we using a logarithmic function to get the cost function? I understand that using the sigmoid will give us a smooth transition from 0 to 1, but the log seemed to pop out of nowhere
Ehh, I guess I kind of understand why they'd make the 0-1 range go from -inf to inf with that log function
 
3:53 AM
Ah ok.
That is for logistic regression
I don't know if you have covered that yet, but logistic regression is a CLASSIFIER.
logistic regression is actually a poor choice in terminology.
logistic regression == CLASSIFICATION
logistic regression is used when you want to predict either YES or NO as the answer
like when you're classifying spam, or deciding if someone has cancer.
now the sigmoid function goes between 0-1.
the reason why log is used is because it maps [0,1] to [-inf,0].
because log(0) --> -inf and log(1) --> 0.
we want it to go from 0 to inf, and that's why there's a negative slapped in front of it.
Now how does this factor in?
Consider the hypothesis to be the PROBABILITY of predicting the value YES.
If the probability of the output being YES is high, this means that the sigmoid should be close to 1, and hence log(1) == 0, meaning that it should cost very small to make that decision, because we have a high chance that choosing YES is the right answer.
If the probability of selecting YES is low, this means that the sigmoid should be close to 0, and hence -log(0) --> Inf.
This means that choosing this decision will cost you dearly, which is why the cost is very large.
@OneRaynyDay
I won't get into it, but the reason why the log is used is because originates from what is known as the MAP --> Maximum a posteriori selection rule.
Basically, the probabilities are modelled using the exponential function, which is e^{-...}. To minimize the cost, you want to minimize e^{-...}, so you need to minimize the exponent.
to minimize e^{-...}, you need to make sure the exponent is as LARGE as possible... so you take the logarithm of base e to this to get rid of the e, then work on the exponent itself.
that's where the log comes from, because of the log applied to e.
 
Oh I'm here!
Ahh okay I see... so log(1) would be 0, and it would approach -inf if you did log(0), to give it either 1. no cost, 2. infinite cost
 
correct.
 
Hmm.. one sec, searching up that MAP rule!
 
Assuming x is the input, and y is the desired output, the cost is actually:
C(x,y) = -(y*log(h(x)) + (1-y)*log(1-h(x))
 
4:11 AM
@rayryeng ah yeah - I did some partial derivatives
and found that it simplified really nicely :)
I bet they took sigmoids and logs just because the end result is like... so satisfying LOL
I mean... there probably are other ways to get an S shape, maybe like a taylor series, but the simplification after the partial derivatives were just so nice :')
 
4:58 AM
hahaha yup.
But you understand how that cost is derived right?
If y=1, this means a YES decision... and so only the left half of the summation is in effect, because the other half.. (1-y)x(something) = 0.
so you effectively have just log(h(x). If y=1, and if our hypothesis gave us a NO decision, then log(h(x)) would be very large thus giving you a high cost.
this is saying that our ground truth label says the decision is YES, but our learning algorithm specifically says this is a NO.
Going contrary to the ground truth should be penalized with a high cost
similarly, when y=0, the second half of the equation comes into play. Similar thinking
if y=1, and log(h(x)) is a NO, then this will give you a large cost as well.
however, if both hypothesis and ground truth agree, the cost is small. @OneRaynyDay
The sigmoids I don't know where they came from.... but they're one of the most frequently used in machine learning
Neural Networks especially.
 
 
3 hours later…
8:17 AM
@rayryeng Ahh, just saw this :)
and yeah I can see that! What does ground truth label mean though?
Ah, just searched it up: In machine learning, the term "ground truth" refers to the accuracy of the training set's classification for supervised learning techniques.
gotcha. Right, so if the training set is all YES's, but your hypothesis gives all NO's, then it would technically have a cost of inf?
ah but the cost is not really taken into consideration - it's only there to see whether it's greater or less than the threshold
I see - so the inf wouldn't really matter too much! Lightbulb clicked :)
The fact that they use log() is because it gives a very extreme range of values
from 0 to inf cost, which is really useful when you want to find a good threshold
say if it's 0 to 1, then you'll have to choose say 0.0000001 or something while 0 to inf allows for more sway of the threshold? I mean, you could probably still implement something with cost function of 0 to 1 though :)
 
8:34 AM
@AndrasDeak A couple of months ago I did put those fancy python colormaps in Matlab. You can use viridis (and the other 3) in Matlab (that what I do): uk.mathworks.com/matlabcentral/fileexchange/…
 
 
2 hours later…
10:15 AM
Thanks, @Ander, but I don't use matlab;)
I use the same colormap with TikZ/pgfplots.
 
I'm chronically dissatisfied with matlab's plotting tools.
Not to mention the lack of an academic licence.
BTW we're in the same country at the moment:)
 
hg2 is quite cool, isnt it?
Academic license of what?
and how come you are in the UK?
 
1. I guess it is, but I'm stuck with R2012b
2. Academic licence of matlab
3. I'm at a workshop in Chester, until Wednesday:)
 
You mean your lack of academic license? There is an academic license right? is what unis have
Enjoy Chester! never been there
 
10:21 AM
Yeah, that's what I mean.
And thanks, I'll try. Enjoying, that is;)
 
Hehe yea. Thats why Im triying to get used to python
for when I leave academia (if I do)
 
 
3 hours later…
1:17 PM
@LuisMendo @rayryeng This one is for you guys: stackoverflow.com/questions/32582283/…
 
2:13 PM
@AnderBiguri Nice question! Ray, by the time you read this it's probably too late :-P
This one was interesting too:
2
Q: Changing the phase of a signal in MatLab

burgoi want to change the phase of a signal in the frequency domain. so i generated a cosine test signal to verify the code: ycheck = cos(2*pi*t); when i want to shift the phase about pi/4 i perform a fft on the signal split it in magnitude and phase and substract pi/4 from it. Ycheck = abs(Ycheck...

 
Very nice asnwer!
answers*
 
good answers both, cheers!
and cheers to you both @AnderBiguri and @LuisMendo for speaking English amongst one another whilst no-one else is present :D I don't see many people whose native tongue isnt english do that
 
well, this is everyone's chatroom, not Spanish Matlab users one!
I think I always actively avoid doing this kind of stuff because I feel like Spanish people tend to do it a lot (speak spanish as much as they can in international enviromets) and I feel its a bit rude
 
Thanks guys!
Yes, Spanish here would not be appropriate
And it's good English practice for me :-)
(Ander does not need that much practice, living in the UK!)
 
Haha indeed, I am tired of practice!
haha nah, im good
 
2:52 PM
I need more practise in Swedish...
sadly that's rather difficult with none of 'em around here and all of them speaking better English than I do
 
aaah Swedish, weird singing language
 
@AnderBiguri especialy when chanting dirty texts to the opponents fans at a hockey match :D
 
hahaha
yeah
I played curling when I lived in Denmark. I found amazing that they take it very very seriously
 
I did play whilst living there, but that was more of a practise in skating than real playing. Most of the exchange students (whom I was playing with) were either from France or Spain and had never seen ice outisde a cocktail glass
so the first months were skating only :(
 
hahaha
Indeed, we see it a lot in cocktail glasses XD
 
2:57 PM
Curling is definitely an old person sport
With random youngins playing here and there
 
My mum would love me to have played curling when I was a kid I suppose
I would have helped somuch in house chores
floor cleaning specially
 
and you'd wear chequered pants of course! eatprayliftblog.files.wordpress.com/2013/11/…
that's not an image :(
 
@LuisMendo it's not about the rep, I'm glad as long as we're one big happy matlab family :p
although I do want to get over 3k
 
@excaza The thing is, that question was so unclear I didn't take the time to keep on trying to solve it. But you were more patient :-)
 
It would be a good case for tokens but that would be a pretty hilarilusly long regex
 
3:11 PM
@excaza rep is not the goal of SO, but gamification is a proven theory!
works, we love to get unicorn points for our efforts :D
 
I want cool privileges :p
 
I can see myself in the bottom of "Matlab All time users" with 392 score, and to be in the list I need more than 893
 
I debating making an app for making a game out of normal tasks to get lazy people to do things like go to the gym lol
 
its impossible, but its a fun goal to look for :P
@Dustiny That would definetly work
getting + points for productive days, - for unproductive
 
Yeah exactly and a sort of "level up" system
Possibly some sort of "rewards"
 
3:22 PM
@AnderBiguri as of this point Im only trying to stay in the month's top 10
the total rankings are out of my league
 
I am around the months top 20 generally
sometimes yes others not, depends on how much I want to get on wiht my PhD
If I am not there, means good stuff for my PhD Xd
Im the 8th now. Bad.
 
:o first time every I've got the same number of points as the number of answers! Houzaa!
that's what happens when you order books the cheap way from India instead of from the university itself: You dont get books and have way too much time to spend on SO
 
hahaha
 
3:45 PM
@AnderBiguri just in time answering that duplicate you found :P
:o Congratulations on your gold steward badge @AnderBiguri !
 
4:17 PM
@Ander I've reopened this question. It was a cell array, not matrix, so the approach is different. I hope you don't mind
0
Q: finding the row index of 2 given column values

user1681664I am trying to figure out how to get the row index when given 2 column values. I don't know why I am having difficulty figuring this out because you can easily was find for 1 column value. For example, give the matrix below: {1,1,1,2,2,2;'apple','banana','orange','apple','banana','orange'} I...

 
@LuisMendo I sure don't, more rep for me :P
but maybe make the title and question actually reflect the fact that there's a cell array in it
 
Hahaha. I don't think you lose any rep if the question is a duplicate, do you? Not directly at least
 
Nope, but then less people will open it and click that shiny triangle ;)
I do loose rep for edits on deleted questions though
 
@Adriaan Good idea. Done
 
aww, had given that edit to me, then Id have another notch on my refiner batch :P
 
4:21 PM
Hm? Was there an edit from you pending?
I didn't see it; sorry
 
no there was not, no worries
 
Maybe there's something more to be improved
 
Max
you already got enough notches of correcting my horrible posts, adriaan :D
 
nah, not really. All the basics are there, without spelling mistakes or format mistakes
Hi @Max !
 
Max
hi @adriaan ! Just stumbled in here and had to comment on that ;)
 
4:39 PM
So @Adriaan, how was the reactor? And will you be there on a recurring basis?
 
@AndrasDeak still standing, and I'm going back tomorrow :D
Im just there for a practical of scintillation problems in XRF. It's a three afternoon-practical
 
I see:)
XRF? What's the F?
 
X-ray fluorescence (XRF) is the emission of characteristic "secondary" (or fluorescent) X-rays from a material that has been excited by bombarding with high-energy X-rays or gamma rays. The phenomenon is widely used for elemental analysis and chemical analysis, particularly in the investigation of metals, glass, ceramics and building materials, and for research in geochemistry, forensic science and archaeology. == Underlying physics == When materials are exposed to short-wavelength X-rays or to gamma rays, ionization of their component atoms may take place. Ionization consists of the ejection...
 
Ahha:)
 
you could've googled that yourself :P
 
4:46 PM
Yeah, no one at SO does that, you know;)
We just ask what comes to mind.
 
then I need Luis or Ray to mark you a duplicate
 
:D
But I'm not a duplicate...
I'm horribly unique:P
 
sorry guys. I'll catch up later. Fixing something
 
summa cum laude unique even
 
Ahh brings me back to my engineering physics labs :p
Naming an analogue variable "ANAL" is actually insane lol
I can't believe one of our clients does it on the regular
 
5:02 PM
that's such a wonderful idea
 
@OneRaynyDay - Ground truth is the true label of the data set. So if a data point is actually SUPPOSED TO BE YES, the ground truth value is YES.
 
Yeah by insane, I meant insanely funny
 
@OneRaynyDay - The job of any classifier is to be able to get your hypothesis to match each of the ground truth values as close as possible.
@AnderBiguri - Thank you for keeping the room English :)
@AnderBiguri - It's an unspoken rule, but it is known (at least where I live) that speaking in your native language with non-native speakers is rude.
 
I think that's a pretty general rule.
 
@rayryeng what if your native language is English :P
 
5:06 PM
Otherwise it suggests that you're speaking about those present.
 
@Adriaan - If there are non-native English speakers in the room, you try to talk to them in their language :)
@AndrasDeak - yuppers
That happened to me when I was at school. Most of the students in my class were Iranian / Persian. When I was trying to ask them, or trying to help them, they would converse to each other in Farsi.
 
Same thing as whispering, I guess.
 
and I had no idea whether or not they were saying that I dressed like an asswipe, or if they were genuinely interested in my help LOL
 
Suffice it to say, I got pissed and said either you speak in English and I can actually understand wtf is going on, or you find someone else for help.
 
5:07 PM
Pakistanis actualy speak Urdu
@rayryeng I had four French living on my corridor whilst living in Luleå. Each time I entered the kitchen is was a French party and no-one even so much as glanced at me and just kept speaking French
 
Who said anything about Pakistan?
 
horrible that was, being stuck for five months with French in your kitchen
ah, I read Iranian/Pakistani
my bad
 
You should've told them "omelette du fromage"
with a universal gesture
:D
 
"Mon baguette est tres longue!"
and then I commenced to try and hit their kneecaps in hockey
 
lmao
@Adriaan - You should tell them to "enculer une mouche"
 
5:12 PM
mouchas gracias
 
It means to go f*ck a fly lol
@AnderBiguri @LuisMendo - Very good answers. I've upvoted them both. @LuisMendo, when you get back, I have a peculiar question I'd love to pass by you in case you're around.
Since we're on the topic of signal processing. Whenever you get back though!
 
5:35 PM
10th mug of coffee and Im still not seeing the solution to my PDE ...
 
5:48 PM
@Adriaan - It will magically appear in your dreams.
 
that'd be good!
I do not like take-home exams :(
 
@Adriaan French people are pretty brutal in Canada too if it makes you feel any better
Around 50% of them actually despise english speaking people to the point of hatred
 
@Dustiny - That's the general feeling in Quebec lol
which is about 50% of the French speaking people anyway ;D
 
Hahaha exactly ;)
 
@Dustiny The most spoken second language in Canada is Chinese.
 
5:51 PM
They're not all bad... most of the Quebecois people I've met are generally nice.
maybe because I speak French to them.
 
This means there are more people that speak Chinese as a second language than there are French Canadiens speaking English
 
@rayryeng Yeah same here, but most of the Quebecois (read: Quebexican) people I've met have been outside of Quebec lol
 
hahaha.
 
Same hold true for Belgium for that matter, 19% of Waloons speak Dutch, 67% of Flemmish speak French
as a friend of mine put it deftly: "Yes, Brussels is bi-lingual. French and Arabic."
 
Waloons? lol
@rayryeng I think in Montreal it's a bit different of a story too, mostly the rural areas are bad
 
5:54 PM
Yes. Usually city folk are more "educated".
 
Yeah, the separatist issue is pretty weird to me
But I can see both sides to that coin
 
Balgium was in a record breaking government formation a while back. 2 years because the Walloons and the Flemmish didnt get along
 
@Adriaan Huh, that's interesting
But I think in terms of sheer numbers, the population of chinese people is increasing at an astounding rate
Then I wonder how many french people actually have english as a first language and not a second
 
6:30 PM
@rayryeng right :) I gotcha!
Thanks ray! I stayed up until 2-3 doing the coursera course which just opened yesterday at midnight
@Dustiny yeah chinese people population is getting a bit out of hand
I'm mainland chinese but immigrated to amurrrica
 
@OneRaynyDay I meant in Canada (mostly just Toronto)
But I Guess in general it's even worse lol
 
oh same idea though LOL
you know chinese people try to go to the US by
getting a citizenship in canada first
 
Oh interesting
 
because it's virtually impossible to just straight up apply for a visa
yeap, chinese people also pay other chinese people who live in canada to put them as false references
it's a liiiittle bit crazy
you can see how unscrupulous these methods are but considering the wealth disparity in china i can't really blame their desperation ://
 
Just to make you understand my point (Ive got the feeling you didnt quite get it), Chinese immigrants have chinese as a first language and English as a second. Their children probably have English as first and Chinese as second. Thus, to make my point: the current Chinese immigration isn't really relevant to the second language fact
 
6:38 PM
ah woopsies, i didn't get the poinht the first time
i blame it on my lethargy from waking up
 
I'm closer to going to bed than I am from getting out of it :P
3
A: Finding the column index given the contents in a cell array

AdriaanI'll assume a cell array, according to @LuisMendo cellarray = {1,1,1,2,2,2;'apple','banana','orange','apple','banana','orange'}.'; values = cell2mat(cellarray(:,1)); tmp1 = values == 1; tmp2 = strcmp('banana', cellarray(:,2)); tmp3 = tmp1+tmp2; result = find(tmp3 == 2); This will get the value...

Whoohoo! Golfed it :D
(sort of)
 
 
2 hours later…
8:56 PM
@LuisMendo Great. At the beggining it was no clear so I marked as duplicate
@Adriaan Congratulations for spending hours clasifiying crap! At least I got a small round yellow filled circle :P
 
Hehe, I just spend ~1 hour reading the meta on triage and reviewing my own triages
was wondering what to do in cases as (duplicate already flagged), (requires editing but edit pending) etc
I had a bit of a sad moment today.
When I woke up this morning I realised my answer on that complex derivative was utter bollocks
fancy, well written bollocks, but still bollocks
I read the accepted answer, and admitted, it's better, but diff still does not use midpoints, it merely subtracts. But, since I had quite eloquently described a mathematical artefact stemming from the usage of two equal arrays resulting in a symmetric matrix and not the actual problem I got my first "Disciplined" badge :(
 
@Adriaan, how's that PDE of yours coming along?
 
solved another question, miraculously
for some reason the teacher made us buy a book of 15 chapters and started his first lecture by saying "I expect the first 11 chapters as prior knowledge. Let us start in chapter 12"
so I had to do some reading last week :P
 
Was the answer to my question buried in there somewhere?:D
 
which question?
 
(have I told you that I hate the new logo?)
@Adriaan The one that says "@Adriaan, how's that PDE of yours coming along?"
 
9:31 PM
that's exactly what I said: "solved another question, miraculously" :(
but since I am apparently too sleepy to write coherent sentences which also make proper sense I will be the wise man in this room and go to bed
 
OK.
So you didn't solve it, because you answered a question instead?:D
 
Perhaps I should spend less time listening to blabbering idiots on SO and spend more time actually studying...
 
(And I take it back, I don't hate the new logo; I hate the new mini logo which appears before the tab name in firefox)
I was just asking whether you needed any help. It's been a while since I've seen a decent PDE, I'm starting to miss them:D
 
get the book "Applied Partial Differential Equations with Fourier Series and Boundary Value Problems" By Richard Haberman. I'm working on question 12.3.6 and any tips on the complete chapter are appreciated :P
I'll read your suggestions tomorrow morning over breakfast ;)
 
:D
I'll see if I can piratebuy it.
 
9:39 PM
I couldnt :( Believe me, I tried for that book, 50 quid for 4 chapters, s'mon
 
Is it the same as "Elementary Applied Partial Differential Equations with Fourier Series and Boundary Value Problems 1987"?
By R. Haberman?
 
ISBN-13: 978-1292039855
it;s not for elementary school
and could be, but that's an old version, probably question numbers are different
but good luck doing my homework!
(YES! Help vampired SO users to do my homework!)
 
Hello all!
Is "piratebuy" a verb? :-)
 
It seems so. I just came up with it, so why not?
 
9:43 PM
@rayryeng I'm here. I'll be around for a while. Signal processing? That sounds interesting!
 
Hi!
 
@Adriaan, unfortunately the '87 version only has 5 problems in chapter 12.3:S
 
Yeah. If "google" is a verb...
 
OK... so I'm not sure if you have seen this post that I wrote in the past..
7
A: Finding the derivative of a 2D function using FFT properties

rayryengFor 1D, the i'th derivative in time-domain is related to the frequency domain as follows: Source: Wikipedia Here, i represents the complex number, or the square root of -1, and f is the frequency in the frequency domain. F^{-1} is the inverse Fourier Transform of the signal X(f), which is t...

Basically, I wrote a post that finds the derivative of a 2D signal via the Fourier Transform
 
I don't think I saw it, because I see no upvote (of mine). I probably would have!
 
9:44 PM
ok.
well basically, I wrote this post... and it does work.
If you recall the properties of the FFT, you just take the Fourier Transform, multiply by i*w then take the IFFT.
 
To differentiate, yes
 
for 2D, it's just a product of i*u and i*v where u and v are spatial frequencies.
ok cool... so it works for that image.
 
Makes sense. Separable transform
 
Finally, something I understand which you guys are talking about:P
 
Hahaha
 
9:45 PM
However, someone emailed and said that they tried what I did in my post
but it isn't working for them.
so they sent me their data... and I tried it on their data... and yes, it doesn't work.
 
Did they give details?
 
yeah, when I saw the image, I can see what is happening
There is aliasing.
you can see that there is high oscillation noise amongst the original data.
 
Oh, interesting!
 
but the question is... I can't figure out why that's happening
 
So you found the reason why it doesn't work?
Ah, ok
 
9:46 PM
I found the reason yes.... but I can't figure out how to fix it.
It's weird because it works for that image I showed you in the post
but when the user sent me another image.... it doesn't seem to work.
the only thing that changes are the actual image contents themselves, and the size of the image.
 
Send me the data maybe, so that I can try?
You have your email in your profile, right?
 
yeah do you mind having a look? I haven't emailed back the user yet because I don't know what's going on.
yes I do.
 
Well, doesn't it depend on the frequencies present in the picture?
 
@AndrasDeak - Yes.
 
Or does Nyquist's rule only depend on the geometry?
 
9:49 PM
Which is why I tried changing the number of points on the FFT
 
I just sent you an email
 
ok great :0
I'll send you the script and the data.
 
And would using some kind of sampling window corrupt the image?
 
I'll also read you answer more slowly
One thing:
the formula from wikipedia says n-th derivative
but the RHS is first derivative, right?
 
Yes.
whatever order derivative you want, you just raise i*w to the desired power.
 
9:52 PM
And if it works for one order, it should keep staying good, right?
 
Nice pictures BTW!
 
Unless it stops converging...
scratch that
it should depend on the order
 
@AndrasDeak Some people even define non-integer derivatives that way!
Raising iw to a fraction, I mean
 
Those people must be mathematicians...
The same kind of people who compute the surface of a 4.2-dimensional unit sphere, based on the gamma function.
 
First time I heard of that was from a telecomm engineer. But I agree with you, it's more mathematial than anything
Hahaha
Generalizing factorial?
Nice invention, that gamma function
 
9:54 PM
@LuisMendo - I just sent you an email.
 
I just received it
 
@LuisMendo - Great :)
 
I'll take a look
 
ok thanks :) :)
 
You granmas are so cute;)
 
9:56 PM
Is the image "smooth" near the borders?
 
You can sort of see the data but there is high frequency banding... so my guess is that it's an aliasing problem.
 
"Darling, I sent you one of those e males"
 
I don't think it is.
 
@AndrasDeak :-P
 
9:57 PM
also with the problem I had in the question, there are zeroes along the border, so maybe that's why it isn't working.
maybe I need to pad the image first, then try it
 
So maybe it's border effects from circular convolution?
Yes, that's what I meant
 
I think that could be it.
 
OK, you managed to get me lost:(
 
Maybe pad the data with a frame of zeros
 
The thing is though, I don't know how much of a padding I need
 
9:57 PM
@AndrasDeak FFT in time is circular convolution
 
But it's okay. I'll have my own scientific discussion. With blackjack. And hookers. And forget the blackjack.
:)
 
@AndrasDeak so it's like assuming your signal is periodic and you're seeing only a period
 
Oh, I see. Thanks.
Well, that's not just time, FT generally does this.
 
What is currently commented is the code that the person emailed me and that doesn't work. What is currently there is the code from my original post.
 
Yes, by time I meant the original domain
 
9:59 PM
in our case, it's space for 2D :)
 
03:00 - 22:0022:00 - 00:00

« first day (76 days earlier)      last day (3147 days later) »