Using LOG function in Custom Stat

Forum for users that want to write their own custom queries against the PT database either via the Structured Query Language (SQL) or using the PT3 custom stats/reports interface.

Moderator: Moderators

Using LOG function in Custom Stat

Postby t3hnu7z » Sun Aug 29, 2010 5:15 pm

I'm banging my head against the wall trying to use LOG (or LOG10) in a custom stat. It tells me the expression is invalid. I've deduced the problem is in using the LOG function as the expression is valid when it is removed.

I've tried the following expressions with no luck:

LOG( cnt_tourneys )
LOG( 10 , cnt_tourneys )
LOG10( cnt_tourneys )

Am I unable to use this function when creating a Custom Stat?
t3hnu7z
 
Posts: 54
Joined: Wed Jan 14, 2009 11:12 pm

Re: Using LOG function in Custom Stat

Postby WhiteRider » Mon Aug 30, 2010 4:42 am

I think you will only be able to use LOG in columns as that is where the SQL is done - statistics don't use SQL directly so you can't use PostgreSQL functions there.
What are you trying to do, exactly? What section is the stat in?
WhiteRider
Moderator
 
Posts: 54025
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Re: Using LOG function in Custom Stat

Postby t3hnu7z » Tue Aug 31, 2010 5:26 pm

I'm in the Omaha Tournament Tournaments section.

The idea I'm working on is using sample size (number of tourneys) to enhance the value of other stats. For example:

Which is a more menacing foe?

a) 10% ROI over 250 games
b) 7% ROI over 2500 games

We could simply say that 10% is more than 7% and be done with it, but a sample size of 250 games isn't nearly as accurate as a 2500 game sample. If we multiply the ROI by number of tourneys, we add value to the sample size, but at what cost?

a) 10 x 250 = 2500
b) 7 x 2500 = 17500

We're pretty much just finding their total earnings. We now have too much emphasis on the sample size and not the ROI.

If we take the LOG (base10) of the number of games I believe it gives us a happy medium and a number that can be compared to find our most troublesome opponents.

a) 10 x LOG(250) = ~24.0
b) 7 x LOG(2500) = ~23.8

Now these two foes are on fairly even keel with each other (more accurate, imo).

What do you think?
t3hnu7z
 
Posts: 54
Joined: Wed Jan 14, 2009 11:12 pm

Re: Using LOG function in Custom Stat

Postby kraada » Wed Sep 01, 2010 9:21 am

Edited: I take back what I said, I'm working on a way to get this functional now. The issue is with the validation method we use, but I think I can finagle a way through it.
kraada
Moderator
 
Posts: 54430
Joined: Wed Mar 05, 2008 2:32 am
Location: NY

Re: Using LOG function in Custom Stat

Postby kraada » Wed Sep 01, 2010 9:40 am

Okay, double posting just in case you already saw my previous reply.

Create a column in the Omaha Tournament Tournaments section with the following definition:

log(if[sum(tourney_omaha_summary.id_tourney) != 0, count(distinct tourney_omaha_summary.id_tourney), 1])

Use that column in your stat and it should display the value you're looking for. The problem was that we validate by forcing the query to have no actual data then making sure the query doesn't return an error (for a malformed expression or some such) - but in this case, log(0) is undefined, so we needed to make sure we got log(1) if and only if we had no data, hence the if[] statement as constructed.
kraada
Moderator
 
Posts: 54430
Joined: Wed Mar 05, 2008 2:32 am
Location: NY

Re: Using LOG function in Custom Stat

Postby t3hnu7z » Fri Sep 03, 2010 12:01 pm

Thanks for the assistance, kraada. You guys are the best! :)
t3hnu7z
 
Posts: 54
Joined: Wed Jan 14, 2009 11:12 pm


Return to Custom Stats, Reports, and SQL [Read Only]

Who is online

Users browsing this forum: No registered users and 0 guests