认真对待每一件事_认真对待事情:假日版

认真对待每一件事

For some reason Atlanta got a pretty significant amount of snow yesterday, and because of that I’ve been mostly stuck at home. When faced with that kind of time on hand, sometimes I spend too much time on things that don’t really matter all that much. Recently, I’ve been fascinated with rating systems (see a post on Elote here), so that was in the front of my mind this week.

由于某种原因,亚特兰大昨天下了很多雪,因此我大部分时间都呆在家里。 当面对这样的时间时,有时我会花很多时间在那些无关紧要的事情上。 最近,我对评级系统着迷(在此处查看Elote上的帖子),所以这就是本周我的脑海。

Every year, around this time, my family does a college football bowl game pick ’em pool. We all pick who we think is going to win each respective bowl game, and whoever gets the most right at the end of it all (weighted by the tier of game it is sometimes), wins a prize. The prize is unimportant, what’s important is that I’ve never won.  And that bothers me.

每年大约在这个时候,我的家人都会参加大学橄榄球碗比赛来选拔他们的游泳池。 我们所有人都选出我们认为将赢得各自碗球比赛的人,并且在最后一切最正确的人(有时由比赛的等级来加权)赢得奖品。 奖金并不重要,重要的是我从未赢过。 那困扰着我。

So for the past day I’ve been continuing to develop elote, a python package for developing rating systems, and two complimentary projects that I just published:

因此,在过去的一天中,我一直在继续开发elote,一个用于开发评分系统的python软件包以及两个我刚刚发布的免费项目:

  1. keeks: a python package for bankroll allocation strategies, like the Kelly Criterion
  2. keeks-elote: a python package for backtesting coupled rating systems and bankroll allocation strategies
  1. keeks :用于资金分配策略的python包,例如Kelly Criterion
  2. keeks-elote :一个Python包,用于回测耦合的评级系统和资金分配策略

So with all 3 of these, some historical odds data and the data for this season of college football games, I can develop a rating system capable of ranking football teams at each week of the season, a prediction component which estimates likelihood of victory between any two teams using those rankings, a bankroll allocation strategy to turn those estimates and odds into a set of bets, and backtesting system to evaluate the whole thing. That sounds like a lot, because it is.

因此,利用所有这3个数据,一些历史赔率数据以及本赛季大学橄榄球比赛的数据,我可以开发一种能够在赛季的每个星期对橄榄球队进行排名的评估系统,该预测系统可以估算任意两次比赛之间获胜的可能性两个团队使用这些排名,一项资金分配策略将这些估计和赔率转化为一组下注,以及回测系统来评估整个事情。 听起来很多,因为确实如此。

So here’s what the script actually looks like at the end (I recommend reading the elote post before this if you haven’t already):

因此,这是脚本最后的实际外观(如果您还没有的话,我建议您先阅读elote文章 ):


from elote import LambdaArena, EloCompetitor, ECFCompetitor, GlickoCompetitor, DWZCompetitor
from keeks import KellyCriterion, BankRoll, Opportunity, AllOnBest
from keeks_elote import Backtest
import datetime
import json


# we already know the winner, so the lambda here is trivial
def func(a, b):
    return True


# the matchups are filtered down to only those between teams deemed 'reasonable', by me.
filt = {x for _, x in json.load(open('./data/cfb_teams_filtered.json', 'r')).items()}
games = json.load(open('./data/cfb_w_odds.json', 'r'))

# batch the games by week of year
games = [(datetime.datetime.strptime(x.get('date'), '%Y%m%d'), x) for x in games]
start_date = datetime.datetime(2017, 8, 21)
chunks = dict()
for week_no in range(1, 20):
    end_date = start_date + datetime.timedelta(days=7)
    chunks[week_no] = [v for k, v in games if k > start_date and k <= end_date]
    start_date = end_date

# set up the objects
arena = LambdaArena(func, base_competitor=GlickoCompetitor)
bank = BankRoll(10000, percent_bettable=0.05, max_draw_down=1.0, verbose=1)
# strategy = KellyCriterion(bankroll=bank, scale_bets=True, verbose=1)
strategy = AllOnBest(bankroll=bank, verbose=1)

