Several Expression Filters Questions

Discuss how to create custom stats, reports and HUD profiles and share your creations.

Moderators: WhiteRider, kraada, Flag_Hippo, morny, Moderators

Several Expression Filters Questions

Postby ginseng » Tue Dec 15, 2020 4:30 am

Hello,

I have been making great use of the All Players Reports in the 'My Reports' tab of PT4 recently. I have a fairly large data base with ~23 million 6max hands. Now, I would like to filter reports in certain ways but I'm having a tough time. It is my understanding that the best way for me to achieve what I'm trying to do is through the use of Expression Filters.

For example, I'd like to, on an All Players Report where the 'Players' report stat is removed ('Hands' is really the only stat I need for now), see the number of hands where a player with some VPIP range (say between 20 and 30 percent) bet out of position on the flop. My idea is to then look at the number of times a player with this VPIP range saw the flop (without going all in preflop) and get an idea of how often they take this action. I've found a number of posts asking how to do things like this but most of the information given was a bit overwhelming and I found it difficult to make use of it as I have zero base understanding of these expression filters-- I'm hoping someone could clear up some of my questions so that I am able to make use of these posts.

1. Is what I'm trying to do possible (filter by both VPIP and certain actions in the hand)? I read this - https://www.pokertracker.com/forums/viewtopic.php?f=18&t=20574 - forum post where someone appears to say that such a thing is not possible without some workaround-- that was however in 2009 so maybe things are different now. If it is doable, would anyone mind writing out a piece of code showing how this can be achieved with expression filters just to get me started (unless it is complicated and would take too much time-- I assume that isn't the case).

2. Is it possible to use both expression and normal/regular filters at the same time or would this all need to be done as an expression filter?


Some questions so that I may try to start creating some very basic expression filters:

3. I occasionally see people create expression filters where someone wants to evaluate VPIP and they simply write
Code: Select all
#VPIP#
followed by some restrictions and other times where someone writes something like
Code: Select all
((cnt_vpip / (cnt_hands - cnt_walks)) * 100)
followed by some restrictions. What is the difference between these two things and when would one use one over the other in an expression filter?

4. I also often see people use
Code: Select all
cash_hand_player_statistics
or something similar. When is this necessary? (Perhaps this is actually for custom stats as opposed to expression filters, please correct me if I am wrong here)

5. If I want to learn to be able to easily create my own expression filters, what do I need to learn? Basic SQL?

Sorry for all the questions... as I said I was just overwhelmed by the info on expression filters as I had no base understanding of it. Any help is greatly appreciated. Thank you
ginseng
 
Posts: 2
Joined: Sat Dec 12, 2020 8:04 pm

Re: Several Expression Filters Questions

Postby Flag_Hippo » Tue Dec 15, 2020 1:13 pm

ginseng wrote:1. Is what I'm trying to do possible (filter by both VPIP and certain actions in the hand)? I read this - https://www.pokertracker.com/forums/viewtopic.php?f=18&t=20574 - forum post where someone appears to say that such a thing is not possible without some workaround-- that was however in 2009 so maybe things are different now. If it is doable, would anyone mind writing out a piece of code showing how this can be achieved with expression filters just to get me started (unless it is complicated and would take too much time-- I assume that isn't the case).

Can you please provide a specific example/scenario that you would want to filter for.
ginseng wrote:2. Is it possible to use both expression and normal/regular filters at the same time or would this all need to be done as an expression filter?

Yes it's possible although depending on the specific filters it might not always work as expected and everything will need to be in one or the other.
ginseng wrote:3. I occasionally see people create expression filters where someone wants to evaluate VPIP and they simply write
Code: Select all
#VPIP#
followed by some restrictions and other times where someone writes something like
Code: Select all
((cnt_vpip / (cnt_hands - cnt_walks)) * 100)
followed by some restrictions. What is the difference between these two things and when would one use one over the other in an expression filter?

