User talk:Admin

From ElixirBlocks
Jump to: navigation, search
  • The functional form of the model is called its architecture (but be careful—some‐

times people use model as a synonym of architecture, so this can get confusing).

  • The weights are called parameters.
  • The predictions are calculated from the independent variable, which is the data

not including the labels.

  • The results of the model are called predictions.
  • The measure of performance is called the loss.

Tensors are the array and the vector is the number of items in the array. [1,2,3,4] is a 1 dimensional tensor with a 4d vector. The dimension is also called the "rank". This tensor has a rank of 1.

A tensor that holds a single number is called a scalar and looks like this:

tf.scalar(6)


Engineers think in IF statements. ML thinks in probabilities.

machine learning is the process of automating the discovery of rules for solving complex problems.

Video Sections

Condensed Notes

Scattered Notes Sandbox

NLP

How to assign numbers to words?

Create a dictionary of, say, 1,000 words, which can be compared and given a score for a ‘dimension’ of interest.

You may, for instance, define a dimension called ‘Medical’ to score words that are related to medicine, i.e. to find out how ‘medical’ a word is.




Chapter 4: Writing Custom Models

  • Gathering and testing data
  • Perceptron - elementary building block of ML
  • How multi layered perceptron's are used for more complex data.
  • Beyond perceptron's - convolutional neural networks.




const INPUTS_TENSOR = tf.tensor2d(INPUTS);
const OUTPUTS_TENSOR = tf.tensor1d(OUTPUTS);


Perceptron

  • A kind of artificial neuron. A building block of machine learning.
  • A perceptron can have multiple inputs and each input has a weight
  • A the final state of a perceptron has a bias
  • After the bias is applied, the output is run through an "activation function".
  • The output is then sent to other neurons inputs.

General

What is a Regression Problem?

Tensorflow.js Notes

Machine learning is a subset of AI that is focused on systems that learn from data

to improve their performance.

  • Single and multi-input linear regression
  • Non-Linear regression
  • Classification
  • Multi-Layer Perceptrons (MLP) - Deep Neural Networks (DNNs)
  • Convolutional Neural Networks (CNNs)

Tensor is just a Computer Science way of saying "Multi-dimensional" array. In neural networks and deep learning every piece of data and every computation result is represented as a tensor.

When you add a new dimension to a Tensor (array) you are said to increase its rank such as 1D, 2D, 3D etc..


Each Tensor has two basic properties:

  • Data type (such as float32 or int32)
  • Shape ( shape describes the size of the tensor along all its dimensions)



There are two categories of data.

  • Training data
  • Test data


The core building block of neural networks is the layer, a data-processing module that you can think of as a tunable function from tensors to tensors. When data is turned into a Tensor of a given data type and shape it can be input into any type of layer that accepts that data type and shape.

Model vs Tensor

Tensors are the building blocks that carry the data within a model, and the model itself is the overarching structure that learns from data to perform a specific task.

  • Tensor: Fundamental data structure representing multi-dimensional arrays, used for storing and processing numerical data.
  • Layer: Component of a model that processes input tensors using weights and biases to produce output tensors. Layers form the building blocks of models.
  • Model: Collection of layers organized to learn patterns from data and make predictions. Models use tensors to propagate information through layers during training and inference.

Note

Tensor data -> layers -> Neural Net -> computational graph

Tensor data is input into a layer. Many layers compose a neural net. Many neural nets make up a computational graph.

"Layers" can be manually created. It's rare to create your own. Instead, use Keras.

Keras

It also allows users to connect the layers together to form neural networks. Furthermore, Keras also comes with APIs for

  • Specifying how the neural network will be trained (loss functions, metrics, and optimizers)
  • Feeding data to train or evaluate the neural network or use the model for inference
  • Monitoring the ongoing training process (callbacks)
  • Saving and loading models
  • Printing or plotting the architecture of models

Keras provides a set of the most frequently used types of neural network layers. Keras is a high-level neural networks API that provides a convenient way to build and train deep learning models


In TensorFlow.js, a "layer" refers to a fundamental building block in the construction of neural networks. Neural networks are composed of layers that are stacked on top of each other, forming a computational graph



Imagine a tensor as a kind of fluid that carries data. In

TensorFlow, it flows through a graph—a data structure consisting of interconnected mathematical operations (called nodes). As figure 1.7 shows, the node can be succes�sive layers in a neural network. Each node takes tensors as inputs and produces ten�sors as outputs. The “tensor fluid” gets transformed into different shapes an different values as it “flows” through the TensorFlow graph.


Training a model in TensorFlow.js is done by calling the model’s fit() method. We fit the model to the training data

(async function() {
 await model.fit(trainTensors.sizeMB,
 trainTensors.timeSec,
 {epochs: 10});
})();


What is the role of a Developer in ML?

With normal code, a human writes the code directly, and a computer reads and inter‐ prets that code, or some derivative of it.

In Machine Learning, a human writes the algorithm’s trainer. Assisted by a frame‐ work, or even from scratch, a human outlines in code the parameters of the problem, the desired structure, and the location of the data to learn from. Now the machine runs this program-training program, which continuously writes an ever-improving algorithm as the solution to that problem. At some point, you stop this program and take the latest algorithm result out and use it.

The algorithm is much smaller than the data that was used to create it.

The resulting algorithm is essentially a collection of numbers that balance the out‐ lined structure identified by the human programmer. The collection of numbers and their associated neural graph is often called a model.

Tensor

A tensor is a fancy word that means "multi dimensional array". Imagine a tensor as a kind of fluid that carries data. In TensorFlow, it flows through a graph—a data structure consisting of interconnected mathematical operations (called nodes). As figure 1.7 shows, the node can be successive layers in a neural network. Each node takes tensors as inputs and produces tensors as outputs. The “tensor fluid” gets transformed into different shapes and different values as it “flows” through the TensorFlow graph. This corresponds to the transformation of representations: that is, the crux of what neural networks do, as we have described in previous sections


Role of Tensorflow.js?

TensorFlow.js handles the API for specifying the structure or archi‐ tecture of the model, loading data, passing data through our machine learning pro‐ cess, and ultimately tuning the machine to be better at predicting answers to the given input the next time. This is where the real benefits of TensorFlow.js come to bear. All we have to worry about is properly tuning the framework to solve the prob‐ lem with sufficient data and then saving the resulting model.

Types of Machine Learning

Supervised

Most common form of learning. Supervised ML simply means that we have an answer key for every question we’re using to train our machine. That is to say, our data is labeled. So if we’re trying to teach a machine to distinguish if a photo contains a bird, we can immediately grade the AI on whether it was right or wrong. Like a Scantron, we have the answer key. But unlike a Scantron and because it’s probability math, we can also identify how wrong the answer was.

Unsupervised

Unsupervised learning doesn’t require us to have an answer key. We only need ques‐ tions. Unsupervised machine learning would be ideal, as most information in the world does not come with labels. This category of machine learning focuses on what a machine could learn and report from unlabeled data. Finds patterns in unlabeled data

Semisupervised

Semi-supervised learning is a broad category of machine learning that uses labeled data to ground predictions, and unlabeled data to learn the shape of the larger data distribution. Practitioners can achieve strong results with fractions of the labeled data, and as a result, can save valuable time and money.

Reinforcement

Reinforcement learning (RL) is a machine learning (ML) technique that trains software to make decisions to achieve the most optimal results. It mimics the trial-and-error learning process that humans use to achieve their goals.