backtest = Backtest(arena)

# simulates the betting
backtest.run_explicit(chunks, strategy)

# prints projected results of the next week based on this weeks rankings
backtest.run_and_project(chunks)

All of this, including the source data, is in the repo for keeks-elote, under examples.

在所有示例中,所有这些,包括源数据,都在keeks-elote的回购中。

So to begin with we are basically just setting up our data. Keeks-elote takes data of the form:

因此,首先我们基本上只是设置数据。 Keeks-elote采用以下形式的数据:


{
    period: [
        {
            "winner": label,
            "loser": label,
            "winner_odds": float,
            "loser_odds": float
        },
        ...
    ],
    ...
}

So each week of the season is a period, and each game that week is a nested blob with winner and loser indicated, and odds if we have them. Keeks-elote will iterate through the weeks, making bets and then updating the rankings based on the results of the week.

因此,本赛季的每个星期都是一个时期,并且该周的每个比赛都是嵌套的斑点,上面显示了获胜者和失败者,如果有,则为几率。 Keeks-elote将迭代一周,下注,然后根据一周的结果更新排名。

As the user, you can see we really only have to define a few things once the data is in the correct format:

作为用户,您可以看到,只有在数据格式正确后,我们才真正需要定义一些内容:

  • Arena: we need to define a lambda arena, which will take in data as passed in. As I work with some more datasets, I expect that this can be handled under the hood by the backtester, but we will see.
  • Bankroll: the bankroll is only needed if you are making a strategy, which is only needed if you are going to use run explicit to simulate bets. It takes a starting value, you can optionally set a max drawdown percentage to quit at, and a percentage of the total to bet each period.
  • Strategy: the strategy is what converts likelihood and odds to a set of bets. Currently there are two types implemented, both shown here. Kelly Criterion attempts to be clever, AllOnBest just puts the max amount bettable on the bet with highest likelihood to be correct.
  • Arena:我们需要定义一个lambda竞技场,它将接收传入的数据。当我处理更多数据集时,我希望这可以由回测器在后台进行处理,但是我们会看到的。
  • 资金:只有在制定策略时才需要资金,仅当您要使用显式运行模拟投注时才需要资金。 它有一个初始值,您可以选择设置最大退出百分比以退出,以及每个周期下注总额的百分比。
  • 策略:策略是将可能性和赔率转换为一组赌注的方法。 当前实现了两种类型,都在此处显示。 凯利标准(Kelly Criterion)尝试变得聪明,AllOnBest只是将最大可投注金额放在最有可能正确的投注上。

As configured in that script, with the data I have, I get this output (betting doesn’t start until we have a few weeks of ratings):

按照该脚本中的配置,使用我拥有的数据,我得到以下输出(直到我们有了几周的评分之后,投注才开始):


running with week 1

running with week 2

running with week 3

running with week 4
evaluating 500.0 on Opportunity: Buffalo over FL_Atlantic
depositing 384.62 in winnings
bankroll: 10384.62

running with week 5
evaluating 519.23 on Opportunity: Stanford over Arizona_St
depositing 51.92 in winnings
bankroll: 10436.54

running with week 6
evaluating 521.83 on Opportunity: W_Michigan over Buffalo
depositing 177.49 in winnings
bankroll: 10614.03

running with week 7
evaluating 530.7 on Opportunity: Arkansas_St over Coastal_Car
depositing 63.71 in winnings
bankroll: 10677.74

running with week 8
evaluating 533.89 on Opportunity: Colorado_St over New_Mexico
depositing 144.29 in winnings
bankroll: 10822.04

running with week 9
evaluating 541.1 on Opportunity: Notre_Dame over NC_State
depositing 184.05 in winnings
bankroll: 11006.08

running with week 10
evaluating 550.3 on Opportunity: Arkansas over Coastal_Car
depositing 16.51 in winnings
bankroll: 11022.59

running with week 11
evaluating 551.13 on Opportunity: Oklahoma over TCU
depositing 181.89 in winnings
bankroll: 11204.49

