Skip to content

Instantly share code, notes, and snippets.

View kmdupr33's full-sized avatar

Matt Dupree kmdupr33

View GitHub Profile
def show_doubt_if_modeling():
global _o_predicates
if 'model' in dc_code and 'X' in dc_code and 'y' in dc_code:
from doubtlab.ensemble import DoubtEnsemble
from doubtlab.reason import ProbaReason, WrongPredictionReason
# Next we can add reasons for doubt. In this case we're saying
# that examples deserve another look if the associated proba values
# are low or if the model output doesn't match the associated label.
reasons = {
Prediction summary Date Confidence Came true? Prediction Squared Error Brier Score
Finish programming task X 10/31/20 .85 TRUE 0.0625 0.0625
Refactoring will facilitate product work 1/31/20 .75 FALSE 0.5625 0.3125
@kmdupr33
kmdupr33 / table-2.md
Created May 9, 2020 14:38
exp-util-ref-4
Tasks area
Implement rename project projects
Implement google login accounts
Implement archive project projects
@kmdupr33
kmdupr33 / table-1.md
Created May 9, 2020 14:37
exp-util-ref-3
Files Changes for
login.js accounts
project.js projects
@kmdupr33
kmdupr33 / tagged.js
Created May 9, 2020 14:37
exp-util-ref-2
/** changes-for: accounts */
function login() {
/* */
}
function isLoggedIn() {
/* */
}
@kmdupr33
kmdupr33 / bash.sh
Created May 9, 2020 14:35
exp-util-ref-1
#!/usr/bin/env bash
set -euo pipefail
file="$1"
last_sha="$(git rev-list HEAD | tail -n 1)"
function sum_numbers() {
perl -lane '$t+=$_ for @F; print $t'
}
fun updateGuess(
guess: Pair<Double, Double>,
learningRate: Double,
videoGameData: Array<Pair<Double, Double>>
): Pair<Double, Double> {
val (m, b) = guess
val mGradient = videoGameData.fold(0.0) { acc: Double, pair: Pair<Double, Double> ->
val (x, y) = pair
acc + ((((m * x) + b) - y) * x)
} / videoGameData.size
fun cost(videoGameData: Array<Pair<Double, Double>>, learningParameters: Pair<Double, Double>): Double =
videoGameData.fold(0.0) { acc: Double, pair: Pair<Double, Double> ->
val (m, b) = learningParameters
val (x, y) = pair
acc + ((((m * x) + b) - y).pow(2)/2)
} / videoGameData.size
fun findLearningParameters(videoGameData: Array<Pair<Double, Double>>): Pair<Double, Double> {
val learningRate = .0003
var guess = Pair(0.0, 0.0)
for (i in 1..10000000) {
guess = updateGuess(guess, learningRate, videoGameData)
if (i % 1000 == 0) println("Guess: $guess")
if (i % 1000 == 0) println("Cost: ${cost(videoGameData, guess)}")
}
return guess
}
fun predictVideoGameSales(
metaCriticScore: Int,
learningParameters: Pair<Double, Double>
) {
val (m, b) = learningParameters
return metaCriticScore * m + b
}