|
Constructing real opponent ranges - #2 Aliases
A little house-keeping...
Welcome to part 2 of this series. In this part we will address aliases and how to manipulate them. Before we start messing around with the HEM backend, we are going to do a little house-keeping first. We are going to start with a backup of your HEM database. Please follow this guide FAQ - Hold'em Manager Poker Tracking Software :: Backup & Restore Database. Do not run the restore part of that article; that will only be run in the unlikely event that you break your HEM database. This step is really important as it will allow you to recover your database if you screw anything up, so please don't skip this step.
When you finish that part, you want to head back to pgAdmin III and we are going to fiddle with some of the settings in the Postgres config file. By altering the buffer and cache size, we are going to help it cope with the massive amount of information we are asking it to deal with. If you don't follow this step, HEM will likely have a hernia, fall over and run out of stack memory. The bigger your database, the more likely that is to happen.
From the HEM forums:
Edit your PosgreSQL.conf file in the SQL 8.x/data folder.
Do not use the Tuning Wizard. On some systems it will make changes to the postgresql.conf it shouldn't, resulting in being unable to connect to the database!
If you experience this problem--> simply go to the 8.4/data folder, undo the changes you made and reboot.
Recommended changes:
shared_buffers = MB (set this to 20% of your system memory, but not more than 1000 MB.... round it off to 128 MB, 256 MB, 512 MB or 768 MB)
effective_cache_size = MB (set this to 2x the size of the shared_buffers)
Building your first alias in SQL
Having done all that, you are ready to jump into the fun bit! We are going to build a simple alias that should run on all systems as long as you have a reasonable number of HHs. This alias will only include hands we have played against regular players. Later on we will play around with including data from all players, but for now we will start with something simple.
Open up pgAdmin III again. Double-click on whatever version of postgreSQL you are using. Double-click on your database. It may ask for a password, by default the password will be “postgrespass”. Click the icon to run a SQL query. Highlight and delete everything in the SQL Editor box. Copy and paste the following code into the editor and click the execute query button (a green arrow). That will run the code and a blank box will appear in the output pane when it is finished.
Code by redlotus on HEM forums
Code:
CREATE OR REPLACE FUNCTION fn_alias_regs(alias_name text, min_hands integer)
RETURNS void AS
$BODY$INSERT INTO players (site_id, playername, cashhands, tourneyhands, playertype_id)
VALUES (-1, $1, 0,0,0);
INSERT INTO aliases (aliasplayer_id, player_id)
SELECT (SELECT MAX(player_id) FROM players), player_id FROM players
WHERE tourneyhands>$2$BODY$
LANGUAGE 'sql' VOLATILE
COST 100;
SELECT fn_alias_regs('Tourney_Regs', 1000);
This example creates an alias called Tourney_Regs with all tournaments players on which you have 1000 hands. Note if you wanted cash players, you'd just change “WHERE tourneyhands>$2$BODY$” to “WHERE cashhands>$2$BODY$”.
What this means is that it will consider every hand (that meet the criteria) as if you played it and add it to the alias "Tourney_Regs". This allows us to work with our opponents data as if it is our own and run the same stats we would run on our data.
Clean up your alias
One final thing to do is to clean up the alias. The SQL query we just ran added your name to the alias too since HEM definitely has 1000 hands on you! We aren't really interested in our own stats as we are interested in how our opponents play, not how we play.
Open up HEM. Click on options ---> Player Aliases.... Click on the alias you just made and find all instances of your own screen name. Unfortunately player names are not stored in any particular order, so you just have to scroll through the list of player names. A helpful tip is that pushing the first letter of you player name will jump, in order, to all players starting with that letter. It speeds up the process significantly.
Now that you have an alias containing all players with more than 1000 hands, you can actually start to do some analysis on how regulars behave. With “Tourney_Regs” selected as the player name, run some reports and filters and see how often the average regular player is raising from particular spots. Just run with it and have a bit of fun.
The next article
There is no ETA for the next article as my migration to Windows 7 has cocked up the HEM import function. News from HEM support indicates that this is a known problem, but as we all know, HEM is devoting more time to other projects and there is no ETA on when a fix will be release. In my experience with HEM that means it's going to take quite a while. To run the next section I will need to have some hands in my database. When that happens we will look at building some ranges from all players, not just tourney regs as well as filtering down the selection criteria for adding players to the alias.
|