ReLU activation on a two-neuron network

Starting with a weight = 0 and bias = 0 on a single neuron:

Setting weight = 1.0 while keeping bias to 0:

Setting bias to 0.5:

To flip the line horizontally, negate the weight from 1.0 to -1.0:

Bias applied on a neuron, an input, and a ReLU activation function

Now let’s introduce the second neuron with values weight = 1.0 and bias = 1.0:

This caused a vertical shift of the activation function. Note that the bias moves the line vertically.

Let’s negate the second neuron’s weight by 2 (i.e. -2.0):

And now to compute the output:

Forward pass on a dense layer neural network

A dense layer is a fully-connected neural network layer.

Generating a random 2x4 matrix in NumPy

The 0.01 value is for making the randomly generated values a magnitude smaller (akin to a volume knob that controls the volume of a sound).

Neural network with two hidden layers

Hidden layer 1 (with code)

A neural network with one hidden layer

This neural network has 4 features in the input layer and 3 neurons in the hidden layer. Each of the three neurons is composed of 4 different weights (coming from the 4 inputs) and has shape of (3, 4).

Matrix transposition visualization

Given a pair of variables inputs (3x4 matrix) and weights (3x4 matrix). The matrix on the right side (i.e. weight) must be transposed first.

Only can then we perform a matrix dot multiplication.

Row and column vectors in NumPy

Matrix transposition visualization

Transposition modifies a matrix in such a way that rows become columns and columns become rows.

matrix transposition

Visualizing matrix multiplication

Replacing the front caster from a wheel to a ball made from a roll-on deodorant applicator.

#arduino, #electronics, #sensors

Update: Light seeking robot project

Making the wirings pretty.

#arduino, #electronics, #sensors

Installing headless JupyterLab on a remote Linux server

Prerequisite:

  • python3-pip package
  • python3-dev package

Installation

You only do this per new project:

Do this everytime you launch the JupyterLab server remotely:

You’ll immediately see something like this, copy the URL with the token:

And then in your local browser:

Using a Python 3 virtual environment for Python projects

$ mkdir proj_foo && cd proj_foo
or
$ take proj_foo

$ python3 -m venv  env_foo
$ source env_foo/bin/activate
(env_foo) proj_foo $

When ssh connection drops out after a few minutes of inactivity

This is the error message it displays:

… send disconnect: Broken pipe

Solution:

In /etc/ssh/sshd_config, make sure these two lines are uncommented:

ClientAliveInterval 30
ClientAliveCountMax 5

Prototyping the battery holder bracket.

#arduino, #electronics, #sensors

Light following robot project

It’s finally done–testing and all. Now, to make it a little less messy.

#arduino, #electronics, #sensors