Skip to content

Instantly share code, notes, and snippets.

@anirudhacharya
anirudhacharya / aesara config.md
Created October 17, 2022 12:37
aesara config
$ python -c "import aesara; print(aesara.config)"
WARNING (aesara.tensor.blas): Using NumPy C-API based implementation for BLAS functions.
floatX ({'float64', 'float16', 'float32'})
    Doc:  Default floating-point precision for python casts.

Note: float16 support is experimental, use at your own risk.
    Value:  float64

warn_float64 ({'raise', 'ignore', 'warn', 'pdb'})

Knuth's Algorithm R for Reservoir Sampling.

Problem Statement:

We wish to sample k elements out of a continuous stream of data, where we can process each data item only once. We cannot cache the streaming data, nor can we go back to look at previous data.

Solution -

1. Define a reservoir R of size k elements.
2. Keep adding items to this reservoir from the streaming data source until the reservoir is full.
3. For the i th element, x_i, of the input data where i >= k,

Can we leverage the framework specific profilers, and maybe build a layer on top of it augment its features and functionalities.

This is what mxnet profiler dump looks like

Profile Statistics.
	Note that counter items are counter values and not time units.
Device Storage
=================
Name                          Total Count        Time (ms)    Min Time (ms)    Max Time (ms)    Avg Time (ms)

On the server

  • Install jupyter and ipython - sudo pip install jupyter and sudo pip install ipython

  • make server password - jupyter notebook password

  • make ssl directory - mkdir ssl

  • Inside the directory, create private and public keys with openssl - openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mykey.key -out mycert.pem

ps-lite is a communication framework for parameter servers.

Conceptual overview

3 main entities - Scheduler( always 1 in number), Server, Workers.

Scheduler - Node which manages the cluster. Maintains a list of nodes and their addresses in the cluster. Scheduler handshakes with all the nodes in the cluster. Assigns rank to every node in the cluster.

Because scaling (or normalizing) inputs makes gradient descent converge faster. Let’s see why this is the case via a simple linear regression example.

Take this toy dataset for instance:

A line that fits this data well will have two parameters: 𝑤0 (bias) and 𝑤1 (slope)

𝑦=𝑤0+𝑤1𝑥

Now lets plot the contours of the Least Squares cost function associated with this dataset (in 2D), with darker blue regions corresponding to larger points on the cost surface, and conversely lighter regions indicating lower points on the cost function.

mxnet data IO im2rec tutorial

this tutorial will show how to use im2rec for mx.image.ImageIter and ImageDetIter and how to use im2rec for COCO DataSet

im2rec

step 1. you should make a .lst file <>

use .lst for imageIter

@anirudhacharya
anirudhacharya / mxnet-R autoencoder.R
Created December 12, 2018 01:20
mxnet-R autoencoder
library ( mxnet )
mx.set.seed ( 0 )
rawdata <- read.csv("train.csv", header = T)
rawdata <- as.matrix(rawdata)
train.index <- sample(x = 1:nrow(rawdata), size = 30000)
train <- rawdata[train.index, ]
test <- rawdata[-train.index, ]
{
"files": [
{
"name": "R/rnn.graph.R",
"coverage": [
null,
null,
null,
null,
null,
$ R CMD check .
* using log directory ‘/home/ubuntu/incubator-mxnet/R-package/..Rcheck’
* using R version 3.4.4 (2018-03-15)
* using platform: x86_64-pc-linux-gnu (64-bit)
* using session charset: UTF-8
* checking for file ‘./DESCRIPTION’ ... OK
* checking extension type ... Package
* this is package ‘mxnet’ version ‘1.3.0’
* checking package namespace information ... OK
* checking package dependencies ... OK