コード例 #1
0
ファイル: app.py プロジェクト: rahulmohan/WattRank
 def POST(self):
     form = web.input(location="Census Division", sqfootage="Square Footage", income="Income", energyspend="Yearly Energy Spend")
     greeting = "%s, %s, %s, %s" % (form.location, form.sqfootage, form.income, form.energyspend)
     ranking, dollar_ranks, shouldBeAmount, highestVal, lowestVal = makePrediction(model, modelFit, data, totaldol, 
     	                                        int(form.location), int(form.sqfootage), int(form.income), int(form.energyspend));
     return render.index(location = form.location, sqfootage = form.sqfootage, 
     	                income= form.income, energyspend = form.energyspend, 
     	                ranking =ranking, shouldBeAmount = shouldBeAmount,
     	                dollar_ranks = len(dollar_ranks), highestVal = highestVal, lowestVal = lowestVal)
コード例 #2
0
ファイル: testWattRank.py プロジェクト: rahulmohan/WattRank
from wattRankCluster import genClusters
from wattRankCluster import makePrediction

print "Training clustering model...\n"
model, modelFit, data, totaldol = genClusters();

div = raw_input("Enter your Census Division (1..10): ");
sqft = raw_input("Enter the Total Square Feet of your Home: ");
income = raw_input("Enter income range (1..20): ");
bill = raw_input("Enter energy bill in dollars for the past year: ");

ranking, dollar_ranks, shouldBeAmount, highestVal, lowestVal = makePrediction(model, modelFit, data, totaldol, int(div), int(sqft), int(income), int(bill));

print "\nYour electricity usage is ranked " + str(ranking) + " out of " + str(len(dollar_ranks)) + " similar people";
print "The average electricity bill among similar people: " + "$" + str(shouldBeAmount);
print "The lowest electricity bill among similar people: " + "$" + str(lowestVal);
print "The highest electricity bill among similar people: " + "$" + str(highestVal) + "\n";