4.4.1: Implement a neuron for linear regression - Training data and outliers

Google for Developers · Intermediate ·📐 ML Fundamentals ·3y ago

Key Takeaways

Implements a neuron for linear regression using TensorFlow.js, including data normalization and outlier handling

Full Transcript

foreign you'll put your knowledge of neurons into practice to create a tensorflow.js web app that will train a custom model live in your web browser so first let's define a problem you'll be trying to solve imagine a customer comes to you and says I'd like to create a web app that could estimate the house price of properties in a certain City all right well this sounds like something you should probably try and make with your existing knowledge in your mind you know that property prices might be linearly correlated with certain features like the size of the house but first you'll need some data to see if this works well now after asking the customer for more information you find they've gathered some example data of houses in the area here's an example of the data provided now the full size of the table is over 2 000 rows of data so it's shortened here but essentially it contains size in square feet number of bedrooms and the value of the house in dollars seems like there's enough data to give it a try at this step you may want to check for data to ensure there are no potential issues with how it's been recorded like missing values there are many ways to do this of course if there's a small amount of data like you have here you can visually check the columns that a value is in each or write a small bit of code to show the min max values and check for null values as a starting point there isn't third-party libraries that exists that can do much of his work for you and much more but those libraries are outside the scope of this course however if you're interested you might want to check out another Library called danfo.js that makes working of data easier in JavaScript that you could use as part of your tensorflow.js pipeline for processing data it tries to replicate a library known as pandas which python developers quite often use in data science in order to understand their input data features better for this exercise the data is already in good shape so let's start analyzing what you have now you can start by visualizing the correlation between each column of data that you have and the target value you're trying to predict here you want to predict house price so let's plot all the other values versus the house price to see how they relate first you plot size versus the value of the house as shown here now how did I draw this graph well you can use any graphing library of your choice to plot a chart like this I made these Scatter Plots using a library called plotly which is well suited for JavaScript and is built upon the very popular and Powerful d3.js library for data visualization it should be noted that tensorflow.js has a simple visualization number you can use too that you can import via a script tag check for links for more information so back to the data bin it seems that generally speaking ignoring some of the outliers highlighted the larger the house the more its value which is somewhat as expected you can also see that these features could be correlated with a straight line so it's well suited for linear regression which is what we're going to be doing next you can plot bedrooms versus Cell price which also shows a linear correlation between value and number of bedrooms it should be noted that you can see the variance quite nicely here you can see that for each bedroom level the house values can differ with a range of about a hundred thousand dollars in value again there are some fairly clear outliers which you may want to consider dropping from your data set to achieve better results now there are accurate mathematical ways of finding which points constitute to being outliers which you can then safely remove but again that is beyond the scope of this course and we'll be diving deeper into the world of data science instead however a quick search will provide many resources on this subject if you're interested that you can then replicate in JavaScript as needed intuitively then if your chosen line is going through the central points of those distributions the maximum error you would expect would be around fifty thousand dollars either above or below what the line itself predicts so hopefully your train model will have an average error lower than this okay so given the strong correlation in both chosen features along with the fact that they both seem to be linear in nature they should be well suited for a single neuron to learn from so now head on to the next section where it's time to start coding [Music] [Music]

Original Description

In this video you will learn how to take the example data provided in the prior video, import it into the JavaScript environment, and then normalize it so that it is in a form ready for training for our neuron to learn from. Catch more episodes from Machine Learning for Web Developers (Web ML) → https://goo.gle/learn-WebML Check out TensorFlow on YouTube → https://goo.gle/TensorFlow-YouTube Subscribe to Google Developers → https://goo.gle/developers Connect with Jason Mayes to ask questions: LinkedIn → https://goo.gle/3GwgeLw Twitter →https://goo.gle/3Xh6MT7 Discord →https://goo.gle/3WWVO5t Use #WebML to share your learnings and creations from this course to meet your peers on social media! See what others have already made with Web ML → http://goo.gle/made-with-tfjs
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Google for Developers · Google for Developers · 0 of 60

