# Sort the cities by the correlation of the two models in this segment, # together with the correlation coefficient and mean squared error for # each model. import numpy as np from math import sqrt from scipy.stats import pearsonr from pythonql.helpers import print_table from model_eval import dataset,model1,model2 res = [ select (city, corr, mrsq_1, mrsq_2) for d in dataset, m_1 in model1, m_2 in model2 where d.record_id == m_1.record_id and d.record_id == m_2.record_id group by d.city as city let mrsq_1 = sqrt( sum([select (x.price-y.pred)**2 for x in d, y in m_1 ])/ len(d)) let mrsq_2 = sqrt( sum([select (x.price-y.pred)**2 for x in d, y in m_2 ])/ len(d)) let corr = pearsonr([select x.pred for x in m_1], [select x.pred for x in m_2]) order by corr desc ] print_table(res,15)
Welcome to the PythonQL Web Demo
The Demo is organized into a number of scenarios that demonstrate the power and usability of PythonQL.
Each scenario illustrates a specific use case in data science that is addressed by PythonQL.