Tuesday, June 08, 2021

Why do we use np.random.seed()


This is a simple function but to my surprise lot of ML engineers had asked me about the actual usage of this function and why do I use it when i am working on an algorithm which will be shared with other engineers. 


The simple answer is :

the function generates a random deterministic number. It generated the same random number each time for a specified seed  

"It's a random function with deterministic output for a specified seed. This helps to share the code and get the same output each time. "


Try this :


np.random.seed(1)

np.random.randint(low = 1, high = 10, size = 20)


The output will be, each time till seed is specified as "1" 

array([6, 9, 6, 1, 1, 2, 8, 7, 3, 5, 6, 3, 5, 3, 5, 8, 8, 2, 8, 1])






Thursday, February 11, 2021

Installing Octave in Ubuntu running on Docker

I want to run Octave on Ubuntu running on docker.  Simple stuff but still manage to get errors and had to spend  few minutes on fine-tuning 

Here it goes

1- Start docket and get Ubuntu image from repo
    - Couple of commands
            - docker pull ubuntu
            - docker run -it ubuntu 


2- Install Octave 
    - ran command "apt-get install octave" and here it goes error "Unable to locate package Octave"
  




3- to come over this issue run below commands
    - apt-get update
    - apt-get install octave 


Done......

Why do we use np.random.seed()

This is a simple function but to my surprise lot of ML engineers had asked me about the actual usage of this function and why do I use it wh...