Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| import polars as pl | |
| from scipy import stats | |
| from scipy.optimize import minimize, minimize_scalar | |
| from scipy import special | |
| from abc import ABC, abstractmethod |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # | |
| # Utils # | |
| # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # | |
| ltail <- function(l) { | |
| l[[length(l)]] | |
| } | |
| lappend <- function(l, object) { | |
| l[[length(l) + 1]] <- object |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| hp | cyl | gear | wt | mean | low | high | |
|---|---|---|---|---|---|---|---|
| 52 | high | A | 3.2172500000000004 | 21.67458005068266 | 16.675258186122484 | 26.226023777045278 | |
| 53 | high | A | 3.2172500000000004 | 21.639924307207576 | 16.672473098966474 | 26.158665545109788 | |
| 54 | high | A | 3.2172500000000004 | 21.60526856373249 | 16.669688011810464 | 26.093763825389733 | |
| 56 | high | A | 3.2172500000000004 | 21.535957076782324 | 16.664117837498452 | 25.96509423662654 | |
| 57 | high | A | 3.2172500000000004 | 21.501301333307246 | 16.661332750342442 | 25.907608275838484 | |
| 59 | high | A | 3.2172500000000004 | 21.43198984635708 | 16.655762576030426 | 25.771625535629838 | |
| 60 | high | A | 3.2172500000000004 | 21.39733410288199 | 16.652977488874416 | 25.705187334912992 | |
| 61 | high | A | 3.2172500000000004 | 21.36267835940691 | 16.65019240171841 | 25.64056318668881 | |
| 63 | high | A | 3.2172500000000004 | 21.293366872456748 | 16.644622227406394 | 25.511314890240445 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Will be useful when we work with non-linear terms in Bambi. | |
| # This is the first step. | |
| # 1. Split top level terms DONE | |
| # 2. Detect terms where non-linear parameters play a role TO DO | |
| # 3. Manipulate the expression in terms where non-linear parameters play a role | |
| # to pass only the 'predictor' to `formulae`, but keep the expression to be used later TO DO | |
| import ast | |
| from functools import singledispatch |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| year | age | name | movie | |
|---|---|---|---|---|
| 2006 | 29 | Reese Witherspoon | Walk the Line | |
| 2007 | 61 | Helen Mirren | The Queen | |
| 2008 | 32 | Marion Cotillard | La Vie en rose | |
| 2009 | 33 | Kate Winslet | The Reader | |
| 2010 | 45 | Sandra Bullock | The Blind Side | |
| 2011 | 29 | Natalie Portman | Black Swan | |
| 2012 | 62 | Meryl Streep | The Iron Lady | |
| 2013 | 22 | Jennifer Lawrence | Silver Linings Playbook | |
| 2014 | 44 | Cate Blanchett | Blue Jasmine |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import keyword | |
| keywords = keyword.kwlist.copy() | |
| kwrds_n = len(keywords) | |
| rows_n = 7 | |
| cols_n = kwrds_n // rows_n if kwrds_n % rows_n == 0 else (kwrds_n // rows_n) + 1 | |
| keywords_list = [ | |
| [ | |
| keywords[rows_n * j + i] |
NewerOlder