Prev | Current Page 241 | Next

Gene Smith

"Tagging: People-powered Metadata for the Social Web"

In fact, linear scaling will flatten the
curve, which explains the name.
Logarithms are the mathematical magic behind linear scaling. A full discussion of
logarithms is beyond the scope of this book, but the simplest explanation is that linear
scaling compresses the frequency counts so that they??™re evenly??”instead of exponentially
??”distributed.
In this example, the database will perform the logarithm operation rather than PHP.
There are two potential benefits to this approach:
First, databases tend to be faster than server-side scripts.
Second, the formula you used in the previous proportional scaling example will
work perfectly well in this example.
The SQL query from Script 7.4 will have to change so that it returns the logarithm of
the frequency count instead of the raw frequency count. You??™ll use MySQL??™s LOG()
function to do the computation.
Note
Most databases have a logarithm function; MySQL has three. In most cases it
won??™t matter which you choose.
The SQL statement from Script 7.


Pages:
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253