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
    
  
  
    
              Show hidden characters
| { | |
| // Place your lang workspace snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and | |
| // description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope | |
| // is left empty or omitted, the snippet gets applied to all languages. The prefix is what is | |
| // used to trigger the snippet and the body will be expanded and inserted. Possible variables are: | |
| // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. | |
| // Placeholders with the same ids are connected. | |
| // Example: | |
| // "Print to console": { | |
| // "scope": "javascript,typescript", | 
  
    
      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
    
  
  
    
  | { | |
| // Place your foam-template workspace snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and | |
| // description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope | |
| // is left empty or omitted, the snippet gets applied to all languages. The prefix is what is | |
| // used to trigger the snippet and the body will be expanded and inserted. Possible variables are: | |
| // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. | |
| // Placeholders with the same ids are connected. | |
| // Example: | |
| // "Print to console": { | |
| // "scope": "javascript,typescript", | 
  
    
      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
    
  
  
    
  | # To simplify frontmatter of md files created in Dendron to fit my taste | |
| # - remove 'id', 'title', 'desc' | |
| # - convert 'created' and 'updated' to human readable format | |
| # to enable all outputs per cell | |
| from IPython.core.interactiveshell import InteractiveShell | |
| InteractiveShell.ast_node_interactivity = "all" | |
| import pandas as pd | |
| pd.options.display.max_rows = 4000 | 
  
    
      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
    
  
  
    
  | -==- | |
| rc |+| ```r%\n%\e%\n``` | |
| -==- | |
| pc |+| ```python%\n%\e%\n``` | |
| -==- | |
| sc |+| ```sql%\n%\e%\n``` | |
| -==- | |
| bc |+| ```bash%\n%\e%\n``` | |
| -==- | |
| tc |+| ```text%\n%\e%\n``` | 
  
    
      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
    
  
  
    
  | alias gs='git status ' | |
| alias ga='git add ' | |
| alias gb='git branch ' | |
| alias gc='git commit ' | |
| alias gd='git diff' | |
| alias gds='git diff --staged' | |
| alias gk='gitk --all&' | |
| alias gb='git branch ' | |
| alias gl='git log --pretty=format:"%h: %ad: %an: %s" --date=short' | 
  
    
      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
    
  
  
    
  | ## combine using s.e. using the logic here | |
| # Ben 2014 | |
| # https://stackoverflow.com/a/26206495/4475353 | |
| # Ben 2023 | |
| # https://stackoverflow.com/questions/76317756/calculate-confidence-interval-of-random-fixed-effect-coefficients-in-a-mixed-e | |
| library(tidyverse) | |
| library(janitor) | 
  
    
      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 pickle | |
| def write_pickle(obj, file_name): | |
| with open(file_name, 'wb') as fp: | |
| pickle.dump(obj, fp) | |
| def read_pickle(file_name): | |
| with open(file_name, 'rb') as fp: | |
| result = pickle.load(fp) | |
| return result | 
  
    
      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
    
  
  
    
  | install.packages('tidyverse') | |
| install.packages('here') | |
| library(tidyverse) | |
| library(here) | |
| # rstan ------------------------------------------------------------------- | 
  
    
      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
    
  
  
    
  | library(MASS) | |
| library(tidyverse) | |
| sim <- function(r){ | |
| n_obs <- 200 | |
| mean_vec <- c(3, 4) | |
| cov_mat <- matrix(c(1, r, r, 1), nrow = 2) | |
  
    
      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
    
  
  
    
  | # https://github.com/scikit-learn/scikit-learn/issues/12525#issuecomment-1071203398 | |
| # Just shorten the function name | |
| import pandas as pd | |
| from skimpy import clean_columns | |
| from sklearn.compose import ColumnTransformer | |
| from sklearn.pipeline import Pipeline | |
| from sklearn.utils.validation import check_is_fitted | |
| def get_feature_names(column_transformer, clean_column_names=False, verbose=True): | 
NewerOlder