Ad

Saturday, February 16, 2019

Machine Learning Deep Learning Tutorials

KAGGLE

FAQ Udacity Deep Learning Nanodegree Project 2 Dog Breed Classifier Convolution Neural Network (CNN)

CODE SNIPPETS

numpy.squeeze
Remove single-dimensional entries from the shape of an array.
Selects a subset of the single-dimensional entries in the shape. If an axis is selected with shape entry greater than one, an error is raised.

>>> import numpy as np
>>> test = np.array([[[1],[3],[1]]])
>>> np.squeeze(test)
array([1, 3, 1])
>>> np.squeeze(test).shape
(3,)

test = np.array([[[1,2],[3,4],[1,5]]])
>>> test2 = np.squeeze(test)
>>> test2
array([[1, 2],
       [3, 4],
       [1, 5]]) 



End of code snippet

Saturday, December 29, 2018

Sample .gitignore file


Some good files to ignore .DS_Store a hidden file generated by Mac, .ipynb_checkpoints, hidden files generated by Python Notebooks aka Jupyter Notebooks. Large image datasets used for machine learning and deep learning training. .gitignore is also prefixed by a dot, it is a hidden file, usually doesn't show up in finder or file viewer, but can be opened in sublime.

Pytorch Torchvision model performance cheatsheet


Network vs Top-1 Error vs Top-5 Error including VGG net, ResNet, Densenet.

Sunday, December 2, 2018

Visualize tensors - Machine Learning Deep Learning Cheat Sheet

Tensors are the basic units of deep learning frameworks, neural networks functions calculations. A one dimensional tensor is like a list of elements. A two dimensional tensor is like an excel sheet it has a row dimension and a column dimension. 3D tensor is like an RGB marked image. Each pixel has a red, green, blue value, makes each pixel representation 3 dimensional.


Trivia: Tensorflow is named after tensors. Duh

Thursday, October 11, 2018

Codecademy - Machine Learning Fundamentals - Syllabus

Upgrade your skills with Codecademy's Pro Intensive, Machine Learning Fundamentals.
Each unit will cover conceptual and syntax lessons and quizzes. There will also be a few cumulative off-platform projects throughout the Intensive. Articles and videos will be available to supplement your learning.
Unit 1- What is Machine Learning?
Learn about the types of problems to solve with machine learning.
Machine Learning Process
Learn about Scikit
Why Data?
Unit 2 - Regression
Predict continuous-valued output based on the input value(s).
Distance Formula
Linear Regression
Multiple Linear Regression
Precision vs Recall
Unit 3 - Classification
Classify data into different categories.
Bayes’ Theorem
Naive Bayes Classifier
K-Nearest Neighbors
The Ethics of Overfitting
Unit 4 - Unsupervised Learning
Find patterns and structures in unlabeled data points.
K-Means Clustering
K-Means++ Clustering
Unit 5 - Neural Network Teaser
Implement a single neuron - the building block of neural networks.
Perceptron
Unit 6 - Capstone Project
Apply your new knowledge to complex projects reviewed by experts.
Yelp recommender
Date-a-Scientist

Monday, September 24, 2018

Natural Language Processing NLP - Useful libraries, tools and code samples

Basic Concepts
  • Stop words removal
    • Stop words are words that may not carry valuable information
    • In some cases stop words matter. For example researchers found that stop words are useful in identifying negative reviews or recommendations. People use sentences such as "This is not what I want." "This may not be a good match." People may use stop words more in negative reviews. Researchers found this out by keeping the stop words and achieving better prediction results. 
    • Removing punctuation may also yield better results in some situations
  • Tokenization  : breaking texts into tokens. example: breaking sentences into words, and more group words based on scenarios. There's also the n gram model and skip gram model
    • Basic tokenization is 1 gram, n gram or multi gram is useful when a phrase yields better result than one word, for example "I do not like Banana." one gram is I _space_ do  _space_ not _space_ like _space_ banana. It may yield better result with 3 gram model: I do not, do not like, not like banana, like banana _space_, banana _space. 
    • ngram : n is the number of words we want in each token. Frequently, n =1
  • Lemmatization:  transform words into its roots. Example: economics, micro-economics, macro-economists, economists, economist, economy, economical, economic forum can all be transformed back to its root econ, which can mean this text or article is largely about economics, finance or economic issues. Useful in situations such as topic labeling. Common libraries: WordNetLemmatizer, Porter-Stemmer
  • An illustration of sentence tagging
  • Example of tokenization and lemmatization for ngrams = 1. source
Python Basics
  • Python library NLTK
    • includes a list of stop words in English and many languages, you may want to customize this list
    • Example The Sun and Sun mean different things, in certain analytics situation, it matters.
    • from nltk.corpus import stopwords
    • clean_tokens = [token for token in tokens if token not in stop_words] #important pattern
      • source: Towards Data Science  Emma Grimaldi How Machines understand our language: an introduction to Natural Language processing
  • from nltk.tokenize import RegexpTokenizer a regex tokenization
  • RegexpTokenizer(r'\w+') tokenize any word that has length > 1, effectively removing all punctuations
Sklearn Basics
  • Sklearn text classification with sparse matrix http://scikit-learn.org/stable/auto_examples/text/document_classification_20newsgroups.html
  • Read our article about TF-IDF model for information retrieval, document search read here

Count Vectorizer

What does it do? "Convert a collection of text documents to a matrix of token counts" (sklearn documentation). returns a sparse matrix scipy.sparse.csr_matrix 

Feature Dimension : equal to the vocabulary size found by analyzing the data.

NLP Use Case

  • Classify is a review positive or negative, sentiment analysis

React UI, UI UX, Reactstrap React Bootstrap

React UI MATERIAL  Install yarn add @material-ui/icons Reactstrap FORMS. Controlled Forms. Uncontrolled Forms.  Columns, grid