← Previous Next →
1 Developer Journey - Sunnyvale DSC Summit ‘19
Developer Journey - Sunnyvale DSC Summit ‘19
Google for Developers
2 How Google is working with students - Sunnyvale DSC Summit ‘19
How Google is working with students - Sunnyvale DSC Summit ‘19
Google for Developers
3 Starting your career in the Cloud - Sunnyvale DSC Summit ‘19
Starting your career in the Cloud - Sunnyvale DSC Summit ‘19
Google for Developers
4 The Solution Challenge  - Sunnyvale DSC Summit ‘19
The Solution Challenge - Sunnyvale DSC Summit ‘19
Google for Developers
5 Firebase - Sunnyvale DSC Summit ‘19
Firebase - Sunnyvale DSC Summit ‘19
Google for Developers
6 Cloud Hero - Sunnyvale DSC Summit ‘19
Cloud Hero - Sunnyvale DSC Summit ‘19
Google for Developers
7 Panel discussion  - Sunnyvale DSC Summit ‘19
Panel discussion - Sunnyvale DSC Summit ‘19
Google for Developers
8 The art of negotiation - Sunnyvale DSC Summit ‘19
The art of negotiation - Sunnyvale DSC Summit ‘19
Google for Developers
9 Courage to care, solve and share - Sunnyvale DSC Summit ‘19
Courage to care, solve and share - Sunnyvale DSC Summit ‘19
Google for Developers
10 Version 9 of Angular, Glass Enterprise Edition 2, path to DX deprecation, & more!
Version 9 of Angular, Glass Enterprise Edition 2, path to DX deprecation, & more!
Google for Developers
11 [DEPRECATING] Introducing a new series (Assistant for Developers Pro Tips)
[DEPRECATING] Introducing a new series (Assistant for Developers Pro Tips)
Google for Developers
12 Detecting memory bugs with HWASan, Bazel 2.1, Next ‘20 session guide, & more!
Detecting memory bugs with HWASan, Bazel 2.1, Next ‘20 session guide, & more!
Google for Developers
13 Why Podcast.app chose a .app domain name
Why Podcast.app chose a .app domain name
Google for Developers
14 Machine Learning Bootcamp Jakarta 2019
Machine Learning Bootcamp Jakarta 2019
Google for Developers
15 Android Studio 3.6, Android 11 Developer Preview, Kubeflow 1.0, & more!
Android Studio 3.6, Android 11 Developer Preview, Kubeflow 1.0, & more!
Google for Developers
16 [DEPRECATING]  Importance of community (Assistant on Air)
[DEPRECATING] Importance of community (Assistant on Air)
Google for Developers
17 Why the Flutter team switched from .io to a .dev domain name
Why the Flutter team switched from .io to a .dev domain name
Google for Developers
18 3 website-building tips from .dev creators
3 website-building tips from .dev creators
Google for Developers
19 Why NimbleDroid chose a .app domain name
Why NimbleDroid chose a .app domain name
Google for Developers
20 Android Platform Codelab, Bazel 2.2, Maps Android Utility Library v1.0, & more!
Android Platform Codelab, Bazel 2.2, Maps Android Utility Library v1.0, & more!
Google for Developers
21 Google for Games Developer Summit: A free, digital experience for game developers
Google for Games Developer Summit: A free, digital experience for game developers
Google for Developers
22 Inspecting Home Graph (Assistant for Developers Pro Tips)
Inspecting Home Graph (Assistant for Developers Pro Tips)
Google for Developers
23 Google for Games Developer Summit Keynote
Google for Games Developer Summit Keynote
Google for Developers
24 Stadia Games & Entertainment presents: Keys to a great game pitch (Google Games Dev Summit)
Stadia Games & Entertainment presents: Keys to a great game pitch (Google Games Dev Summit)
Google for Developers
25 Empowering game developers with Stadia R&D (Google Games Dev Summit)
Empowering game developers with Stadia R&D (Google Games Dev Summit)
Google for Developers
26 Supercharging discoverability with Stadia (Google Games Dev Summit)
Supercharging discoverability with Stadia (Google Games Dev Summit)
Google for Developers
27 Stadia Games & Entertainment presents: Creating for content creators (Google Games Dev Summit)
Stadia Games & Entertainment presents: Creating for content creators (Google Games Dev Summit)
Google for Developers
28 Bringing Destiny to Stadia: A postmortem (Google Games Dev Summit)
Bringing Destiny to Stadia: A postmortem (Google Games Dev Summit)
Google for Developers
29 Live Captioning in Google Slides
Live Captioning in Google Slides
Google for Developers
30 [DEPRECATING]  User engagement for the Google Assistant
[DEPRECATING] User engagement for the Google Assistant
Google for Developers
31 TensorFlow Dev Summit ‘20, Google for Games Dev Summit, Cloud AI Platform Pipelines, & much more!
TensorFlow Dev Summit ‘20, Google for Games Dev Summit, Cloud AI Platform Pipelines, & much more!
Google for Developers
32 Top 5 from the TensorFlow Dev Summit 2020
Top 5 from the TensorFlow Dev Summit 2020
Google for Developers
33 Developer Student Clubs 2019 Turkey Leads Summit
Developer Student Clubs 2019 Turkey Leads Summit
Google for Developers
34 Building simpler payment experiences | Google Pay Plugin for Magento 2
Building simpler payment experiences | Google Pay Plugin for Magento 2
Google for Developers
35 Become A Developer Student Club Lead
Become A Developer Student Club Lead
Google for Developers
36 Firebase Kotlin Extensions, ARM apps on the Android Emulator, Angular v9.1, & more!
Firebase Kotlin Extensions, ARM apps on the Android Emulator, Angular v9.1, & more!
Google for Developers
37 Test suite for Smart Home (Assistant for Developers Pro Tips)
Test suite for Smart Home (Assistant for Developers Pro Tips)
Google for Developers
38 Google Play updates, Bazel 3.0, Business Console for Google Pay, & more!
Google Play updates, Bazel 3.0, Business Console for Google Pay, & more!
Google for Developers
39 How to use error logs (Assistant for Developers Pro Tips)
How to use error logs (Assistant for Developers Pro Tips)
Google for Developers
40 Contact Center AI, Android Studio 4.1 Canary 5, TensorFlow QAT API, & more!
Contact Center AI, Android Studio 4.1 Canary 5, TensorFlow QAT API, & more!
Google for Developers
41 WebView DevTools, Kotlin meets gRPC, Flutter CodePen support, & more! (Episode 200)
WebView DevTools, Kotlin meets gRPC, Flutter CodePen support, & more! (Episode 200)
Google for Developers
42 Offline handling for Smart Home (Assistant for Developers Pro Tips)
Offline handling for Smart Home (Assistant for Developers Pro Tips)
Google for Developers
43 Android 11 Dev Preview 3, Google Fonts for Flutter, Shielded VM, & more!
Android 11 Dev Preview 3, Google Fonts for Flutter, Shielded VM, & more!
Google for Developers
44 Machine Learning Foundations: Ep #1 - What is ML?
Machine Learning Foundations: Ep #1 - What is ML?
Google for Developers
45 Flutter web support updates, BigQuery materialized views, Cloud Spanner emulator, & more!
Flutter web support updates, BigQuery materialized views, Cloud Spanner emulator, & more!
Google for Developers
46 Computer vision by building a neural network with TensorFlow | Machine Learning Foundations
Computer vision by building a neural network with TensorFlow | Machine Learning Foundations
Google for Developers
47 Machine Learning Foundations: Ep #3 - Convolutions and pooling
Machine Learning Foundations: Ep #3 - Convolutions and pooling
Google for Developers
48 Android 11 Beta plans, Flutter 1.17, Dart 2.8, & much more!
Android 11 Beta plans, Flutter 1.17, Dart 2.8, & much more!
Google for Developers
49 Machine Learning Foundations: Ep #4 - Coding with Convolutional Neural Networks
Machine Learning Foundations: Ep #4 - Coding with Convolutional Neural Networks
Google for Developers
50 Google Developers ML Summit
Google Developers ML Summit
Google for Developers
51 Real-world image classification using convolutional neural networks | Machine Learning Foundations
Real-world image classification using convolutional neural networks | Machine Learning Foundations
Google for Developers
52 Adobe XD support for Flutter, Architecture Framework, temporary closures with Places API, & more!
Adobe XD support for Flutter, Architecture Framework, temporary closures with Places API, & more!
Google for Developers
53 Machine Learning Foundations: Ep #6 - Convolutional cats and dogs
Machine Learning Foundations: Ep #6 - Convolutional cats and dogs
Google for Developers
54 Machine Learning Foundations: Ep #7 - Image augmentation and overfitting
Machine Learning Foundations: Ep #7 - Image augmentation and overfitting
Google for Developers
55 Announcing Firebase Live, Flutter Day, Java 11 on Google Cloud Functions, & more!
Announcing Firebase Live, Flutter Day, Java 11 on Google Cloud Functions, & more!
Google for Developers
56 Machine Learning Foundations: Ep #8 - Tokenization for Natural Language Processing
Machine Learning Foundations: Ep #8 - Tokenization for Natural Language Processing
Google for Developers
57 Android 11 Beta, Google Play Asset Delivery, Firebase Crashlytics SDK, & much more!
Android 11 Beta, Google Play Asset Delivery, Firebase Crashlytics SDK, & much more!
Google for Developers
58 Natural Language Processing: Using sequencing APIs in TensorFlow | Machine Learning Foundations
Natural Language Processing: Using sequencing APIs in TensorFlow | Machine Learning Foundations
Google for Developers
59 Build a sarcasm classifier using NLP and TensorFlow | Machine Learning Foundations
Build a sarcasm classifier using NLP and TensorFlow | Machine Learning Foundations
Google for Developers
60 AR Realism with the ARCore Depth API
AR Realism with the ARCore Depth API
Google for Developers

Related Reads

Up next
Arrays vs Lists: What AI Actually Prefers | Common Tech Interview Questions
SCALER
Watch →