Hello developers, and welcome back.
In this section we're going to build together the house price prediction application.
We're going to mix machine learning with Android.
We have two parts to work on the Android and the machine learning part.
We need to train the model using TensorFlow library, testing the model actual versus predicted, and
exporting the model as Tflite extension.
Then we need to move to the Android Studio build UI.
With Jetpack Compose.
We're going to build our application with Jetpack Compose, add the Tflite TensorFlow model to the assets
folder and using the model to predict prices.
Now let's see the steps involved in training the models with TensorFlow.
It's similar to what we've done before, but with simple and minor changes.
But at first, what is TensorFlow?
TensorFlow is an open source library and end to end platform for machine learning deployed by Google.
It's primarily used for numerical computation and building and deploying machine learning models, especially
deep neural networks.
We have that many features and characteristics for TensorFlow.
Like open source, it's freely available and maintained by a large community, allowing for widespread
use and development.
Deep learning focus while versatile for various machine learning tasks, it's particularly well suited
for deep learning applications such as image recognition, neutral natural language processing, and
predictive analytics.
And by the way, we're going to use TensorFlow later for image recognition and object detection.
TensorFlow utilizes dataflow graphs where nodes represent mathematical operations and edges represent
multidimensional data arrays called tensors and flow between them.
It can run on various platforms, including CPUs, GPUs, mobile devices, embedded systems, and specialized
tensor processing units TPU and also we can run it on microcontrollers.
TensorFlow offers a rich set of tools, libraries like Keras for high level API and community resources
to facilitate the entire machine learning workflow, from data acquisition and model building to training
and deployment.
We're gonna use it from scratch.
We're gonna install this library, import it, and we're gonna start with the first step by loading
the data set.
The first step is the data set.
Load and preprocess your data.
This may include tasks such as Normalization, resizing, augmentation, and splitting into training,
validation, and test sets.
Create TensorFlow data objects for efficient data handling during training.
Then we're going to move to the second step which is build and compile the model.
Define your model architecture using TensorFlow, Keras dot sequential or the functional API.
Choose the appropriate levels that you need and then compile the model by specifying an optimizer,
a loss function, and the other metrics.
As we learned before about the MSE and the the MSE error and the R squared.
Did you remember in the previous videos?
Then we're going to go to the third step which is training the model.
Use model dot fit method to train your model on the prepared training data.
Provide validation data to monitor performance during training and detect overfitting.
Consider using callbacks like model Checkpoint to save the best model weights, or early stopping to
prevent overfitting.
Then we're gonna move to the fourth step, which is save and convert model.
We need to evaluate the model after training.
Evaluate the model's performance on set on test sets using Model.evaluate method to get metrics like
loss and accuracy, and then save the trained model to the dot to the TensorFlow format, which is dot
PB.
So save your model in TensorFlow Savedmodel format using Model.save method.
This saves the model's architecture, weights and training configuration.
By the way, this is the TensorFlow format.
It's like a folder.
And inside the folder we have model architecture weights and training configuration.
Don't worry we're gonna see them in deep, deep details.
In the next videos for Android, we need to get a file with extension TF Lite.
TF Lite, now known as our or Lite RT.
This is a framework that enables on device artificial intelligence, AI, and machine learning by optimizing
and deploying models onto resource constrained devices like mobile phones, embedded systems, and microcontrollers.
And this is the target from this section to get the TF Lite model and include it in our application
Android application.
Okay.
So this is the steps we're going to follow in the next videos in order to get a well-trained model and
import it into our Android application and use it in order to get the predictions for the prices of
the houses.