A Straightforward Introduction To Machine Learning With Python Implementation by Hossain Md. Akramul
Author:Hossain, Md. Akramul [Hossain, Md. Akramul]
Language: eng
Format: epub
Publisher: UNKNOWN
Published: 2021-07-12T00:00:00+00:00
5. House Price Prediction: A Regression Problem
[1]: # importing basic libaries
import numpy as np # fundamental package for array computing import pandas as pd # Powerful data structures for data analysis, time â series, and statistics
import matplotlib.pyplot as plt # basic plotting library
[2]: train = pd. read_csv("train.csv" ) test = pd. read_csv("test.csv" )
[3]: with open ("data_description.txt" , 'r' ) as f: description = f. read()
#print(description)
5.0.1 Preprocessing of Data [4]: train. head() [4]: Id MSSubClass MSZoning LotFrontage LotArea Street Alley LotShape
0 1 60 RL 65.0 8450 Pave NaN Reg
1 2 20 RL 80.0 9600 Pave NaN Reg
2 3 60 RL 68.0 11250 Pave NaN IR1
3 4 70 RL 60.0 9550 Pave NaN IR1
4 5 60 RL 84.0 14260 Pave NaN IR1
LandContour Utilities ... PoolArea PoolQC Fence MiscFeature MiscVal MoSold â Lvl AllPub ... 0 NaN NaN NaN 0 2
1 Lvl AllPub ... 0 NaN NaN NaN 0 5
2 Lvl AllPub ... 0 NaN NaN NaN 0 9
3 Lvl AllPub ... 0 NaN NaN NaN 0 2
4 Lvl AllPub ... 0 NaN NaN NaN 0 12
YrSold SaleType SaleCondition SalePrice
0 2008 WD Normal 208500
1 2007 WD Normal 181500
2 2008 WD Normal 223500
3 2006 WD Abnorml 140000
4 2008 WD Normal 250000
[5 rows x 81 columns]
[5]: test. head() [5]: Id MSSubClass MSZoning LotFrontage LotArea Street Alley LotShape
0 1461 20 RH 80.0 11622 Pave NaN Reg
1 1462 20 RL 81.0 14267 Pave NaN IR1
2 1463 60 RL 74.0 13830 Pave NaN IR1
3 1464 60 RL 78.0 9978 Pave NaN IR1
4 1465 120 RL 43.0 5005 Pave NaN IR1
LandContour Utilities ... ScreenPorch PoolArea PoolQC Fence MiscFeature
0 Lvl AllPub ... 120 0 NaN MnPrv NaN
1 Lvl AllPub ... 0 0 NaN NaN Gar2
2 Lvl AllPub ... 0 0 NaN MnPrv NaN
3 Lvl AllPub ... 0 0 NaN NaN NaN
4 HLS AllPub ... 144 0 NaN NaN NaN
MiscVal MoSold YrSold SaleType SaleCondition
0 0 6 2010 WD Normal
1 12500 6 2010 WD Normal
2 0 3 2010 WD Normal
3 0 6 2010 WD Normal
4 0 1 2010 WD Normal
[5 rows x 80 columns]
[6]: train. info()<class 'pandas.core.frame.DataFrame'> RangeIndex: 1460 entries, 0 to 1459 Data columns (total 81 columns):
# Column
--- -----
0 Id
1 MSSubClass
2 MSZoning
3 LotFrontage
4 LotArea
Non-Null Count Dtype
-------------- ----1460 non-null int64 1460 non-null int64 1460 non-null object 1201 non-null float64 1460 non-null int64 5 Street
6 Alley
7 LotShape
8 LandContour 9 Utilities 10 LotConfig 11 LandSlope 12 Neighborhood 13 Condition1 14 Condition2 15 BldgType
16 HouseStyle 17 OverallQual 18 OverallCond 19 YearBuilt 20 YearRemodAdd 21 RoofStyle 22 RoofMatl
23 Exterior1st 24 Exterior2nd 25 MasVnrType 26 MasVnrArea 27 ExterQual 28 ExterCond 29 Foundation 30 BsmtQual
31 BsmtCond
32 BsmtExposure 33 BsmtFinType1 34 BsmtFinSF1 35 BsmtFinType2 36 BsmtFinSF2 37 BsmtUnfSF 38 TotalBsmtSF 39 Heating
40 HeatingQC 41 CentralAir 42 Electrical 43 1stFlrSF
44 2ndFlrSF
45 LowQualFinSF 46 GrLivArea 47 BsmtFullBath 48 BsmtHalfBath 49 FullBath
50 HalfBath
51 BedroomAbvGr 52 KitchenAbvGr 53 KitchenQual 54 TotRmsAbvGrd 55 Functional 1460 non-null object 91 non-null object 1460 non-null object 1460 non-null object 1460 non-null object 1460 non-null object 1460 non-null object 1460 non-null object 1460 non-null object 1460 non-null object 1460 non-null object 1460 non-null object
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
What's Done in Darkness by Kayla Perrin(26529)
Shot Through the Heart: DI Grace Fisher 2 by Isabelle Grey(19009)
The Fifty Shades Trilogy & Grey by E L James(18965)
Shot Through the Heart by Mercy Celeste(18882)
Wolf & Parchment: New Theory Spice & Wolf, Vol. 10 by Isuna Hasekura and Jyuu Ayakura(16992)
Python GUI Applications using PyQt5 : The hands-on guide to build apps with Python by Verdugo Leire(16879)
Peren F. Statistics for Business and Economics...Essential Formulas 3ed 2025 by Unknown(16808)
Wolf & Parchment: New Theory Spice & Wolf, Vol. 03 by Isuna Hasekura and Jyuu Ayakura & Jyuu Ayakura(16705)
Wolf & Parchment: New Theory Spice & Wolf, Vol. 01 by Isuna Hasekura and Jyuu Ayakura & Jyuu Ayakura(16334)
The Subtle Art of Not Giving a F*ck by Mark Manson(14263)
The 3rd Cycle of the Betrayed Series Collection: Extremely Controversial Historical Thrillers (Betrayed Series Boxed set) by McCray Carolyn(14072)
Stepbrother Stories 2 - 21 Taboo Story Collection (Brother Sister Stepbrother Stepsister Taboo Pseudo Incest Family Virgin Creampie Pregnant Forced Pregnancy Breeding) by Roxi Harding(13433)
Scorched Earth by Nick Kyme(12716)
Drei Generationen auf dem Jakobsweg by Stein Pia(10925)
Suna by Ziefle Pia(10847)
Scythe by Neal Shusterman(10273)
International Relations from the Global South; Worlds of Difference; First Edition by Arlene B. Tickner & Karen Smith(9479)
Successful Proposal Strategies for Small Businesses: Using Knowledge Management ot Win Govenment, Private Sector, and International Contracts 3rd Edition by Robert Frey(9317)
This is Going to Hurt by Adam Kay(9107)
