Part 1: calculate gradients

Backward

x=torch.tensor([3.0], requires_grad=True)
y = torch.pow(x, 2) # y=x**2
y.backward(retain_graph=True)
print(x.grad)
6

Grad

x=torch.tensor([3.0], requires_grad=True)
y = torch.pow(x, 2)
grad_1 = torch.autograd.grad(y, x, create_graph=True)
print(grad_1[0].item())

Part 2: Note

w = torch.tensor([1.], requires_grad=True)
x = torch.tensor([2.], requires_grad=True)…

Part 1: What is Metaflow?

Data is accessed from a data warehouse, which can be a folder of files, a database, or a multi-petabyte data lake.

Part 2: Notes

  1. Generate process map PNG file
python helloworld.py output-dot | dot -Tpng -o /tmp/graph.png

This command will put the processing chain in a PNG file

Part 1: Preliminary

  • True Positives (TP, blue distribution) are the people that truly have the COVID-19 virus.
  • True Negatives (TN, red distribution) are the people that truly DO NOT have the COVID-19 virus.
  • False Positives (FP) are the people that are truly NOT sick but based on the test, they were falsely (False)…

Part 1: Introduction to Dash

  • dash core components dcc.Graph
  • dash html components html.Div, html.H3
app.layout = html.Div(
children=[
html.Div(
className="data-class",
children=[
html.H3("head"),
dcc.Graph(id="my-id"),
],
),
]
)
  • html.Div is more like a wrapper, and it can contain other components like dcc.Graph etc.

Part 2: Notes

Part 1: Introduction

  • PyTorch example code

where you will find the following functions that define the hyper-parameters

  1. trial.suggest_int(“n_layers”, 1, 3)
  2. trial.suggest_categorical(“optimizer”, [“Adam”, “RMSprop”])
  3. trial.suggest_float(“lr”, 1e-5, 1e-1, log=True)
  • In Optuna there are three terminologies:
  1. objective: objective function that you want to optimize
  2. trial: a single call of the objective function
  3. study: an optimization session, which is a set of trials
  4. parameters: a variable whose value is to be optimized

Reference

Part 1: Concepts

  • Experiment
import mlflow

# Create an experiment name, which must be unique and case sensitive
experiment_id = mlflow.create_experiment("Social NLP Experiments")
experiment = mlflow.get_experiment(experiment_id)
print("Name: {}".format(experiment.name))
print("Experiment_id: {}".format(experiment.experiment_id))
print("Artifact Location: {}".format(experiment.artifact_location))
print("Tags: {}".format(experiment.tags))
print("Lifecycle_stage: {}".format(experiment.lifecycle_stage))
  • Runs
def print_auto_logged_info(r):
tags = {k: v for k, v in r.data.tags.items() if…

ifeelfree

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store