Machine Learning

Tensor – Data structure in ML

Tensor – a way to store numbers in container

Points about Tensor:

  1. 0-D Tensor is scalar
  2. 1-D Tensor is vector in ML or 1-D array in programming
    • N-D tensor is collection of (N-1)D array/Tensor
    • Statement – “Vector is 1-D tensor but has its own dimension”
      • Example arr = [1,2,3] – its tensor dimension is 1 & vector dimension is 3 (since x,yz)
  3. 2-D Tensor / matrix
    • R X C is a matrix or 2-D tensor
  4. 3-D tensor/matrix
    • In addition of R and C, it has Depth (collection of 2-D matrix/2D tensor)
  5. Note: In ML 0 to 5D are ones comes in pictturs
  6. No. Of dimension Tensor = no. of axis = Rank
  7. Size of tensor = no of item = R X C
  8. Example of Tensor data
    1. 3D Tensor
      • Time Series data
    2. 4D tensor
      • Image
    3. 5-D tensor
      • Video
        • Domain knowledge – mp4, mpeg, mkv are the video encoder which makes raw format, large size video into small size video

Tools and Lib for ML

  1. Anaconda- Contains packages for ML
  2. Jupyter Notebook
  3. Virtual env
    • Using conda you can create venv
  4. Kaggle
    • Pros
      • Also has online version of Jupyternotebook
      • Has kaggle data
  5. Google collab
    • Pros-
      • Also has online version of Jupyternotebook
        • It has GPU power Too – used for Deep learning
          • Runtime – > Change runtime – > select GPU
          • There is option to import kaggle data into collab – it needs few configs – like api key setup – which helps in download directly zip to collab which can be extracted with code and used

Image – Anaconda with base(root) having all libraries for data science & virtual env only required lib. so size remains manageable while deploying

E2E flow

Steps involved :

  1. Preprocessing , EDA , Feature selection
    • panda lib useful
  2. Extract input and output cols
    • panda lib useful
  3. scale the values
  4. Train & test data split
    • sklearn lib useful
  5. model training
    • sklearn lib useful
  6. Model evaluation & selection
    • sklearn lib useful
  7. deploy
    • can be deployed on any cloud platform (aws/gcp etc)- model can be exported post selection using pickle library

Published by

Unknown's avatar

sevanand yadav

software engineer working as web developer having specialization in spring MVC with mysql,hibernate

Leave a comment