예제 #1
0
 def __show_house(self):
     house = HouseModel()
     for house in self.__controller.list_houses:
         # print(f"{house.title}的房源编号是{house.id}社区是{house.community}"
         #       f"楼龄是{house.years}房屋类型是{house.house_type}房屋面积是{house.area}"
         #       f"楼层是{house.floor}描述是{house.description}总价是{house.total_price}"
         #       f"单价是{house.unit_price}关注{house.follow_info}")
         print(house.__dict__)
예제 #2
0
 def __string_to_HouseModel(line):
     return HouseModel(int(line[0]), line[1], line[2], line[3], line[4], float(line[5]), line[6], line[7],
                       float(line[8]), float(line[9]), line[10])
예제 #3
0
from model import HouseModel
import pandas as pd
import numpy as np

#train model
house_model = HouseModel("single_family_home_values.csv")

#!!!!!!!!!!!!!!!!!!!!!!! PUT THE RESERVE DATASET IN test.csv !!!!!!!!!!!
reserve = HouseModel.preprocess("test.csv").values
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
features = reserve[:,0:-1]
labels = reserve[:,-1] # last column is labels/targets



print "\n***** TEST ERROR STATS ********"
residuals = pd.Series(house_model.residuals(features,labels))
mean_diff = np.mean(residuals)
p_mean_diff = np.mean(mean_diff/np.exp(labels))
print "R^2:\t %0.5f" % house_model.score(features,labels)
print "%%Err:\t %0.5f%%" % (p_mean_diff*100)
print residuals.describe()
print "***** TEST ERROR STATS ********"
예제 #4
0
 def __init__(self):
     self.__list_houses = HouseDao.load()
     self.model = HouseModel()