Skip to content

Instantly share code, notes, and snippets.

import faker as f
import numpy as np
from numpy.random import default_rng
from pandas import DataFrame
from scipy.stats import truncnorm
from sklearn.metrics import average_precision_score
fake_bad_actor_generator = f.Faker()
rng = default_rng()
@Brideau
Brideau / precision_at_k.py
Created December 12, 2021 23:49
An implementation of Precision@k compatible with Scikit-learn.
def precision_at_k(y_true, y_score, k, pos_label=1):
from sklearn.utils import column_or_1d
from sklearn.utils.multiclass import type_of_target
y_true_type = type_of_target(y_true)
if not (y_true_type == "binary"):
raise ValueError("y_true must be a binary column.")
# Makes this compatible with various array types
y_true_arr = column_or_1d(y_true)
@Brideau
Brideau / poolMetadata.json
Created March 21, 2021 17:52
Cardano Node Test Metadata
{
"name": "Testing a Pool",
"description": "The pool that tests all the pools",
"ticker": "TEST",
"homepage": "https://teststakepool.com"
}
@Brideau
Brideau / additionalparameter.scala
Last active November 25, 2017 20:27
Using ogr2ogr from Scala
// If you need to add additional parameters, as is the case if creating a
// CSV file, you can use the -lco flag multiple times
val outPathCsv = Paths.get("temp", "Canada3573Csv", "Canada3573.csv").toAbsolutePath
val cmdCsv = Array("-f", "CSV", outPathCsv.toString, inPath.toString,
"-lco", "GEOMETRY=AS_WKT",
"-lco", "CREATE_CSVT=YES",
"-lco", "SEPARATOR=SEMICOLON"
)
convertUsingOgr2Ogr(outPathCsv, cmdCsv).onComplete{
@Brideau
Brideau / DYLD_LIBRARY_PATH
Last active April 27, 2020 14:03
Install GDAL with Java bindings on macOS High Sierra
export DYLD_LIBRARY_PATH=/usr/local/opt/gdal2/lib:$DYLD_LIBRARY_PATH

Keybase proof

I hereby claim:

  • I am Brideau on github.
  • I am brideau (https://keybase.io/brideau) on keybase.
  • I have a public key whose fingerprint is 3912 9FB2 7C3A 0110 302F 91E4 F19F A065 AC03 9521

To claim this, I am signing this object:

@Brideau
Brideau / README.md
Last active February 28, 2016 02:22
D3Kit Test

A tweak of the D3Kit Circles example to fix some transition bugs it had, and to add, well, a ton of circles.

@Brideau
Brideau / Hex1000Topo.json
Last active December 19, 2015 23:33
Zoomable Hex-Lists
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Brideau
Brideau / README.md
Last active December 15, 2015 17:26
Hexagon Word List

An automatically sorting list of words that fit into a hexagon. Words are currently gibberish.

@Brideau
Brideau / Hex1000.geojson
Last active December 11, 2015 14:08
Mapbox Zoomable Hexagons
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.