Skip to content

Instantly share code, notes, and snippets.

View wphicks's full-sized avatar

William Hicks wphicks

  • NVIDIA
  • Gainesville, FL
View GitHub Profile
@wphicks
wphicks / odt_word_count.py
Created July 10, 2017 20:06
A basic command line tool for determining word count of Open Document Text (.odt and .fodt) files
#!/usr/bin/env python3
import os
import sys
import argparse
import zipfile
import shutil
import tempfile
import xml.etree.ElementTree as ET
@wphicks
wphicks / notes.bash
Created May 14, 2018 11:42
Convenient note-taking functions with fzf
function ff() {
if [ -z $1 ]
then
search_dir="."
else
search_dir="$1"
fi
ag --nobreak --noheading . $search_dir | \
fzf --preview='cat "$(echo {} | cut -d: -f1)"' --preview-window=right
}
def benchmark_pandas():
import timerit
import pandas as pd
import numpy as np
column_data = {
key: np.random.rand(1000)
for key in map(chr, range(ord('a'), ord('z')))
}
data_frame = pd.DataFrame(column_data)
@wphicks
wphicks / Preprocessing.ipynb
Created November 18, 2020 19:41
Demo of Preprocessing with cuML
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wphicks
wphicks / rf-fil.py
Last active January 19, 2021 16:48
Benchmarking script for cuML RF->FIL conversion
from time import perf_counter
from cuml import using_output_type
from cuml.datasets import make_classification
from cuml.ensemble import RandomForestClassifier
from cuml.metrics import accuracy_score
with using_output_type('cupy'):
data, labels = make_classification(
n_samples=int(1e5),
@wphicks
wphicks / percentile_benchmark.py
Created February 9, 2021 19:01
Quick benchmark for cupy.percentile
import cupy
from cupyx.time import repeat
cupy.random.seed(0)
for size in (5, 50, 500, 5000, 50000, int(5e6)):
a = cupy.random.rand(size)
q = cupy.linspace(0, 100, 3)
def f():
@wphicks
wphicks / full_run.txt
Last active March 8, 2021 15:47
cuML Python tests compute sanitizer output
This file has been truncated, but you can view the full file.
compute-sanitizer pytest python/cuml/test
========= COMPUTE-SANITIZER
============================= test session starts ==============================
platform linux -- Python 3.8.6, pytest-6.2.2, py-1.10.0, pluggy-0.13.1
rapids_pytest_benchmark: 0.0.13
benchmark: 3.2.3 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /home/whicks/proj_cuml/cuml/python, configfile: pytest.ini
plugins: hypothesis-6.1.1, cov-2.11.1, rapids-pytest-benchmark-0.0.13, benchmark-3.2.3, timeout-1.4.2, repeat-0.8.0, forked-1.3.0, asyncio-0.12.0, xdist-2.2.0
collected 27716 items
@wphicks
wphicks / model.txt
Created December 3, 2021 19:38
Reproducer for FIL/LightGBM mismatch
This file has been truncated, but you can view the full file.
tree
version=v3
num_class=1
num_tree_per_iteration=1
label_index=0
max_feature_idx=31
objective=binary sigmoid:1
feature_names=0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
feature_infos=[-6.5546088218688965:6.2278804779052734] -1:1:0 [-4.965395450592041:6.5972399711608887] [-4.6478652954101562:6.5585684776306152] [-8.2879343032836914:7.7419576644897461] [-6.8546819686889648:7.0196652412414551] [-8.7973241806030273:5.5609464645385742] [-6.5725240707397461:7.2596492767333984] -1:0:1 [-6.8401269912719727:6.9245181083679199] [-11.817563056945801:12.412569046020508] [-14.371319770812988:12.11441707611084] [-2.6720693111419678:3.1814792156219482] [-3.1954507827758789:3.3344674110412598] [-3.2284896373748779:3.2031958103179932] [-4.0048222541809082:3.3795340061187744] [-3.2715401649475098:2.9391093254089355] [-3.5124735832214355:2.8368351459503174] [-2.8929731845855713:3.4158065319061279] [-3.7133853435516357:3.583622932434082] [-2.697335958480835:3.3189976215362549] [-2.9512
@wphicks
wphicks / Fraud_Detection_Example.ipynb
Last active January 28, 2023 12:44
Notebook example for fraud detection with the Triton FIL Backend
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wphicks
wphicks / treelite-issue470.py
Created April 10, 2023 16:36
Comparison of perf for various forest inference implementations
import cupy as cp
import os
import numpy as np
import treelite
import treelite_runtime
import xgboost as xgb
from time import perf_counter
from cuml.common.device_selection import using_device_type
from cuml.experimental import ForestInference