Tag: python

How to install python in windows and use pip in command prompt like mac and ubuntu

These are the steps that have to be followed in order to install python in windows and to be able to install pip commands directly into your command prompt just like mac and ubuntu.

STEP 1

  • check your system settings and find out your system is 32 bit or 64 bit.
  • Accordingly, go to anaconda and download the Individual edition Python 3 (32 or 64bit )(which is open source and completely free).
  • Install the anaconda package just like normal software.
  • During installation, you will get an option under “advanced options” Add Anaconda to my PATH variable” make sure it is checked.

STEP 2

  • After installation, you’ll find anaconda prompt in your all programs
  • open it, and go to the directory where you will host/save your project/program using command “cd
  • In case you have to create a folder for your project you can make a new directory with command “mkdir foldername”
  • after getting into the directory use this command “conda create –name mydevelopment python==3.7.6”
  • press enter and say yes if it asks your permission.
  • after this, you’ll get commands to activate & deactivate (copy/write those commands in a notepad)
  • now type “conda activate mydevelopment”
  • you’ll see (mydevelopment) in your shell.
  • now you can easily use pip install and ls command in your system.

Step 3

  • you are done
  • you can access the jupyter notebook, spyder  from the anaconda navigator from all programs list
  • additional info to activate the environment if you need to install packages just like you do in Mac and Linux(ubuntu)
  • simply go to the same directory and type“conda activate mydevelopment”
  • to deactivate simply type “conda deactivate”

 

7 Steps of Machine Learning

The 7 steps of any Machine Learning problem to answering questions

  1. Gathering Data
  2. Preparing the Data
  3. Choosing a Model
  4. Training
  5. Evaluation
  6. Hyperparameter Tuning
  7. Prediction

 

Data Gathering

We will first gather data, in order to train our model we need data for example if we are predicting whether a drink is wine or beer, so we need features like colour and alcohol percentage.

Data Preparation

We will randomise data, we can do Exploratory Data Analysis  that is to check biased that if we might have collected the beer data only that might result in beer biased data.

Data might need duplication, normalisation, error correction

Also to train the model we need to split the data in train & test, the test data will be used for model evaluation.

Choosing a Model

We have lots of models created by researches over the years like some models works good with Image data, some are good at text based data. So we’ll try to choose a model according to our requirement.

Training

Just like when someone is trying to drive a car, first the driver learns how to use brakes &  accelerator & over the time the drivers efficiency improves, the more he trains himself the more efficiency improves.

Y = mX+b

M-slope

B – y’s intercept

X – Input

Y – Output

So the values we can adjust are M & B only, there are lots of M in a model due to many features, so collection of M will be formed in to a matrix and denoted as W weight matrix and similarly for B we arrange the values into a matrix and it will be denoted as B Biases.

So in training we first initialise some random values to the model and try to predict the output with these values, So first the model performs vary poorly but after that we can compare it with the outputs that it should have produced and adjust the values in W & B then we will have more accurate predictions on the next time, each iteration (process of updating W & B) is called one training Step.

Evaluation

In evaluation we test our model against the data which is never been used for training, this metric will allow us to see how model might perform against the data model has not seen yet. That how the model will perform in the real world

A good rule of thumb is to split the data in Training & Evaluation is 80%-20% or 70%-30%.

Parameter Tuning

Predictions