Skip to content

Instantly share code, notes, and snippets.

View smacpher's full-sized avatar
🌴

Sean MacPherson smacpher

🌴
  • SF, Bay Area
View GitHub Profile
@smacpher
smacpher / hpo_client_library.py
Created August 15, 2022 22:45
HPO Client Library – Blog Post
import myst
myst.authenticate()
# Use an existing project.
project = myst.Project.get(uuid="<uuid>")
# Use an existing model within the project.
model = myst.Model.get(project=..., uuid="<uuid>")
@smacpher
smacpher / hpo.py
Last active August 18, 2022 18:55
HPO in Ray – Blog Post
@ray.remote
def run_backtest_fold(parameters: Dict[str, Any], inputs: Inputs, max_cpus) -> Dict[str, Any]:
model_connector.fit(inputs, max_cpus=max_cpus)
predictions = model_connector.predict(inputs)
fold_metrics = compute_metrics(predictions=predictions, actuals=inputs.actuals)
return fold_metrics
def run_backtest(parameters: Dict[str, Any], inputs_ref: ray.ObjectRef, max_cpus_per_fold) -> None:
fold_metrics_refs = [run_backtest_fold.options(num_cpus=max_cpus_per_fold).remote(parameters, inputs_ref, max_cpus_per_fold) for fold in backtest.folds]
fold_metrics: List[Dict[str, Any]] = []

Screen Quick Reference

Basic

Description Command
Start a new session with session name screen -S <session_name>
List running sessions / screens screen -ls
Attach to a running session screen -x
Attach to a running session with name screen -r
@smacpher
smacpher / git_workshop.md
Last active November 5, 2017 23:09
Notes for the Git / Github workshop | 5C Hackweek 2017

Git / Github Workshop

November 6th, 2017

What is Git?

  • Git is a version control system. It is a command line tool that you can use to keep track of changes in your code.
  • Think of it as a tool that protects your code; it makes it so you can modify, improve, and fix your code since it gives you the power to save your code at different points, return to those points are create different branches off of those points to experiment with.
  • Git saves a running history of all of the changes that you have ever made in your code.
@smacpher
smacpher / naive_bayes.md
Last active October 15, 2017 19:52
Notes on the Naive Bayes ML Algorithm

The Naive Bayes Algorithm

  • Classification technique based on Bayes' Theorem.
  • Assumes independence among predictors.
  • A Naive Bayes classifier assumes presence of a particular feature in a class is unrelated to the presence of any other feature.

The Bayes Theorem

Provides a way of calculating the probability of an event based on prior knowledge of conditions that might be related to the event.