Related Setup: https://gist.github.com/hofmannsven/6814278
Related Pro Tips: https://ochronus.com/git-tips-from-the-trenches/
def softmax(x): | |
"""Calculates the softmax for each row of the input x. | |
Your code should work for a row vector and also for matrices of shape (n, m). | |
Argument: | |
x -- A numpy matrix of shape (n,m) | |
Returns: | |
s -- A numpy matrix equal to the softmax of x, of shape (n,m) |
def normalizeRows(x): | |
""" | |
Implement a function that normalizes each row of the matrix x (to have unit length). | |
Argument: | |
x -- A numpy matrix of shape (n, m) | |
Returns: | |
x -- The normalized (by row) numpy matrix. You are allowed to modify x. | |
""" |
def image2vector(image): | |
""" | |
Argument: | |
image -- a numpy array of shape (length, height, depth) | |
Returns: | |
v -- a vector of shape (length*height*depth, 1) | |
""" | |
v = image.reshape((image.shape[0] * image.shape[1] * image.shape[2], 1)) |
def sigmoid_derivative(x): | |
""" | |
Compute the gradient (also called the slope or derivative) of the sigmoid function with respect to its input x. | |
You can store the output of the sigmoid function into variables and then use it to calculate the gradient. | |
Arguments: | |
x -- A scalar or numpy array | |
Return: | |
ds -- Your computed gradient. |
def sigmoid(x): | |
""" | |
Compute the sigmoid of x | |
Arguments: | |
x -- A scalar or numpy array of any size | |
Return: | |
s -- sigmoid(x) | |
""" |
Related Setup: https://gist.github.com/hofmannsven/6814278
Related Pro Tips: https://ochronus.com/git-tips-from-the-trenches/
title | output |
---|---|
R Notebook |
html_notebook |
title | output |
---|---|
R Notebook |
html_notebook |
library(data.table)
fread("A,B
1,2
title | output |
---|---|
R Notebook |
html_notebook |
write.table(read.table(text = "
CHR_A BP_A SNP_A CHR_B BP_B SNP_B R2
1 154834183 rs1218582 1 154794318 rs9970364 0.0929391
# One chunk - Linear Regression in R | |
Source: https://medium.com/dsnet/linear-regression-with-pytorch-3dde91d60b50 | |
```{r} | |
# Force using local Python environment | |
if (.Platform$OS.type == "unix") { | |
reticulate::use_python(python = file.path(script_path, "..", "conda", "bin", | |
"python3"), require = TRUE) | |
} else if (.Platform$OS.type == "windows") { |