running with week 12
evaluating 560.22 on Opportunity: Wake_Forest over NC_State
depositing 368.57 in winnings
bankroll: 11573.05

running with week 13
evaluating 578.65 on Opportunity: Washington over Washington_St
depositing 162.09 in winnings
bankroll: 11735.14

running with week 14
evaluating 586.76 on Opportunity: Boise_St over Fresno_St
depositing 152.41 in winnings
bankroll: 11887.54

Seems reasonable to me.

对我来说似乎合理。

So before I get to my bowl picks from this system, these projects are pretty fun, and we can make some interesting projections on a lot of things, both within and outside of sports. If you’re interested in this kind of thing, comment here or find any of the projects on github and get involved:

因此,在我从这个系统中获得精选之前,这些项目非常有趣,我们可以对体育内外的许多事物进行一些有趣的预测。 如果您对这种事情感兴趣,请在此处评论或在github上找到任何项目并参与其中:

Ok, here’s the picks based on Glicko1 ratings, which performed well in backtests (and more importantly has Auburn winning and Alabama losing), I’ll do another post in about a month with how we did:

好的,这是基于Glicko1评分的精选,在回测中表现良好(更重要的是Auburn获胜,阿拉巴马州失利),我将在一个月左右的时间里再写一篇关于我们如何做的文章:

Winner优胜者 Loser失败者
West Virginia 西弗吉尼亚 Utah 犹他州
N Illinois 伊利诺伊州 Duke 公爵
UCLA 加州大学洛杉矶分校 Kansas State 堪萨斯州
Florida State 佛罗里达州 Southern Miss 南方小姐
BC 公元前 Iowa 爱荷华州
Purdue 普渡大学 Arizona 亚利桑那
Missou ou Texas 德州
Navy 海军 Virginia 维吉尼亚州
Oklahoma St. 俄克拉何马州圣 VT 室速
TCU TCU Stanford 斯坦福大学
Michigan St. 密歇根街 Washington St. 华盛顿街
Texas A&M 德州农工大学 Wake Forest 唤醒森林
Arizona St. 亚利桑那州圣 NC State NC状态
Northwestern 西北地区 Kentucky 肯塔基州
New Mexico State 新墨西哥州 Utah State 犹他州
Ohio State 俄亥俄州 USC 南加州大学
Miss St. 圣小姐 Louisville 路易斯维尔
Memphis 孟菲斯 Iowa St. 爱荷华州圣
Penn St. 宾夕法尼亚街 Washington 华盛顿州
Miami 迈阿密 Wisconson 威斯康森
USCe 美国大学 Michigan 密西根州
Auburn 奥本 UCF UCF
LSU 路易斯安那州立大学 Notre Dame 巴黎圣母院
Oklahoma 俄克拉荷马州 UGA 乌加
Clemson 克莱姆森 Alamaba 阿拉马巴
N. Texas 北德克萨斯 Troy 特洛伊
Georgia State 佐治亚州 WKU 武汉大学
Oregon 俄勒冈州 Boise St. 博伊西街
Colorado St. 科罗拉多州圣 Marshall 马歇尔
Arkansas St. 阿肯色州圣 MTSU MTSU
Grambling Grambling NC A&T NC A&T
Reinhardt 赖因哈特 St. Francis IN 在圣弗朗西斯
FL Atlantic FL大西洋 Akron 阿克伦
SMU SMU Louisiana Tech 路易斯安那科技
Florida International 佛罗里达国际 Temple 寺庙
Ohio 俄亥俄 UAB UAB
Wyoming 怀俄明州 C. Michigan 密歇根州
S. Florida 南佛罗里达 Texas Tech 德州理工
Army 军队 SDSU SDSU
Toledo 托莱多 App State 应用状态
Houston 休斯顿 Fresno State 弗雷斯诺州

分享这个: (Share this:)

像这样: (Like this:)

翻译自: https://www.pybloggers.com/2017/12/on-taking-things-to-seriously-holiday-edition/

认真对待每一件事

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值