btherl Posted September 26, 2008 Share Posted September 26, 2008 Let's say I have the following specification: f(100000) = 5 f(50000) = 200 f(1) = 1000000 Those are 3 points I've specified. I want a function f() which is a smooth, log-like curve that passes exactly (or really really close) through those points. Is there a method I can use to construct this function such that the final function can be implemented in php? The method of constructing does not need to be in php, just the function f() itself. Quote Link to comment Share on other sites More sharing options...
corbin Posted September 26, 2008 Share Posted September 26, 2008 Hrmmm, I can't help much unfortunately, but it would be logarithmic regression. I've worked with linear and quadratic regression before, but never logarithmic. I would imagine it would be similar math behind them, but I can't remember exactly how it works. Quote Link to comment Share on other sites More sharing options...
btherl Posted September 29, 2008 Author Share Posted September 29, 2008 Thanks for that keyword! I found a site which did logarithmic regression with a function aln(x) + b, but it couldn't make a curve fitting that data. Now I have an idea of where to look though! Quote Link to comment Share on other sites More sharing options...
corbin Posted September 29, 2008 Share Posted September 29, 2008 No problem. Hope ya figure it out or someone can come along and tell ya exactly what you're looking for. If only I knew more calculus . (Actually this would probably be borderline calculus and more algebra, but oh well.) Quote Link to comment Share on other sites More sharing options...
akitchin Posted September 29, 2008 Share Posted September 29, 2008 another regression to look up might be exponential, using a negative exponent and whatever base fits the best. just another option. don't forget that you can always change the base of a logarithm by using the base-change formula. Quote Link to comment Share on other sites More sharing options...
corbin Posted September 29, 2008 Share Posted September 29, 2008 Just of curiosity, where is the data coming from, and what is the purpose of it? Quote Link to comment Share on other sites More sharing options...
btherl Posted September 30, 2008 Author Share Posted September 30, 2008 This particular data is from a friend of mine who wants to assign dollar values to rankings. Rank 1 is worth $1,000,000, rank 100,000 is worth $5, and rank 50,000 is worth $200. But the general problem is one that I often want to solve for making heuristics that take rankings and various other data as input, and produce a score as output. For example, I may want to convert a keyword search count to a linear scale from 0 to 10, but I want the conversion to be log-like. Then I might want a function like: Search Count => Score 1,000,000 or more => 10 100,000 => 5 10,000 => 3 1,000 => 2 100 => 1 10 or less => 0 So the shape looks logarithmic, but a simple logarithm will never match all those points (though it might get close enough). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.