Tag Archives: Python

Topic 24 – Introduction to Nature Language Processing

Why do I need to learn about nature language processing?

Natural language processing (NLP) has become increasingly interesting, with breakthrough achievements such as speech recognition, speech synthesis, autonomous driving, and chatbots.

Nowadays, a key skill for software developers is the ability to use NLP algorithms and tools to solve real-world problems involving text, audio, natural language sentences, and speech.

What can I do after finishing learning about nature language processing?

You will be to create software that could recognize speech, translate text to speech, translate a sentence from English to French, answer a customer’s question.

That sounds fun! What should I do now?

First, please take a quick look at the following two books to grasp the core concepts and classical methods in natural language processing:

After that, please audit this course, Sequence Models, to obtain the core concepts and hands-on experience with sequence models.

After that please watch these videos to learn about audio signal processing for machine learning.

After that, please audit the courses below to learn how to understand and generate natural language using deep learning models:

After that, please read the book below to learn how to use large lanugage models to build NLP applications:

Terminology Review:

  • Natural Language Processing.
  • Text Classification (e.g. Spam Detection).
  • Named Entity Recognition.
  • Chatbots.
  • Speech Processing.
  • Speech Recognition.
  • Speech Synthesis.
  • Machine Translation.
  • Corpus: A body of texts.
  • Token: a word or a number or a punctuation mark.
  • Collocation: compounds (e.g. disk drive), phrasal verbs (e.g. make up), and other stock phrases (e.g. bacon and eggs).
  • Unigram: word.
  • Bigrams: pairs of words that occur commonly.
  • Trigrams: 3 words that occur commonly.
  • N-grams: n words that occur commonly.
  • Hypothesis Testing.
  • t-Test.
  • Likelihood Ratios.
  • Language Model: statistical model of word sequences.
  • Naive Bayes.
  • Hidden Markov Models.
  • Bag-of-Words Model.
  • Term Frequency–Inverse Document Frequency (TF–IDF).
  • Bag-of-n-Grams.
  • One-Hot Representation: You have a vocabulary of n words and you represent each word using a vector that is n bits long, in which all bits are zero except for one bit that is set to 1.
  • Word Embedding (Featurized Representation) is the transformation from words to dense vector.
  • Euclidean Distance, Dot Product Similarity, Cosine Similarity.
  • Embedding Matrix.
  • Neural Language Model.
  • Word2Vec: Skip-Gram Model, Bag-of-Words Model.
  • Negative Sampling.
  • GloVe, Global Vectors.
  • Recurrent Neural Networks.
  • Backpropagation Through Time.
  • Recurrent Neural Net Language Model (RNNLM).
  • Gated Recurrent Unit (GRU).
  • Long Short Term Memory (LSTM).
  • Bidirectional RNN.
  • Deep RNNs.
  • Sequence to Sequence Model.
  • Teacher Forcing.
  • Image Captioning.
  • Greedy Search.
  • Beam Search, Length Normalization.
  • BLEU (BiLingual Evaluation Understudy) Score.
  • ROUGE (Recall-Oriented Understudy for Gisting Evaluation) Score.
  • F1 Score.
  • Minimum Bayes-Risk.
  • Attention Mechanism.
  • Self-Attention (Scaled and Dot-Product Attention): Queries, Keys and Values.
  • Positional Encoding.
  • Masked Self-Attention.
  • Multi-Head Attention.
  • Residual Dropout.
  • Label Smoothing.
  • Transformer Encoder.
  • Transformer Decoder.
  • Transformer Encoder-Decoder.
  • Cross-Attention.
  • Byte Pair Encoding.
  • BERT (Bidirectional Encoder Representations from Transformers).

After finishing natural language processing, please click on Topic 25 – Introduction to Distributed Systems to continue.

 

 

How to Completely Uninstall Python on macOS

Problem:

  • You have an issue with a specific Python version (e.g. version 3.7).
  • You want to install differerent version (e.g. version 3.6).
  • You want to completely uninstall the current version before installing the new one.

Solution:

Assume the current version is 3.7, replace it with the version you installed (e.g. version 3.8).

Follow the 3 steps below.

1. Remove the third-party Python 3.7 framework

sudo rm -rf /Library/Frameworks/Python.framework/Versions/3.7

2. Remove the Python 3.7 applications directory

sudo rm -rf "/Applications/Python 3.7"

3. Remove the symbolic links, in /usr/local/bin, that point to this Python version. Ensure that the links exit using below command:

ls -l /usr/local/bin | grep '../Library/Frameworks/Python.framework/Versions/3.7'

then run the following commands to remove all the links:

cd /usr/local/bin/ ls -l /usr/local/bin | grep '../Library/Frameworks/Python.framework/Versions/3.7' | awk '{print $9}' | tr -d @ | xargs rm

Installing a new version:

  1. Download a version from https://www.python.org/downloads/mac-osx/, double click the file and follow the instructions.
  2. Verify installation: python3 –version
  3. Install Homebrew from https://brew.sh
  4. Install virtualenv:
    pip3 install virtualenv
    pip3 install virtualenvwrapper
  5. Create and activate a virtual environment:
    cd /Users/admin/Downloads/training_model/model
    python3 -m virtualenv /Users/admin/Downloads/training_model/model
    source bin/activate

     

Topic 5 – Object-Oriented Programming

Why do I need to learn about object-oriented programming?

Because most of modern software are written using object-oriented programming languages. Using object-oriented programming as a tool and more importantly as a problem solving approach will save you a lot of time and cost when you create modern software systems.

