Skip to content

Instantly share code, notes, and snippets.

View NoRaincheck's full-sized avatar

NoRaincheck

  • Nowhere
View GitHub Profile
@NoRaincheck
NoRaincheck / monokai.colorscheme
Last active February 16, 2025 11:28
Monokai colorscheme for qterminal or konsole
[Background]
Color=39,40,34
[BackgroundIntense]
Color=65,67,57
[Foreground]
Color=225,225,218
[ForegroundIntense]
@NoRaincheck
NoRaincheck / river_to_shap.py
Last active January 22, 2021 04:57
This is to demonstrate how we could naively convert a tree in River to work with the Shap library. This is in order to start a discussion. https://github.com/online-ml/river/issues/437
# The goal of this is to try to make use of Shap to explain a tree built in river.
# https://github.com/online-ml/river/issues/437
from functools import reduce
import operator
import numpy as np
import pandas as pd
import pprint
from sklearn import datasets
#!/usr/bin/env python
"""
Simple example of a full screen application with a vertical split.
This will show a window on the left for user input. When the user types, the
reversed input is shown on the right. Pressing Ctrl-Q will quit the application.
"""
from prompt_toolkit.application import Application
from prompt_toolkit.buffer import Buffer
from prompt_toolkit.key_binding import KeyBindings
@NoRaincheck
NoRaincheck / model_drift.py
Created November 17, 2019 21:04
model drift using sm models brief example
import pandas as pd
import statsmodels.api as sm
def test_rolling_mode():
"""
The goal of this application level monitoring is to react in light of changes
to re-model fits and movement in the modelling process. In the linear model
scenario, confidence intervals around the coefficients can be provided which
can be used as a measure for model drift over time.
@NoRaincheck
NoRaincheck / simplegrucell.py
Created November 10, 2019 20:50
This is an implementation of grucell in Keras. This shoudl allow for a bit more flexibility when not working under the "recurrent" framework
"""
This is a manual implementaiton of grucell so that it will work in more
general envrionments...
"""
import tensorflow as tf
input_size = 64
cell_size = 32
<script src='https://unpkg.com/[email protected]/dist/tesseract.min.js'></script>
<input type="file" onchange="getRego(this.files)">
<script>
function getRego(files) {
const worker = new Tesseract.TesseractWorker();
worker.recognize(files[0]).then(function(data){
// construct something which glues all the words together...
console.log(data.text);
})
import numpy as np
def linear_part(x, w):
return x * w
def non_linear(x, p=0.001):
multi = (x > 0).astype(np.float64)
multi[multi == 0] = 0.001
return x * multi
pareto_principle <- function(x){
return (x ^ (log(0.2)/log(0.8)))
}
sprintf("%.2f of the effort comes from %.2f of the causes", 0.99, pareto_principle(0.99))
sprintf("%.2f of the effort comes from %.2f of the causes", 0.95, pareto_principle(0.95))
sprintf("%.2f of the effort comes from %.2f of the causes", 0.8, pareto_principle(0.8))
sprintf("%.2f of the effort comes from %.2f of the causes", 0.5, pareto_principle(0.5))
@NoRaincheck
NoRaincheck / Dockerfile
Last active December 10, 2017 11:58
Simple test of docker and extending it.
FROM jupyter/r-notebook
# docker build --rm -t jupyter/extended-notebook .
# docker run --rm -it -p 8888:8888 jupyter/extended-notebook
RUN conda install --quiet --yes -c r rstudio=1.1*
RUN conda install --quiet --yes -c anaconda pandas scipy gensim scikit-learn
# install nbrsessionproxy
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#