Sunday, September 11, 2022

Docker copying from to host

 sudo docker cp container-id:/path/filename.txt ~/Desktop/filename.txt

Obtain the name or id of the Docker container

Issue the docker cp command and reference the container name or id

The first parameter of the docker copy command is the path to the file inside the container

The second parameter of the docker copy command is the location to save the file on the host

Edit and use the file copied from inside the container to your host machine

references:

https://www.theserverside.com/blog/Coffee-Talk-Java-News-Stories-and-Opinions/How-to-copy-files-from-a-Docker-container-to-a-host-machine

Wednesday, August 31, 2022

What is State in RNN

The “state” of the RNN is reset when processing two different and independent sequences. Recurrent neural networks are a special type of neural network where the outputs from previous time steps are fed as input to the current time step. Basic Recurrent neural network with three input nodes


references:


Sunday, August 28, 2022

Deep Learning - Learning Rate Intro

 The weights of a neural network cannot be calculated using an analytical method. Instead, the weights must be discovered via an empirical optimization procedure called stochastic gradient descent.


The optimization problem addressed by stochastic gradient descent for neural networks is challenging and the space of solutions (sets of weights) may be comprised of many good solutions (called global optima) as well as easy to find, but low in skill solutions (called local optima).


The amount of change to the model during each step of this search process, or the step size, is called the “learning rate” and provides perhaps the most important hyperparameter to tune for your neural network in order to achieve good performance on your problem.


Learning rate controls how quickly or slowly a neural network model learns a problem.

How to configure the learning rate with sensible defaults, diagnose behavior, and develop a sensitivity analysis.

How to further improve performance with learning rate schedules, momentum, and adaptive learning rates.


references:

https://machinelearningmastery.com/learning-rate-for-deep-learning-neural-networks/

What is AUC in Machine learning

AUC provides an aggregate measure of performance across all possible classification thresholds. One way of interpreting AUC is as the probability that the model ranks a random positive example more highly than a random negative example. For example, given the following examples, which are arranged from left to right in ascending order of logistic regression predictions: 

AUC represents the probability that a random positive (green) example is positioned to the right of a random negative (red) example.

AUC ranges in value from 0 to 1. A model whose predictions are 100% wrong has an AUC of 0.0; one whose predictions are 100% correct has an AUC of 1.0.

Positive and negative examples ranked in ascending order of logistic regression score

references:

https://developers.google.com/machine-learning/crash-course/classification/roc-and-auc#:~:text=AUC%20represents%20the%20probability%20that,has%20an%20AUC%20of%201.0.

Wednesday, August 17, 2022

React Widget - Compiling all react files to single file

 https://github.com/facebook/create-react-app/issues/3365


React Widget - Creating React app and embed into single HTML

Great resource this one is

references:

 https://www.labnol.org/code/bundle-react-app-single-file-200514

Tuesday, August 9, 2022

Gradient Descent Explained Simply with Examples

 Introduction to Gradient Descent Algorithm

Gradient descent algorithm is an optimization algorithm which is used to minimise the function. The function which is set to be minimised is called as an objective function. For machine learning, the objective function is also termed as the cost function or loss function. It is the loss function which is optimized (minimised) and gradient descent is used to find the most optimal value of parameters / weights which minimises the loss function. Loss function, simply speaking, is the measure of the squared difference between actual values and predictions. In order to minimise the objective function, the most optimal value of the parameters of the function from large or infinite parameter space are found.

What is Gradient Descent?

Gradient of a function at any point is the direction of steepest increase or ascent of the function at that point.

the gradient descent of a function at any point, thus, represent the direction of steepest decrease or descent of function at that point.

How to calculate Gradient Descent?

In order to find the gradient of the function with respect to x dimension, take the derivative of the function with respect to x , then substitute the x-coordinate of the point of interest in for the x values in the derivative. Once gradient of the function at any point is calculated, the gradient descent can be calculated by multiplying the gradient with -1. 

Here are the steps of finding minimum of the function using gradient descent:

Calculate the gradient by taking the derivative of the function with respect to the specific parameter. In case, there are multiple parameters, take the partial derivatives with respect to different parameters.

Calculate the descent value for different parameters by multiplying the value of derivatives with learning or descent rate (step size) and -1.

Update the value of parameter by adding up the existing value of parameter and the descent value. The diagram below represents the updation of parameter 𝜃 with the value of gradient in the opposite direction while taking small steps.

Update the parameter value with gradient descent value

In case of multiple parameters, the value of different parameters would need to be updated as given below if the cost function is 12𝑁∑(𝑦𝑖–(𝜃0+𝜃1𝑥)2) if the regression function is 𝑦=𝜃0+𝜃1𝑥

The parameters will need to be updated until function minimises or converges. The diagram below represents the same aspect.


references:

https://vitalflux.com/gradient-descent-explained-simply-with-examples/