What can I do after finishing learning object-oriented programming?

You will be able to write a program to allow a user
– to draw a picture, save it, then load it, or
– to play ping-pong game, or
– to store and search for an employee’s CV.

Alright! What should I do now?

First, please read this book to gain a fundamental understanding of object-oriented programming with intuitive examples, and to distinguish object-oriented concepts from procedural programming concepts: Jim Keogh and Mario Giannini (2004). OOP Demystified. McGraw-Hill.

After that, please read this book to learn how to apply object-oriented concepts to creating real world software using a specific object-oriented programming language (i.e. C# language): RB Whitaker (2017). The C# Player’s Guide. Starbound Software.

After that, please take a quick look at one of the books below so you can refer to a specific topic that requires further study when developing real-world software:

I hear that there are many object-oriented programming languages, such as C++, C#, Java, PHP, Objective-C, Swift, Python, and Ruby. How many object-oriented programming languages do I need to learn?

You should learn as many as possible. However, at this stage, we recommend that you focus on learning only C++, C#, or Java.

C++ is the most widely used language for developing high-performance software systems, including games, operating systems, compilers, database management systems, web browsers, graphics editors, and medical or engineering applications.

Java and C# are the most widely used languages for developing enterprise systems.

If you are required or prefer to learn C++, please read this book to learn the core concepts of object-oriented programming with C++ implementation and specific features: Bjarne Stroustrup (2013). The C++ Programming Language. Pearson Education.

If you are required or prefer to learn Java, please read this book to learn the core concepts of object-oriented programming with Java implementation and specific features: Herbert Schildt (2019). Java: The Complete Reference. McGraw-Hill Education.

You should focus on mastering the core object-oriented principles such as encapsulation, inheritance, polymorphism, and abstraction, rather than trying to learn every OOP language. Once you understand these principles well, you can apply them across different languages with relatively little effort.

After that, please read the two books below to deepen your understanding of OOP concepts and to learn how to design software more efficiently using this approach:

Terminology Review:

  • Abstraction.
  • Encapsulation.
  • Class-based Inheritance.
  • Prototype-based Inheritance.
  • Polymorphism.
  • Types.
  • Method Variables (C++ Function Pointers, C# Delegates).
  • Concurrency.
  • Collections.
  • Object-Oriented Analysis.
  • Object-Oriented Design.
  • Object-Oriented Programming.

After finishing learning about object-oriented programming, please click on Topic 6 – Introduction to Windows Programming to continue.

Topic 3 – Introduction to Programming

Why do I need to know a programming language?

Because you will develop your software using a programming language.
A programming language is a language that both you and a computer will understand.
It’s a tool for you to express what you want a computer to do.
It’s a tool for you to write the instructions of your computer programs.
Without knowledge of a programming language, you cannot develop software.

I hear that there are many programming languages such as C, C++, C#, Objective-C, Java, Swift, Ruby, Python, JavaScript, PHP, F#, Kotlin, Clojure, Go, and Lisp.
How many programming languages should I know?

As many as possible. However, at this stage, you should first learn about the structure of a computer program and a procedural language (e.g., C or C++).

What can I do after finishing learning programming language?

You will be able to write programs that tell a computer to:

  • perform calculations,
  • count the occurrences of a string,
  • store and search for a string,
  • sort a list of numbers, or
  • display an image.

What should I do now?

Please read this book to learn programming using the C language: Stephen Prata (2011). C Primer Plus. Pearson.

Alternatively, you can read this book (from Chapter 1 to Chapter 9), to learn programming using the C++ language: Stephen Prata (2012). C++ Primer Plus. Pearson.

Alternatively, you can read these books to learn programming using the Python language:,

Alternatively, you can read this book (from Chapter 1 to Chapter 11), to learn programming using the Ruby language: Chris Pine (2013). Learn to Program: The Facets of Ruby Series. The Pragmatic Bookshelf.

Alternatively, you can read these books to learn programming using the Go language:

After that, if you would like to study system programming in depth, please read one of the following books:

After that, if you would like to build your vocabulary and gain in-depth knowledge of programming, especially the relationship between mathematics and programming, as well as the ideas of functional programming and logic programming, then please read the book or the notes below:

Terminology Review:

  • Computer Programs.
  • Compilers.
  • Just-In-Time Compilers.
  • Interpreters.
  • Structured Programming.
  • Procedural Programming.
  • Object-Oriented Programming.
  • Functional Programming.
  • Declarative Programming.
  • Logic Programming.
  • Primitive Types: int, float, double, string, date/time, null.
  • Basic Constructs: variables & assignments, pointers, declarations, functions, macro.
  • Control Flow: if/else, while, switch, for, break, continue, recursion, exception, parallelism, signal, jump.
  • User-defined Types: struct, class, type.
  • Data Structures: Arrays, Lists, Linked Lists, Dictionaries.
  • Object-Oriented Programming: abstraction, encapsulation, class-based inheritance, prototype-based inheritance, polymorphism.
  • Functional Programming: first-class and higher-order functions, no side effects, recursion.
  • Modularity: files, packages, namespaces, libraries, modules.
  • Concurrency: processes, threads, locks, channels, timers, callbacks, events, promises, event loop.
  • Type system: static type, dynamic type.
  • Error handling: try/catch.
  • Metaprogramming: reflection, template programming, DSL.
    • Clojure.

    After finishing programming, please click on Topic 4 – Introduction to Data Structures and Algorithms to continue.