Week 1: Machine Learning w/ Andrew Ng & Blockchain

January 29th, 2018

From now on, at the end of every week I will be posting what I am learning in the Coursera course and other project I sought out to learn during the previous week.

Up until now.

Since I completed the Northeastern University Level – Data Analytics program I’ve scrambled around the internet for various ways to learn Machine Learning. Chris Albon’s Machine Learning Flashcards were a great start as I’m still working through all 300 of them. I’ve taken a few Data Camp and Data Quest courses on Python for Data Science, and I’ve competed in a few Kaggle Competitions, my code for these I have posted on my GitHub.

The struggles I have faced are:

  • The more I learn, the more I realize how much more there is to learn, in a way its motivating to me.
  • It’s easier to learn through real life applications you are interested in, but finding  figuring out how to start is the hardest part.
  • Coming from a non-programming or computer science background, people often don’t take you very seriously

Coursera:

This week I started the above Coursera course with Andrew Ng.

Week one consisted a lot of the basics that I have grappled with in my scrambling to learn more so far already. Here is what I learned this week

Machine Learning:

  • “A field of study that gives computers the ability to learn w/o being programmed” – Arthur Sammuel
  • “A computer program is said to learn from experience E w/ respect to some class of tasks T and performance measure P, if its performance measure at tasks in T, as measured by P, improves with experience E” – Tom Mitchell

There are two main types of Machine Learning Algorithms

  • Supervised Learning (* the most used): is where “right answers” are given and the algorithm tries to create a best fit line based on inputs.
    • Regression: Predict continuous valued output
    • Classificaiton: Discrete valued output

ml.png

  • Unsupervised Learning: is where the computer doesn’t know the output but tries to cluster points together to create some kind of prediction
    • examples:
      • given a set of news articles, group them into set of articles of the same story
      • given a data base of customer data, automatically discover market segments and group customers into different market segments
    • Clustering: Grouping by relativity
    • non-clustering: find structure in chaotic environment
      • ie: Amazon Alexa while music is play

Model Representation:

  • Supervised Learning: given the “right answer” for each example in data
    • A training set will create a learning algorithm to apply to a test set that doesn’t have the “right answer” and will predict these outputs.
  • Regression Problem: predict real-valued output
    • m = number of training examples
    • x’s = input variables / features
    • y’s = output / target variable
    • (x,y) = one training example
    • (x(i),y(i))= ith training example

hΘ(x) = Θ(0)(1)

Cost Function:

Θi‘s: Parameters
Idea: to choose Θ 01 so that hΘ(x) is close to y for our training examples (x,y)

minimize the cost function J(Θ 01) = /2m ∑ (hΘ(x(i))-y(i))2

Gradient Descent:

  • Θj : = Θj – ∝(ª/(ªΘj) J(Θ 01) ; for j = 0 and j = 1
    • ∝ = learning rate
      • larger # = big steps down hill
        • quick but could overshoot minimum and fail to converge or diverge
      • smaller # = smaller steps down hill
        • gradient descent is slow
      • * when updating Θj
      • As we approach a local minimum the |slope of the tangent| gets smaller, thus the gradient descent (learning rate[ ∝]) will automatically take smaller steps
    • ª/(ªΘj) =  derivative of the cost function with respect to Θj
  • Gradient Descent scaled better to large data sets

Matrices and Vectors:

  • Matrix: a rectangular array of numbers
  • Dimension of matrix: # of rows x # of columns
  • Vector: an n x 1 matrix

Matrix Addition

Scalar Multiplication

Matrix Vector Multiplication

Matrix Matrix Multiplication

Matrix Inverse Properties

Matrix Transpose

** I do not the images explaining the concepts above **

Blockchain

Over this last week I also learned from @ECOMUNSING’s blog how to code my own Blockchain using the Python programming language. What I learned is:

Blockchain: an immutable, sequential chain of record called blocks. Blocks can contain transactions, files, or any data you would like, as long as they are chained together using Hashes

  • Hashes: a function that takes in input value and from input value, creates an output value deterministic of the input value.

I didn’t program a blockchain as complex as Bitcoin or Ethereum but this is essentially what their Validation function does

Bitcoin Validation fn: checks the input values are valid unspent transactions outputs(UTXO’s) that the outputs are greater than input and keys used for signiture are valid.

Ethereum Validation fn: Checks Smart Contracts were faithfully executed and respected gas limits

  • Smart Contracts: (Aka Crypto Contracts) directly controls transfer of a digital currency or assets between parties under specific conditions. Defines rules and penalties around an agreement in the same way a traditional contract, but automatically enforces them. Does so by taking info in as input and exception actions required by contractual clauses.

Genesis Block: is the first block in the system. Because it is not linked to any prior block (like the rest are required so that no value is neither created nor destroyed) it is treated differently and can arbitrarily set the system Account Balance.

Through coding this blockchain I got a deeper understanding of not just how these Blocks are created, but also other ways blockchain can be applied to things other than just creating a crypto currency. A decentralized ledger could serve many industries and could potentially impact every single market that we know today.

Through working through this, I also was able to practice and improve my understanding of python programming syntax…

MUCH MORE TO LEARN… More Updates Next Week!

 

 

 

 

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s