WEBVTT

00:00.120 --> 00:02.360
Hello developers, and welcome back.

00:02.400 --> 00:08.000
In this section we're going to build together the house price prediction application.

00:08.000 --> 00:11.920
We're going to mix machine learning with Android.

00:11.920 --> 00:18.160
We have two parts to work on the Android and the machine learning part.

00:18.200 --> 00:25.600
We need to train the model using TensorFlow library, testing the model actual versus predicted, and

00:25.600 --> 00:29.320
exporting the model as Tflite extension.

00:29.560 --> 00:34.120
Then we need to move to the Android Studio build UI.

00:34.200 --> 00:35.320
With Jetpack Compose.

00:35.320 --> 00:42.640
We're going to build our application with Jetpack Compose, add the Tflite TensorFlow model to the assets

00:42.640 --> 00:46.560
folder and using the model to predict prices.

00:46.600 --> 00:52.800
Now let's see the steps involved in training the models with TensorFlow.

00:52.840 --> 00:59.320
It's similar to what we've done before, but with simple and minor changes.

00:59.320 --> 01:02.080
But at first, what is TensorFlow?

01:02.240 --> 01:10.630
TensorFlow is an open source library and end to end platform for machine learning deployed by Google.

01:10.790 --> 01:19.790
It's primarily used for numerical computation and building and deploying machine learning models, especially

01:19.790 --> 01:21.710
deep neural networks.

01:21.710 --> 01:26.630
We have that many features and characteristics for TensorFlow.

01:26.910 --> 01:33.670
Like open source, it's freely available and maintained by a large community, allowing for widespread

01:33.870 --> 01:35.510
use and development.

01:35.590 --> 01:43.670
Deep learning focus while versatile for various machine learning tasks, it's particularly well suited

01:43.670 --> 01:51.070
for deep learning applications such as image recognition, neutral natural language processing, and

01:51.070 --> 01:52.550
predictive analytics.

01:52.550 --> 01:58.510
And by the way, we're going to use TensorFlow later for image recognition and object detection.

01:58.550 --> 02:07.220
TensorFlow utilizes dataflow graphs where nodes represent mathematical operations and edges represent

02:07.220 --> 02:13.140
multidimensional data arrays called tensors and flow between them.

02:13.180 --> 02:21.420
It can run on various platforms, including CPUs, GPUs, mobile devices, embedded systems, and specialized

02:21.460 --> 02:27.900
tensor processing units TPU and also we can run it on microcontrollers.

02:28.100 --> 02:36.980
TensorFlow offers a rich set of tools, libraries like Keras for high level API and community resources

02:36.980 --> 02:44.580
to facilitate the entire machine learning workflow, from data acquisition and model building to training

02:44.580 --> 02:45.780
and deployment.

02:45.780 --> 02:48.300
We're gonna use it from scratch.

02:48.300 --> 02:56.140
We're gonna install this library, import it, and we're gonna start with the first step by loading

02:56.340 --> 02:57.860
the data set.

02:58.260 --> 03:01.460
The first step is the data set.

03:01.660 --> 03:04.420
Load and preprocess your data.

03:04.460 --> 03:11.620
This may include tasks such as Normalization, resizing, augmentation, and splitting into training,

03:11.620 --> 03:14.220
validation, and test sets.

03:14.380 --> 03:20.540
Create TensorFlow data objects for efficient data handling during training.

03:20.780 --> 03:26.140
Then we're going to move to the second step which is build and compile the model.

03:26.340 --> 03:34.980
Define your model architecture using TensorFlow, Keras dot sequential or the functional API.

03:35.300 --> 03:41.980
Choose the appropriate levels that you need and then compile the model by specifying an optimizer,

03:42.260 --> 03:45.260
a loss function, and the other metrics.

03:45.260 --> 03:52.460
As we learned before about the MSE and the the MSE error and the R squared.

03:52.500 --> 03:54.580
Did you remember in the previous videos?

03:54.580 --> 03:59.620
Then we're going to go to the third step which is training the model.

03:59.660 --> 04:06.620
Use model dot fit method to train your model on the prepared training data.

04:06.780 --> 04:13.290
Provide validation data to monitor performance during training and detect overfitting.

04:13.490 --> 04:21.330
Consider using callbacks like model Checkpoint to save the best model weights, or early stopping to

04:21.370 --> 04:22.730
prevent overfitting.

04:22.890 --> 04:29.570
Then we're gonna move to the fourth step, which is save and convert model.

04:29.570 --> 04:32.890
We need to evaluate the model after training.

04:32.930 --> 04:40.690
Evaluate the model's performance on set on test sets using Model.evaluate method to get metrics like

04:40.690 --> 04:48.930
loss and accuracy, and then save the trained model to the dot to the TensorFlow format, which is dot

04:48.970 --> 04:49.570
PB.

04:49.810 --> 04:55.450
So save your model in TensorFlow Savedmodel format using Model.save method.

04:55.450 --> 05:00.970
This saves the model's architecture, weights and training configuration.

05:01.090 --> 05:03.810
By the way, this is the TensorFlow format.

05:03.810 --> 05:05.570
It's like a folder.

05:05.890 --> 05:10.570
And inside the folder we have model architecture weights and training configuration.

05:10.570 --> 05:13.960
Don't worry we're gonna see them in deep, deep details.

05:13.960 --> 05:21.840
In the next videos for Android, we need to get a file with extension TF Lite.

05:21.920 --> 05:26.360
TF Lite, now known as our or Lite RT.

05:26.720 --> 05:34.480
This is a framework that enables on device artificial intelligence, AI, and machine learning by optimizing

05:34.480 --> 05:42.600
and deploying models onto resource constrained devices like mobile phones, embedded systems, and microcontrollers.

05:42.600 --> 05:52.600
And this is the target from this section to get the TF Lite model and include it in our application

05:52.600 --> 05:53.800
Android application.

05:53.840 --> 05:54.320
Okay.

05:54.560 --> 06:03.400
So this is the steps we're going to follow in the next videos in order to get a well-trained model and

06:03.400 --> 06:11.560
import it into our Android application and use it in order to get the predictions for the prices of

06:11.600 --> 06:12.680
the houses.
