Hi,
I have a set of data (x_i,y_i), and would like to carry out a linear regression using least squares. Further, the slope and intercept are bound (they have to be between 0 and slope_max and 0 and slope_min, respectively). I have though of using one of the "easy to remember" :D optimization methods in scipy that allow boundaries (BFGS, for example). i can write the equation for the slope and intercept based on x_i and y_i, but I gather that I must provide a gradient estimate of the function at the point of evaluation. How does one go about this? Is this a 2-element array of grad(L) at m_eval, c_eval? Thanks! Jose -- 249 Spiele für nur 1 Preis. Die GMX Spieleflatrate schon ab 9,90 Euro. Neu: Asterix bei den Olympischen Spielen: http://flat.games.gmx.de _______________________________________________ SciPy-user mailing list [hidden email] http://projects.scipy.org/mailman/listinfo/scipy-user |
As far as I had seen from the example
(btw this one has analytical df) http://projects.scipy.org/scipy/scikits/browser/trunk/openopt/scikits/openopt/examples/llsp_2.py specialized solvers (like bvls) yield better results (objfunc value) than scipy l_bfgs_b and tnc. You could try using algencan, I had no checked the one (my OO<-> algencan connection was broken that time). It will hardly yield better objfunc value, but maybe it will have less time spent for some large-scale problems. Regards, D. Jose Luis Gomez Dans wrote: > Hi, > I have a set of data (x_i,y_i), and would like to carry out a linear regression using least squares. Further, the slope and intercept are bound (they have to be between 0 and slope_max and 0 and slope_min, respectively). > > I have though of using one of the "easy to remember" :D optimization methods in scipy that allow boundaries (BFGS, for example). i can write the equation for the slope and intercept based on x_i and y_i, but I gather that I must provide a gradient estimate of the function at the point of evaluation. How does one go about this? Is this a 2-element array of grad(L) at m_eval, c_eval? > > Thanks! > Jose > _______________________________________________ SciPy-user mailing list [hidden email] http://projects.scipy.org/mailman/listinfo/scipy-user |
In reply to this post by Jose Luis Gomez Dans
Folks,
I need some help figuring out how to plot the trajectory of a path through 3D space. I know the trajectory passes through several points with (x, y, z) cooreinates: Point 1: (0,0,0) Point 2: (0,0,-z2) -- the 2 is a subscript for the variable "z", not the square of z Point 3: (A,B,-z3) Point 4: (x4,y4,-C) Point 5: (D,E,-C) A, B, C, D, and E are constants (given) I need to determine the variables z2, z3, x4, and y4 such that: 1) The path of the trajectory from Point 1 to Point 2 is a straight line 2) Points 2, 3, and 4 are on a circular path of constant radius 3) The path of the trajectory from Point 4 to Point 5 is a straight line 4) The straight line paths between points 1 and 2 and points 4 and 5 are tangents to the circular path described by points 2, 3, and 4 5) The straight line paths between points 1 and 2 and points 4 and 5 are perpendicular to each other. Now, what I want to be able to do is once the trajectory is determined, I want to be able to either: Given a distance, L, along the path of the trajectory from (0,0,0), determine the (x,y,z) coordinates of that point, or Given an (x,y,z) location on the trajectory, determine L (inverse of above) Thanks for any help or references. Brandon Nuttall _______________________________________________ SciPy-user mailing list [hidden email] http://projects.scipy.org/mailman/listinfo/scipy-user |
Free forum by Nabble | Edit this page |