Skip to content

Instantly share code, notes, and snippets.

View cjnolet's full-sized avatar

Corey J. Nolet cjnolet

View GitHub Profile
@cjnolet
cjnolet / vi.py
Created April 18, 2018 02:07 — forked from jwcarr/vi.py
Variation of information (VI)
# Variation of information (VI)
#
# Meila, M. (2007). Comparing clusterings-an information
# based distance. Journal of Multivariate Analysis, 98,
# 873-895. doi:10.1016/j.jmva.2006.11.013
#
# https://en.wikipedia.org/wiki/Variation_of_information
from math import log
@cjnolet
cjnolet / spark-svd.scala
Created August 8, 2018 20:44 — forked from vrilleup/spark-svd.scala
Spark/mllib SVD example
import org.apache.spark.mllib.linalg.distributed.RowMatrix
import org.apache.spark.mllib.linalg._
import org.apache.spark.{SparkConf, SparkContext}
// To use the latest sparse SVD implementation, please build your spark-assembly after this
// change: https://github.com/apache/spark/pull/1378
// Input tsv with 3 fields: rowIndex(Long), columnIndex(Long), weight(Double), indices start with 0
// Assume the number of rows is larger than the number of columns, and the number of columns is
// smaller than Int.MaxValue
@cjnolet
cjnolet / fourex.py
Created September 19, 2018 18:46 — forked from tartakynov/fourex.py
Fourier Extrapolation in Python
import numpy as np
import pylab as pl
from numpy import fft
def fourierExtrapolation(x, n_predict):
n = x.size
n_harm = 10 # number of harmonics in model
t = np.arange(0, n)
p = np.polyfit(t, x, 1) # find linear trend in x
x_notrend = x - p[0] * t # detrended x
@cjnolet
cjnolet / gcc-5.4.0-install.sh
Created December 14, 2018 18:51 — forked from jdhao/gcc-5.4.0-install.sh
The script will install GCC 5.4.0 on your CentOS 7 system, make sure you have root right. See https://jdhao.github.io/2017/09/04/install-gcc-newer-version-on-centos/ for more details.
echo "Downloading gcc source files..."
curl https://ftp.gnu.org/gnu/gcc/gcc-5.4.0/gcc-5.4.0.tar.bz2 -O
echo "extracting files..."
tar xvfj gcc-5.4.0.tar.bz2
echo "Installing dependencies..."
yum install gmp-devel mpfr-devel libmpc-devel -y
echo "Configure and install..."
@cjnolet
cjnolet / webex-fedora-centos.md
Created July 27, 2019 22:50
Run Cisco Webex on 64-bit Fedora 28

Run Cisco Webex on 64-bit Fedora 28/CentOS 7

With Audio and Screen Sharing Enabled

IMPORTANT NOTE :

1. The Screen Sharing works when you use Xorg instead of Wayland.
2. In my test, I disabled SELinux but maybe it works even if SElinux is permissive.
3. This was tested and worked on the DELL VOSTRO 3560 but does not work on DELL PRECISION 7510

Basic Usage

Example of training an HDBSCAN model using the hdbscan Python package in Scikit-learn contrib:

from sklearn import datasets
from hdbscan import HDBSCAN

X = datasets.make_moons(n_samples=50, noise=0.05)

model = HDBSCAN(min_samples=5)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cjnolet
cjnolet / hdbscan_blog_np.ipynb
Last active October 11, 2021 19:18
Notebook to accompany RAPIDS cuML HDBSCAN Blog
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cjnolet
cjnolet / cuml-kmeans-mnmg-api.md
Last active August 17, 2022 05:35
Simple example of cuML's K-Means Single-GPU (SG) and Multi-Node Multi-GPU (MNMG) APIs compared to Scikit-learn and Dask-ML

Comparing cuML K-Means API Against Scikit-learn & Dask-ML

First, a quick code example of K-Means in Scikit-learn

from sklearn.datasets import make_blobs
from sklearn.cluster import KMeans

n_centers = 5

X, _ = make_blobs(n_samples=10000, n_centers=n_centers)