Skip to content

Instantly share code, notes, and snippets.

@svaiml
svaiml / RuleAugmentedEstimator.py
Created June 5, 2022 20:30 — forked from LukasHaas/RuleAugmentedEstimator.py
Augment Sklearn Models with Rule-Based Logic
import numpy as np
import pandas as pd
import sklearn
from typing import Dict, Tuple
from sklearn.base import BaseEstimator
class RuleAugmentedEstimator(BaseEstimator):
"""Augments sklearn estimators with rule-based logic.
@svaiml
svaiml / bq_easy.py
Created March 17, 2022 10:57 — forked from korakot/bq_easy.py
Using bigquery easily in Google Colab. Focus on a single table.
import re
import pandas as pd
from google.cloud import bigquery
from google.colab import auth
PROJECT_ID = 'sql-hunt' # change to your own project
class BqTable:
def __init__(self, table, dataset='samples', active_project='bigquery-public-data', client=None):
@svaiml
svaiml / kernel.py
Created March 17, 2022 10:01 — forked from korakot/kernel.py
Install rust, cargo in Colab
# run this once, then reload, and then skip this
!apt install rustc
!gdown --id 1PULtTc-2e9z4bswh_SQqL5oy_4JpfV7c
!chmod +x evcxr_jupyter
!./evcxr_jupyter --install
// install dependency
:dep cmd_lib
use cmd_lib::run_cmd as sh;