Jul. 14th, 2005

paperclippy: (giraffes)
As some of you know, I have been totally stuck with no idea what to do all week, and so I've accomplished nothing but buying plane tickets to Shanghai.

Well, today, my original plan was to screw around until 10, then go to Kinko's to FedEx my visa stuff, and stop by Urban Outfitters which had a 50% off sale going on (they open at 10, that's why I was going to wait). However, I was up early and already read LJ and all my other usual websites, so I had nothing to do. I figured, okay, I'll test my code to see if this one little thing is correct, having finally thought of a way to test it. Well, during the course of this, I realized two things: (1) the minimization function, since it is minimizing instead of maximizing, is negating my gradients, which are not supposed to be negated. Solved by putting in three negative signs. (2) The minimization function is taking only the second returned value of the function as the gradient, instead of the second, third, and fourth, so it was taking the gradient wrt one parameter and applying it to all three parameters. Oops. Fixed by changing [L dg dI ds] to [L grad] and grad = [dg dI ds].

I still don't think it works, but I can't believe I managed to miss that stuff before. I guess taking a week and a half off from working on this code really helped.
paperclippy: (huh?)
I think there is a stupid obvious answer to this question, but I am at a total loss.

I have an array of length N. I want to divide it into D bins. N/D is not an integer. How do I do it without just taking the floor of N/D and then having a huge bin at the end?

Is the following a valid option? Let T = floor(N/D). First bin is length T. Then let T = floor((N-T)/(D-1)), etc? Does that work?

I really think this is something stupid that I used to know how to do but I have forgotton. If any of you know a matlab function that does exactly what I want, even better (I ultimately want a new array, length D, which has the average of each of those bins as its values).

Profile

paperclippy: (Default)
paperclippy

April 2017

S M T W T F S
      1
2345678
9101112131415
161718 19202122
23242526272829
30      

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 7th, 2025 02:38 am
Powered by Dreamwidth Studios