title
Machine Learning & Data Science Project - 6 : Python Flask Server (Real Estate Price Prediction)

description
This data science project series walks through step by step process of how to build a real estate price prediction website. We will first build a model using sklearn and linear regression using banglore home prices dataset from kaggle.com. Second step would be to write a python flask server that uses the saved model to serve http requests. Third component is the website built in html, css and javascript that allows user to enter home square ft area, bedrooms etc and it will call python flask server to retrieve the predicted price. During model building we will cover almost all data science concepts such as data load and cleaning, outlier detection and removal, feature engineering, dimensionality reduction, gridsearchcv for hyperparameter tunning, k fold cross validation etc. Technology and tools wise this project covers, 1) Python 2) Numpy and Pandas for data cleaning 3) Matplotlib for data visualization 4) Sklearn for model building 5) Jupyter notebook, visual studio code and pycharm as IDE 6) Python flask for http server 7) HTML/CSS/Javascript for UI Do you want to learn technology from me? Check https://codebasics.io/ for my affordable video courses. Next video: Data Science Project - 7: Website or UI (Real Estate Price Prediction Project) https://www.youtube.com/watch?v=rD2xumR98w8&list=PLeo1K3hjS3uu7clOTtwsp94PcHbzqpAdg&index=7 Popular Playlist: Data Science Full Course: https://www.youtube.com/playlist?list=PLeo1K3hjS3us_ELKYSj_Fth2tIEkdKXvV Data Science Project: https://www.youtube.com/watch?v=rdfbcdP75KI&list=PLeo1K3hjS3uu7clOTtwsp94PcHbzqpAdg Machine learning tutorials: https://www.youtube.com/watch?v=gmvvaobm7eQ&list=PLeo1K3hjS3uvCeTYTeyfe0-rN5r8zn9rw Pandas: https://www.youtube.com/watch?v=CmorAWRsCAw&list=PLeo1K3hjS3uuASpe-1LjfG5f14Bnozjwy matplotlib: https://www.youtube.com/watch?v=qqwf4Vuj8oM&list=PLeo1K3hjS3uu4Lr8_kro2AqaO6CFYgKOl Python: https://www.youtube.com/watch?v=eykoKxsYtow&list=PLeo1K3hjS3uv5U-Lmlnucd7gqF-3ehIh0&index=1 Jupyter Notebook: https://www.youtube.com/watch?v=q_BzsPxwLOE&list=PLeo1K3hjS3uuZPwzACannnFSn9qHn8to8 Code: https://github.com/codebasics/py/tree/master/DataScience/BangloreHomePrices/server Parent Code Repository: https://github.com/codebasics/py/tree/master/DataScience/BangloreHomePrices Website:https://codebasics.io/ Facebook: https://www.facebook.com/codebasicshub Twitter: https://twitter.com/codebasicshub

