Machine Learning


    Environment setup

  1. Download Miniconda

    Latest Miniconda installer
  2. Install Miniconda on the computer

  3. Test the installation via terminal

    Open a Miniconda terminal by searching it in the Search.
    base is a default environment that gets install automatically
  4. Create a project folder A and change into the folder A

  5. Within the folder A create a custom environment by

    conda create --prefix ./env pandas numpy jupyter matplotlib scikit-learn
  6. Activate a new environment (Conda activate)

    conda activate <full path of folder A\env>
    Expected result: file path is shown in the terminal instead of the base

    • List of environments
      conda env list
    • Deactivate environment

      To deactivate an active environment, use

      conda deactivate

  7. Load up a Jupyter Notebook and check the tools we need

    1. In Miniconda terminal run the command from the folder A

      jupyter notebook

    2. As a result jupyter notebook will be open in the browser at http://localhost:8888/tree

    3. Press on New button > select Notebook > Python 3

    4. Press on Untitled.ipynb

    5. Write a Python command like print("Hello world") and press Shift Enter

    6. Write
      import pandas as pd
      import numpy as np
      import matplotlib.pyplot as plt
      import sklearn

    7. Press Shift Enter and see the number near the In was updated.

    8. Press Ctrl S to Save.

    9. To stop working perform

      1. In the terminal press on Ctrl C
      2. Write conda deactivate
        It will show base in the terminal.

    10. To activate it again write
      conda activate <full path of folder A\env>

  8. Install Jupyter using Conda

    conda install jupyter

    It will be installed in the env folder.


  9. Sharing Conda Environment


  10. Jupyter Notebook shortcuts

    • Shift Enter - execute the command
    • Ctrl s - save
    • Esc b - a new cell below
    • Esc a - a new line above
    • Esc dd - delete a cell
    • m - markdown

      • # ABC
      • ## VVV
      • ![](image file name)

    • y - code
    • tab - autocomplete of the file name in the current folder
    • df = pd.read_csv("my_file")
      df.head(30)
      df['Approximate sales in millions'].value_counts().plot(kind="bar")

    • Run comments like in the terminal
      • ls

Pandas - Python Data Analysis Library

div
Basic
  1. Import the data
  2. Clean the data
  3. Split data. Training Set / Test Set
  4. Create a Model (= function / Algorithm )
  5. Check the output
  6. Improve

Python Tools for Data Analysis and Machine Learning

Tools
Jupyter Notebook in Visual Code

Based on
Complete A.I. & Machine Learning, Data Science Bootcamp