Skip to content

Instantly share code, notes, and snippets.

View JoshBroomberg's full-sized avatar

Josh Broomberg JoshBroomberg

View GitHub Profile
# Start an MLflow experiment run
with mlflow.start_run():
lr = ElasticNet(alpha=alpha, l1_ratio=l1_ratio, random_state=42)
lr.fit(train_x, train_y)
predicted_qualities = lr.predict(test_x)
rmse = np.sqrt(mean_squared_error(actual, pred))
mae = mean_absolute_error(actual, pred)
import mlflow
import os
REMOTE_SERVER_URI = "http://mlflow:5555"
S3_ENDPOINT_URL = "http://minio:9000"
# set the tracking server hostname/port
mlflow.set_tracking_uri(REMOTE_SERVER_URI)
# set the artifact backend to be the local minio backend
if [ "$SPARK_MODE" == "worker" ]; then
DRIVER_HOST="$(hostname | sed -E 's/spark-([a-z0-9]+)-(worker|master)-[0-9]+/spark-driver-\1.domino-compute.svc.cluster.local/g')"
echo "Starting ray worker targeting head at \"${DRIVER_HOST}\" after head startup delay"
for i in {1..10}; do ray start --address=${DRIVER_HOST}:6379 --redis-password=pass --num-gpus=1 && break || sleep 60; done
else
echo "taking no action on master"
# DRIVER_HOST="$(hostname | sed -E 's/spark-([a-z0-9]+)-(worker|master)-[0-9]+/spark-driver-\1.domino-compute.svc.cluster.local/g')"
# PROXY_PATH="$(hostname | sed -E 's/spark-([a-z0-9]+)-(worker|master)-[0-9]+/kevin_flansburg\/Ray\/workspaces\/\1\/spark\/ui/g')"
# echo "Starting ray ui proxying \"/${PROXY_PATH}\" to head at \"${DRIVER_HOST}\""
# touch /usr/sbin/proxy.txt
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@JoshBroomberg
JoshBroomberg / ixmessages.sol
Last active June 20, 2018 12:08
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.24+commit.e67f0147.js&optimize=false&gist=
pragma solidity ^0.4.16;
contract Ownable {
address public owner;
constructor () public {
owner = msg.sender;
}
modifier onlyOwner(){
res <- rq(lalonde$re78 ~ X_all, tau=seq(0.2, 0.8, by=0.1))
sm <- summary(res)
plot(sm)
compressed_image_data_train = pca.transform(image_data_train)
uncompressed_image_data_train = pca.inverse_transform(compressed_image_data_train)
fig=plt.figure(figsize=(12, 20))
columns = 4
rows = 8
for i in range(1, 33, 4):
component_id = int(i/4)
eigen_image = image_from_component_values(pca.components_[component_id])
inverted_egein_image = PIL.ImageOps.invert(eigen_image)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
######################
# Speech recognition #
######################
# 1. Work through the following resources:
# Viterbi algorithm. (n.d.). In Wikipedia. Retrieved November 9, 2016, from
# https://en.wikipedia.org/wiki/Viterbi_algorithm
# The 44 Phonemes in English. (n.d.). Retrieved November 9, 2016, from
# http://www.dyslexia-reading-well.com/44-phonemes-in-english.html
@celery.task
def async_training_task(data_file_name, k_iterations):
train_model(file=data_file_name, iterations=k_iterations)
# This is the standard flask handler.
# Maybe you get some params from the request/
def get(self, request):
async_training_task.delay(data_file_name=request.file_name, iterations=10)
return Response("Training has been started!")