detail
{'title': 'Machine Learning & Data Science Project - 6 : Python Flask Server (Real Estate Price Prediction)', 'heatmap': [{'end': 171.337, 'start': 102.219, 'weight': 0.765}, {'value': 0.7184746533834785, 'end_time': 171.337, 'start_time': 116.103}, {'end': 232.993, 'start': 198.803, 'weight': 0.972}, {'end': 1161.218, 'start': 1115.891, 'weight': 1}], 'summary': 'Demonstrates building and setting up a python flask server to serve http requests and make home price predictions, including creating endpoints, loading location data, and predicting property prices based on location, area, bhk, and bathrooms, achieving estimated prices of 83 lakh and 1 crore 68 lakh for different home configurations.', 'chapters': [{'end': 116.103, 'segs': [{'end': 116.103, 'src': 'embed', 'start': 28.916, 'weight': 0, 'content': [{'end': 36.92, 'text': 'pycharm community edition is free to download from jetframe jetbrains website, so you can download it.', 'start': 28.916, 'duration': 8.004}, {'end': 38.16, 'text': "it's a python editor.", 'start': 36.92, 'duration': 1.24}, {'end': 45.183, 'text': "basically, here i'm going to click on open, to open a project.", 'start': 38.16, 'duration': 7.023}, {'end': 56.636, 'text': 'so you go to c code directory And in here I have created a folder called BHP, which is Bangalore home prices.', 'start': 45.183, 'duration': 11.453}, {'end': 63.178, 'text': 'If you look at this folder the folder has three sub folders client.', 'start': 57.717, 'duration': 5.461}, {'end': 65.559, 'text': 'So I have created all these folders.', 'start': 64.038, 'duration': 1.521}, {'end': 66.919, 'text': 'OK And these are empty right now.', 'start': 65.639, 'duration': 1.28}, {'end': 68.519, 'text': 'So client is empty.', 'start': 67.459, 'duration': 1.06}, {'end': 71.7, 'text': 'This is where our UI application will live.', 'start': 68.999, 'duration': 2.701}, {'end': 74.76, 'text': 'Another folder is server.', 'start': 73.519, 'duration': 1.241}, {'end': 78.663, 'text': 'This will contain the Python Flask server that we are going to write in this video.', 'start': 75.2, 'duration': 3.463}, {'end': 85.227, 'text': 'And the model has the notebook that we covered in all our previous tutorials.', 'start': 79.543, 'duration': 5.684}, {'end': 86.288, 'text': 'So this is that notebook.', 'start': 85.247, 'duration': 1.041}, {'end': 90.031, 'text': 'And these two are the artifacts.', 'start': 87.229, 'duration': 2.802}, {'end': 98.817, 'text': 'So this one is the saved model and this one is columns.json, which we exported here in our notebook.', 'start': 90.091, 'duration': 8.726}, {'end': 101.198, 'text': 'See, these are the two files that we exported.', 'start': 98.837, 'duration': 2.361}, {'end': 104.88, 'text': "so let's open that folder here.", 'start': 102.219, 'duration': 2.661}, {'end': 112.042, 'text': 'when you click on ok, pycharm will open that folder and this is how it looks.', 'start': 104.88, 'duration': 7.162}, {'end': 116.103, 'text': 'we are going to do work in this server folder in this video right.', 'start': 112.042, 'duration': 4.061}], 'summary': 'Pycharm is a free python editor, used to open a project and work on a python flask server for bangalore home prices, with specific subfolders and exported files.', 'duration': 87.187, 'max_score': 28.916, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Q5JyawS8f5Q/pics/Q5JyawS8f5Q28916.jpg'}], 'start': 0.209, 'title': 'Building python flask server', 'summary': 'Involves setting up a python flask server to serve http requests from the ui and make home price predictions, utilizing pycharm to organize folders for the ui application, flask server, and model artifacts.', 'chapters': [{'end': 116.103, 'start': 0.209, 'title': 'Building python flask server', 'summary': 'Involves setting up a python flask server to serve http requests from the ui and make home price predictions, utilizing pycharm to organize folders for the ui application, flask server, and model artifacts.', 'duration': 115.894, 'highlights': ['PyCharm community edition is used to organize folders for the UI application, Flask server, and model artifacts.', 'The server folder will contain the Python Flask server, while the client folder will host the UI application.', 'The model artifacts include a saved model and columns.json, which were exported from the notebook.']}], 'duration': 115.894, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Q5JyawS8f5Q/pics/Q5JyawS8f5Q209.jpg', 'highlights': ['PyCharm community edition organizes folders for UI, Flask server, and model artifacts.', 'Server folder contains Python Flask server, while client folder hosts UI application.', 'Model artifacts include saved model and columns.json exported from the notebook.']}, {'end': 415.387, 'segs': [{'end': 187.085, 'src': 'embed', 'start': 116.103, 'weight': 0, 'content': [{'end': 129.649, 'text': 'click here and create a file called server.py, which you should import flask module.', 'start': 116.103, 'duration': 13.546}, {'end': 140.196, 'text': 'flask is a module that allows you to write a Python service which can solve HTTP requests.', 'start': 129.649, 'duration': 10.547}, {'end': 154.49, 'text': "here I need to configure the interpreter, so file settings interpreter and i'm going to use anaconda as my interpreter,", 'start': 140.196, 'duration': 14.294}, {'end': 158.071, 'text': 'because anaconda comes with flask.', 'start': 154.49, 'duration': 3.581}, {'end': 162.673, 'text': "if you're not using anaconda, then you have to do pip, install flask yourself.", 'start': 158.071, 'duration': 4.602}, {'end': 171.337, 'text': 'okay, server.py is my main server file, where i imported flask module and created an app using this line,', 'start': 162.673, 'duration': 8.664}, {'end': 178.661, 'text': 'And in my main function I can just run app dot run and it will run the application on a specific port.', 'start': 172.097, 'duration': 6.564}, {'end': 182.322, 'text': "I'm going to write a simple hello routine.", 'start': 179.581, 'duration': 2.741}, {'end': 187.085, 'text': 'OK, so we can say hello which just returns hi.', 'start': 182.963, 'duration': 4.122}], 'summary': 'Creating server.py with flask module to handle http requests, using anaconda as interpreter.', 'duration': 70.982, 'max_score': 116.103, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Q5JyawS8f5Q/pics/Q5JyawS8f5Q116103.jpg'}, {'end': 336.125, 'src': 'heatmap', 'start': 198.803, 'weight': 1, 'content': [{'end': 204.707, 'text': 'Here you can say this is hello We just read which just returns.', 'start': 198.803, 'duration': 5.904}, {'end': 216.194, 'text': 'Hi, Okay, and I can now run this server by simply saying Python, space server dot pi.', 'start': 204.827, 'duration': 11.367}, {'end': 228.361, 'text': "by doing this, It's gonna run the servers on this particular URL, which I can copy in my browser, and I can call this hello routine.", 'start': 216.194, 'duration': 12.167}, {'end': 232.993, 'text': 'and And when I run this, you can see that I got hi back.', 'start': 228.361, 'duration': 4.632}, {'end': 239.257, 'text': 'So this is a very simple, basic Python flask server, which we have up and running.', 'start': 233.353, 'duration': 5.904}, {'end': 242.479, 'text': "Okay Now I'm going to close this server.", 'start': 239.957, 'duration': 2.522}, {'end': 248.02, 'text': 'and write my actual routine.', 'start': 245.299, 'duration': 2.721}, {'end': 250.18, 'text': 'so we need two routines.', 'start': 248.02, 'duration': 2.16}, {'end': 256.822, 'text': 'so first routine would be to return the locations in bangalore city.', 'start': 250.18, 'duration': 6.642}, {'end': 263.384, 'text': 'now, if you remember, we have our locations in this columns.json file.', 'start': 256.822, 'duration': 6.562}, {'end': 280.525, 'text': "okay, so i'm going to create a subdirectory within server directory, call it artifacts, artifacts and copy those exported artifacts,", 'start': 263.384, 'duration': 17.141}, {'end': 282.89, 'text': 'which is my model, and column.json.', 'start': 280.525, 'duration': 2.365}, {'end': 284.693, 'text': 'So control C.', 'start': 284.052, 'duration': 0.641}, {'end': 291.483, 'text': 'Control V.', 'start': 290.342, 'duration': 1.141}, {'end': 293.345, 'text': 'So now I have those artifacts here.', 'start': 291.483, 'duration': 1.862}, {'end': 300.691, 'text': 'You can see that my artifacts have columns.json and the actual model.', 'start': 294.866, 'duration': 5.825}, {'end': 306.155, 'text': "And then I'm going to read this column.json.", 'start': 301.872, 'duration': 4.283}, {'end': 311.4, 'text': 'Now if you look at column.json, it contains all the data columns.', 'start': 306.195, 'duration': 5.205}, {'end': 316.924, 'text': 'And from here onwards are all my locations.', 'start': 312.481, 'duration': 4.443}, {'end': 323.031, 'text': 'So in my UI application, I want to have a drop down where I want to show all the locations.', 'start': 317.665, 'duration': 5.366}, {'end': 329.317, 'text': "And for that, I'm going to write my first routine, which will just give me location.", 'start': 323.792, 'duration': 5.525}, {'end': 333.021, 'text': 'So I will call that routine get location names.', 'start': 329.378, 'duration': 3.643}, {'end': 336.125, 'text': 'Just call it get location names.', 'start': 334.503, 'duration': 1.622}], 'summary': 'Setting up a basic python flask server to return location names in bangalore city from a columns.json file.', 'duration': 107.764, 'max_score': 198.803, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Q5JyawS8f5Q/pics/Q5JyawS8f5Q198803.jpg'}], 'start': 116.103, 'title': 'Setting up python flask server and location data retrieval', 'summary': "Explains how to create a python flask server using anaconda with a simple 'hello' routine, expose http endpoints, set up a routine to return locations in bangalore city from a json file, create a subdirectory to store artifacts, extract location data, and implement a routine to retrieve all location names for a ui application.", 'chapters': [{'end': 263.384, 'start': 116.103, 'title': 'Setting up python flask server', 'summary': "Explains how to create a python flask server using anaconda with a simple 'hello' routine and how to expose http endpoints, followed by setting up a routine to return locations in bangalore city from a json file.", 'duration': 147.281, 'highlights': ["Creating a Python Flask server using Anaconda with a simple 'hello' routine and exposing HTTP endpoints", 'Setting up a routine to return locations in Bangalore city from a JSON file', 'Importing the flask module and configuring the interpreter to use Anaconda', "Running the server using 'Python server.py' and testing the 'hello' routine by calling it in the browser"]}, {'end': 415.387, 'start': 263.384, 'title': 'Server directory setup and location data retrieval', 'summary': 'Involves creating a subdirectory within the server directory to store artifacts, including a model and column.json, then extracting location data from the column.json file and implementing a routine to retrieve all location names for a ui application using the get location names routine and the jsonify method.', 'duration': 152.003, 'highlights': ["A subdirectory called 'artifacts' is created within the server directory to store exported artifacts, including the model and column.json, facilitating easy access and organization of the artifacts.", 'The column.json file is utilized to extract all the data columns, providing crucial information for subsequent processes and analysis in the application.', 'A routine named get location names is developed to retrieve and return all the locations, enhancing the user interface by allowing the display of all locations in a drop-down menu for improved user interaction and functionality.', 'The utilization of the JSONify method enables the creation of a response containing all the locations, ensuring seamless integration and retrieval of location data for the UI application.']}], 'duration': 299.284, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Q5JyawS8f5Q/pics/Q5JyawS8f5Q116103.jpg', 'highlights': ["Creating a Python Flask server using Anaconda with a simple 'hello' routine and exposing HTTP endpoints", 'Setting up a routine to return locations in Bangalore city from a JSON file', "A subdirectory called 'artifacts' is created within the server directory to store exported artifacts, including the model and column.json, facilitating easy access and organization of the artifacts", 'A routine named get location names is developed to retrieve and return all the locations, enhancing the user interface by allowing the display of all locations in a drop-down menu for improved user interaction and functionality', 'Importing the flask module and configuring the interpreter to use Anaconda']}, {'end': 682.178, 'segs': [{'end': 479.076, 'src': 'embed', 'start': 451.169, 'weight': 0, 'content': [{'end': 457.111, 'text': 'This method will load the saved artifacts, which is my column.json and Bangalore home prices.', 'start': 451.169, 'duration': 5.942}, {'end': 461.872, 'text': "And I'm going to store both of these into a global variable.", 'start': 457.751, 'duration': 4.121}, {'end': 465.333, 'text': "So I'll create two global variables.", 'start': 462.892, 'duration': 2.441}, {'end': 469.834, 'text': 'In fact, three global variables.', 'start': 466.633, 'duration': 3.201}, {'end': 479.076, 'text': 'So these are the three global variables I have and locations underscore location will contain all the location.', 'start': 472.694, 'duration': 6.382}], 'summary': 'Loading saved artifacts, storing in global variables, including three global variables and locations underscore location containing all locations.', 'duration': 27.907, 'max_score': 451.169, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Q5JyawS8f5Q/pics/Q5JyawS8f5Q451169.jpg'}, {'end': 556.656, 'src': 'embed', 'start': 514.735, 'weight': 1, 'content': [{'end': 521.399, 'text': 'And you can do json.loadf because this file is a JSON file.', 'start': 514.735, 'duration': 6.664}, {'end': 525.063, 'text': 'And you can call json.load method on that.', 'start': 522.4, 'duration': 2.663}, {'end': 529.407, 'text': 'We need to import, of course, a JSON module here.', 'start': 526.104, 'duration': 3.303}, {'end': 541.798, 'text': 'And whatever object is loaded will be converted into a dictionary on which we can call this data columns key.', 'start': 532.37, 'duration': 9.428}, {'end': 549.044, 'text': 'That will return me all my data columns.', 'start': 544.46, 'duration': 4.584}, {'end': 556.656, 'text': 'And out of all those data columns, starting with column number 3 are my locations.', 'start': 551.314, 'duration': 5.342}], 'summary': 'Using json.load method on json file to convert object into dictionary and access data columns, starting with column number 3 as locations.', 'duration': 41.921, 'max_score': 514.735, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Q5JyawS8f5Q/pics/Q5JyawS8f5Q514735.jpg'}, {'end': 646.703, 'src': 'embed', 'start': 589.056, 'weight': 2, 'content': [{'end': 598.098, 'text': "OK, so let's say with open dot artifacts, the name of the model.", 'start': 589.056, 'duration': 9.042}, {'end': 613.607, 'text': "Which is this? And since it's a binary model, I am going to use RB as F underscore underscore model is equal to pickle.", 'start': 599.359, 'duration': 14.248}, {'end': 616.33, 'text': 'So we are going to import pickle module as well.', 'start': 614.067, 'duration': 2.263}, {'end': 622.837, 'text': 'Pickle dot load F.', 'start': 621.896, 'duration': 0.941}, {'end': 636.636, 'text': 'I will say that loading the artifacts is done.', 'start': 630.331, 'duration': 6.305}, {'end': 646.703, 'text': 'once this routine is done, get location names, can just return locations.', 'start': 636.636, 'duration': 10.067}], 'summary': 'Using pickle to load binary model artifacts and return location names.', 'duration': 57.647, 'max_score': 589.056, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Q5JyawS8f5Q/pics/Q5JyawS8f5Q589056.jpg'}], 'start': 415.387, 'title': 'Loading location names', 'summary': 'Discusses loading saved artifacts, including column.json and bangalore home prices, into global variables, extracting locations starting from the third column, and finally returning the location names.', 'chapters': [{'end': 682.178, 'start': 415.387, 'title': 'Load and return location names', 'summary': 'Discusses loading saved artifacts, including column.json and bangalore home prices, into global variables, extracting locations starting from the third column, and finally returning the location names.', 'duration': 266.791, 'highlights': ["The method 'load saved artifacts' loads the 'column.json' and 'Bangalore home prices' into three global variables, with 'locations_location' containing all the location data.", "The objects loaded from 'column.json' are converted into a dictionary, and the data columns key is used to extract the locations starting from the third column.", "The routine loads a saved pickled model into '__model' using the pickle module, and after completion, the method 'get location names' can return the locations."]}], 'duration': 266.791, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Q5JyawS8f5Q/pics/Q5JyawS8f5Q415387.jpg', 'highlights': ["The method 'load saved artifacts' loads the 'column.json' and 'Bangalore home prices' into three global variables, with 'locations_location' containing all the location data.", "The objects loaded from 'column.json' are converted into a dictionary, and the data columns key is used to extract the locations starting from the third column.", "The routine loads a saved pickled model into '__model' using the pickle module, and after completion, the method 'get location names' can return the locations."]}, {'end': 1021.307, 'segs': [{'end': 714.412, 'src': 'embed', 'start': 683.683, 'weight': 4, 'content': [{'end': 689.358, 'text': 'And it loaded it and after that it printed all the locations so you can see that my location names are correct.', 'start': 683.683, 'duration': 5.675}, {'end': 692.686, 'text': 'See, I got all these locations.', 'start': 690.761, 'duration': 1.925}, {'end': 706.044, 'text': 'Once that routine is done, the second routine that you want to write is a function which can return you an estimated price, given the location,', 'start': 694.833, 'duration': 11.211}, {'end': 708.246, 'text': 'the square foot area, BHK and bathroom.', 'start': 706.044, 'duration': 2.202}, {'end': 710.228, 'text': "So let's write that routine.", 'start': 708.766, 'duration': 1.462}, {'end': 714.412, 'text': "We'll call it get estimated price.", 'start': 711.129, 'duration': 3.283}], 'summary': 'Developed routines to display locations and estimate prices based on location, square foot area, bhk, and bathroom.', 'duration': 30.729, 'max_score': 683.683, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Q5JyawS8f5Q/pics/Q5JyawS8f5Q683683.jpg'}, {'end': 866.792, 'src': 'embed', 'start': 815.296, 'weight': 1, 'content': [{'end': 825.44, 'text': "Now, I don't have x dot columns here, but what I have is underscore underscore data columns, which is a simple Python list here.", 'start': 815.296, 'duration': 10.144}, {'end': 830.401, 'text': "It was a numpy array, and that's why we used np dot where.", 'start': 826.14, 'duration': 4.261}, {'end': 834.683, 'text': "OK, so we are not going to use np dot where because it's a Python list.", 'start': 830.601, 'duration': 4.082}, {'end': 841.205, 'text': 'And, you know, in a Python list to find an index, you can call dot index method.', 'start': 834.923, 'duration': 6.282}, {'end': 847.336, 'text': 'whatever location you are getting, you need to convert it into lowercase,', 'start': 843.593, 'duration': 3.743}, {'end': 859.686, 'text': 'because remember that our columns.json has all lowercase locations and the behavior of python list dot index method is that if the element is not found,', 'start': 847.336, 'duration': 12.35}, {'end': 861.007, 'text': 'it throws an error.', 'start': 859.686, 'duration': 1.321}, {'end': 866.792, 'text': "that's why we are going to wrap it up into try, catch block like this.", 'start': 861.007, 'duration': 5.785}], 'summary': 'Converting numpy array to python list and handling index search with try-catch block.', 'duration': 51.496, 'max_score': 815.296, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Q5JyawS8f5Q/pics/Q5JyawS8f5Q815296.jpg'}, {'end': 958.768, 'src': 'embed', 'start': 929.838, 'weight': 2, 'content': [{'end': 939.409, 'text': 'we can access zeroth location in that element and that will give us the estimated price in the lakh rupees.', 'start': 929.838, 'duration': 9.571}, {'end': 949.962, 'text': 'now this will be a float number, so we are going to round the float number to two decimal places Like this.', 'start': 939.409, 'duration': 10.553}, {'end': 958.768, 'text': "OK, so my get estimated price function is pretty much ready and I'm going to call that particular function here.", 'start': 950.803, 'duration': 7.965}], 'summary': 'Accessing zeroth location gives estimated price in lakh rupees, rounded to two decimal places.', 'duration': 28.93, 'max_score': 929.838, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Q5JyawS8f5Q/pics/Q5JyawS8f5Q929838.jpg'}, {'end': 1021.307, 'src': 'embed', 'start': 991.132, 'weight': 0, 'content': [{'end': 994.336, 'text': 'Okay, so I forgot to define that as a global.', 'start': 991.132, 'duration': 3.204}, {'end': 1004.657, 'text': 'So you can see that it predicted the price of two properties in first phase JP Nagar.', 'start': 998.493, 'duration': 6.164}, {'end': 1007.999, 'text': 'One was with three bedroom and three bathroom.', 'start': 1005.337, 'duration': 2.662}, {'end': 1010.2, 'text': 'Another one was two bedroom, two bathroom.', 'start': 1008.179, 'duration': 2.021}, {'end': 1013.882, 'text': 'You can say two bedroom, two bathroom price is little less.', 'start': 1010.8, 'duration': 3.082}, {'end': 1015.784, 'text': 'So first one was 86 lakhs.', 'start': 1014.022, 'duration': 1.762}, {'end': 1017.445, 'text': 'The second one is 83 lakhs.', 'start': 1015.984, 'duration': 1.461}, {'end': 1021.307, 'text': 'For these two other locations, property prices are same.', 'start': 1017.805, 'duration': 3.502}], 'summary': 'Model predicted property prices for two properties in jp nagar, with 3-bedroom priced at 86 lakhs and 2-bedroom at 83 lakhs.', 'duration': 30.175, 'max_score': 991.132, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Q5JyawS8f5Q/pics/Q5JyawS8f5Q991132.jpg'}], 'start': 683.683, 'title': 'Property price prediction', 'summary': 'Covers predicting estimated prices based on location, area, bhk, and bathrooms, using a saved model with sklearn, creating input features with numpy, and using python for one-hot encoding to predict property prices, including converting locations to lowercase, error handling with try-except block, and rounding the estimated price to two decimal places.', 'chapters': [{'end': 841.205, 'start': 683.683, 'title': 'Predicting estimated price function', 'summary': 'Covers the process of creating a function to return estimated prices based on location, square foot area, bhk, and bathrooms, utilizing a saved model with sklearn, and creating a numpy array with zeros, representing the input features for the prediction.', 'duration': 157.522, 'highlights': ['A routine to print all the locations is executed first to verify the correctness of the location names.', "The chapter then focuses on creating a function called 'get estimated price' which takes arguments such as location, square foot area, BHK, and bathrooms, and returns the estimated price based on a saved model using sklearn's predict method.", "The process involves creating a numpy array with zeros to represent the input features for the prediction, followed by utilizing the Python list's index method to find the index of the input features."]}, {'end': 1021.307, 'start': 843.593, 'title': 'Python one-hot encoding for property price prediction', 'summary': 'Discusses the use of python for one-hot encoding to predict property prices, with a focus on converting locations to lowercase, handling errors using try-except block, and rounding the estimated price to two decimal places.', 'duration': 177.714, 'highlights': ['The behavior of python list dot index method is that if the element is not found, it throws an error, so it needs to be wrapped in a try-except block to handle errors and initialize the index to minus one if not found.', 'The number of zeros in the one-hot encoding will be equal to the length of data columns, with the specific location index being set to one and the remaining elements to zero, resulting in multiple columns for different locations and their encoding.', 'The model predicts the price of properties in different locations, with the estimated prices being rounded to two decimal places and accessed from the two-dimensional array, providing insights into property prices in lakh rupees, such as 86 lakhs for a three-bedroom and three-bathroom property in JP Nagar and 83 lakhs for a two-bedroom and two-bathroom property.', "The need to define the model as a global variable to resolve the error 'none type object has no attribute predict' and successfully predict the property prices for different locations, showing variations in prices based on the number of bedrooms and bathrooms."]}], 'duration': 337.624, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Q5JyawS8f5Q/pics/Q5JyawS8f5Q683683.jpg', 'highlights': ['The model predicts property prices based on location, area, BHK, and bathrooms', 'Creating input features with numpy and using Python for one-hot encoding', 'Rounding the estimated price to two decimal places for property price prediction', 'Error handling with try-except block for handling index errors in Python list', 'Printing all locations to verify correctness before property price prediction']}, {'end': 1272.718, 'segs': [{'end': 1046.752, 'src': 'embed', 'start': 1021.687, 'weight': 1, 'content': [{'end': 1030.108, 'text': "Now that my util methods are ready in my server.py, I have created another endpoint and let's call it predictHomePrice.", 'start': 1021.687, 'duration': 8.421}, {'end': 1033.21, 'text': 'This takes a POST method.', 'start': 1030.888, 'duration': 2.322}, {'end': 1035.27, 'text': 'OK, so HTTP POST.', 'start': 1033.81, 'duration': 1.46}, {'end': 1039.631, 'text': "Again, if you don't know what HTTP GET and HTTP POST is,", 'start': 1035.69, 'duration': 3.941}, {'end': 1046.752, 'text': 'you should pause this video and watch some other tutorials to clear your basics on how GET and POST work.', 'start': 1039.631, 'duration': 7.121}], 'summary': 'Created predicthomeprice endpoint using post method in server.py', 'duration': 25.065, 'max_score': 1021.687, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Q5JyawS8f5Q/pics/Q5JyawS8f5Q1021687.jpg'}, {'end': 1161.218, 'src': 'heatmap', 'start': 1104.261, 'weight': 0, 'content': [{'end': 1111.547, 'text': 'OK, so here we are calling util.getEstimatedPrice function, where we are passing the input parameters,', 'start': 1104.261, 'duration': 7.286}, {'end': 1115.371, 'text': 'and that will return us the estimated price back.', 'start': 1111.547, 'duration': 3.824}, {'end': 1120.937, 'text': 'all of our code is written and it is time to do some testing now.', 'start': 1115.891, 'duration': 5.046}, {'end': 1124.001, 'text': 'for this we can use a postman application.', 'start': 1120.937, 'duration': 3.064}, {'end': 1132.55, 'text': 'you can download it for free and the postman application allows you to test your http cause.', 'start': 1124.001, 'duration': 8.549}, {'end': 1137.712, 'text': 'okay, so first we are going to test our get location names call.', 'start': 1132.55, 'duration': 5.162}, {'end': 1149.674, 'text': 'so in the postman application you can select get here and I have the URL and after that I am mentioning my HTTP endpoint, which is get location name.', 'start': 1137.712, 'duration': 11.962}, {'end': 1153.075, 'text': 'this is the same thing which is mentioned here.', 'start': 1149.674, 'duration': 3.401}, {'end': 1155.956, 'text': "let's run our server now.", 'start': 1153.075, 'duration': 2.881}, {'end': 1161.218, 'text': 'so you can run the server by execute in python space server.py.', 'start': 1155.956, 'duration': 5.262}], 'summary': 'Utilizing util.getestimatedprice function to return estimated price, followed by testing in postman application.', 'duration': 28.289, 'max_score': 1104.261, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Q5JyawS8f5Q/pics/Q5JyawS8f5Q1104261.jpg'}, {'end': 1272.718, 'src': 'embed', 'start': 1259.57, 'weight': 5, 'content': [{'end': 1263.132, 'text': 'So it is now the time to build the UI.', 'start': 1259.57, 'duration': 3.562}, {'end': 1269.356, 'text': 'So in the next video, we are going to build the UI, which will make these HTTP calls.', 'start': 1263.512, 'duration': 5.844}, {'end': 1272.718, 'text': 'With that video, we will complete our application.', 'start': 1269.576, 'duration': 3.142}], 'summary': 'Next video will build ui making http calls, completing application.', 'duration': 13.148, 'max_score': 1259.57, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Q5JyawS8f5Q/pics/Q5JyawS8f5Q1259570.jpg'}], 'start': 1021.687, 'title': 'Creating predicthomeprice endpoint', 'summary': 'Discusses the creation of a predicthomeprice endpoint using a post method in server.py, involving the usage of http post and request.form for handling input data. it also covers calling util.getestimatedprice function with input parameters and testing http endpoints using postman, achieving estimated prices of 83 lakh and 1 crore 68 lakh for different home configurations.', 'chapters': [{'end': 1072.834, 'start': 1021.687, 'title': 'Creating predicthomeprice endpoint', 'summary': 'Discusses creating a predicthomeprice endpoint using a post method in server.py, involving the usage of http post and request.form for handling input data.', 'duration': 51.147, 'highlights': ['The chapter discusses creating a predictHomePrice endpoint using a POST method in server.py, involving the usage of HTTP POST and request.form for handling input data.', 'The endpoint predictHomePrice is created in server.py to handle HTTP POST method for input data, which will be received using request.form from the HTML application.', 'The chapter emphasizes the importance of understanding HTTP GET and POST methods as prerequisites for comprehending the tutorial.']}, {'end': 1272.718, 'start': 1073.735, 'title': 'Python flask server and http testing', 'summary': 'Covers the process of calling util.getestimatedprice function with input parameters and testing http endpoints using postman, achieving estimated prices of 83 lakh and 1 crore 68 lakh for different home configurations.', 'duration': 198.983, 'highlights': ['The process of calling util.getEstimatedPrice function with input parameters is explained, resulting in estimated prices of 83 lakh and 1 crore 68 lakh for different home configurations.', 'Testing HTTP endpoints using Postman is demonstrated, showcasing the retrieval of location names and predicting home prices based on input parameters such as square foot area, location, BHK, and bathroom.', 'The chapter concludes with the readiness and testing of HTTP endpoints, affirming the completion of the Python Flask server, paving the way for UI development in the next video.']}], 'duration': 251.031, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Q5JyawS8f5Q/pics/Q5JyawS8f5Q1021687.jpg', 'highlights': ['The process of calling util.getEstimatedPrice function with input parameters is explained, resulting in estimated prices of 83 lakh and 1 crore 68 lakh for different home configurations.', 'Testing HTTP endpoints using Postman is demonstrated, showcasing the retrieval of location names and predicting home prices based on input parameters such as square foot area, location, BHK, and bathroom.', 'The endpoint predictHomePrice is created in server.py to handle HTTP POST method for input data, which will be received using request.form from the HTML application.', 'The chapter discusses creating a predictHomePrice endpoint using a POST method in server.py, involving the usage of HTTP POST and request.form for handling input data.', 'The chapter emphasizes the importance of understanding HTTP GET and POST methods as prerequisites for comprehending the tutorial.', 'The chapter concludes with the readiness and testing of HTTP endpoints, affirming the completion of the Python Flask server, paving the way for UI development in the next video.']}], 'highlights': ['Demonstrates building and setting up a python flask server with endpoints for home price predictions, achieving estimated prices of 83 lakh and 1 crore 68 lakh', 'Creating input features with numpy and using Python for one-hot encoding', 'Testing HTTP endpoints using Postman for retrieving location names and predicting home prices', 'Setting up a routine to return locations in Bangalore city from a JSON file', 'The model predicts property prices based on location, area, BHK, and bathrooms', 'The process of calling util.getEstimatedPrice function with input parameters is explained']}