If you have an 'All Players' report with a full list of players and the VPIP statistic displayed for every player in the report you can simply filter players by the value of the VPIP statistic displayed directly in that report using #VPIP# however if you have removed the 'Player' statistic from the report such that the report is all grouped on one line and the individual values are no longer available then that needs a more complex filter to query the players.
ginseng wrote:4. I also often see people use
Code: Select all
cash_hand_player_statistics
or something similar. When is this necessary? (Perhaps this is actually for custom stats as opposed to expression filters, please correct me if I am wrong here)

That is a database table for storing data for cash game players and it used in custom statistics as well as expression filters. There are other database tables as well - for example the cash_hand_summary table stores information about each hand such as the pot size on each street.
ginseng wrote:5. If I want to learn to be able to easily create my own expression filters, what do I need to learn? Basic SQL?

Expression filters are basically the same as regular/custom statistics but with less formatting - for example you can use the code from statistics in an expression filter with the method described here. This guide covers the basics on custom statistics creation and this guide goes into more detail. The latter was written for PokerTracker 3 but the techniques all apply to PokerTracker 4, the interface is just slightly different. Also while we have not published the schema like we did for PokerTracker 3 the meaning of database fields haven't changed in any significant way and you can find the files used to create the database in your PokerTracker4 installation folder:

C:\Program Files (x86)\PokerTracker 4\Data\Schemas

Forum member 'Bininu' also made their own schema document for PokerTracker 4 available in this thread.
Flag_Hippo
Moderator
 
Posts: 17136
Joined: Tue Jan 31, 2012 7:50 am

Re: Several Expression Filters Questions

Postby ginseng » Tue Dec 15, 2020 5:33 pm

This is all extremely helpful information. Thank you for this response.

Flag_Hippo wrote:Can you please provide a specific example/scenario that you would want to filter for.


Yes, something like the following scenario would be what I'm looking for. If such a query is invalid or I haven't given you enough information please let me know. This is for an All Players Report with the 'Hands' stat showing. If it isn't too much trouble, I'd love to see if this can be done both with the 'Players' stat showing and without the 'Players' stat showing-- if one or the other is not possible than please let me know. Preferably I would like to have the players stat not showing but I'm interested in seeing it done both ways (again, if possible, and if you're willing to show examples of the code for it both showing and not showing).

Let's say, in a 6max NLHE game, with the following preflop action-- someone with VPIP between 30 and 35 percent is in the big blind, it folds around to some player who is in some position before the small blind who raises, it folds back around to the person in the big blind and they call (so we are 2 ways to the flop, and without BB calling all in since I want to consider flop action)-- how many times this player in the big blind with our defined VPIP range then leads on the flop.

Thank you again for your help, I really appreciate it.
ginseng
 
Posts: 2
Joined: Sat Dec 12, 2020 8:04 pm

Re: Several Expression Filters Questions

Postby Flag_Hippo » Thu Dec 17, 2020 8:41 am

This expression filter will only work with the 'Player' statistic included but the summary line at the bottom of the report will have the same information as an 'All Players' report with the player statistic removed:

Code: Select all
cash_hand_summary.str_aggressors_p LIKE '8_' and cash_hand_summary.str_actors_p LIKE '_8' and cash_hand_summary.str_actors_p NOT LIKE '98' and cash_hand_summary.cnt_players between 3 and 6 and cash_hand_player_statistics.position = 8 and cash_hand_player_statistics.id_hand in (select chps.id_hand from cash_hand_player_statistics chps where chps.id_player in (select cc.id_player from cash_cache cc where true group by cc.id_player having ((sum(cc.cnt_vpip) * 1.0) / (sum(cc.cnt_hands) * 1.0) - sum(cc.cnt_walks) * 1.0) between .30 and .35) and chps.position = 8 and chps.flg_f_bet)
Flag_Hippo
Moderator
 
Posts: 17136
Joined: Tue Jan 31, 2012 7:50 am


Return to Custom Stats, Reports and HUD Profiles

Who is online

Users browsing this forum: No registered users and 0 guests