Skip to content

Instantly share code, notes, and snippets.

View lacava's full-sized avatar

William La Cava lacava

View GitHub Profile
@lacava
lacava / timeout_handling.ipynb
Created April 11, 2022 16:27
Example of timeout handling for the SRBench Competition (https://cavalab.org/srbench/competition-2022/)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lacava
lacava / list_notebooks.py
Created March 11, 2022 03:28
list notebooks on a remote machine
"""
William La Cava 2020
license: GPL v3
this script connects to a server via ssh, looks for running
jupyter notebooks, and lists them.
note: for this to work, ssh needs to find the jupyter command on your
remote machine. if you have jupyter in /home/you/anaconda3/bin/,
for example, you can symlink it to /usr/local/bin to achive this:
ln -s /home/you/anaconda3/bin/jupyter /usr/local/bin/
@lacava
lacava / p_values_for_logreg.py
Created March 6, 2019 15:06 — forked from rspeare/p_values_for_logreg.py
P values for sklearn logistic regression
from sklearn import linear_model
import numpy as np
import scipy.stats as stat
class LogisticReg:
"""
Wrapper Class for Logistic Regression which has the usual sklearn instance
in an attribute self.model, and pvalues, z scores and estimated
errors for each coefficient in
@lacava
lacava / x_means.py
Created March 9, 2018 21:07 — forked from yasaichi/x_means.py
Implementation of X-means clustering in Python
"""
以下の論文で提案された改良x-means法の実装
クラスター数を自動決定するk-meansアルゴリズムの拡張について
http://www.rd.dnc.ac.jp/~tunenori/doc/xmeans_euc.pdf
"""
import numpy as np
from scipy import stats
from sklearn.cluster import KMeans
@lacava
lacava / simple_mlp_tensorflow.py
Created September 15, 2017 15:14 — forked from vinhkhuc/simple_mlp_tensorflow.py
Simple Feedforward Neural Network using TensorFlow
# Implementation of a simple MLP network with one hidden layer. Tested on the iris data set.
# Requires: numpy, sklearn>=0.18.1, tensorflow>=1.0
# NOTE: In order to make the code simple, we rewrite x * W_1 + b_1 = x' * W_1'
# where x' = [x | 1] and W_1' is the matrix W_1 appended with a new row with elements b_1's.
# Similarly, for h * W_2 + b_2
import tensorflow as tf
import numpy as np
from sklearn import datasets
from sklearn.model_selection import train_test_split