import numpy as np from sklearn import datasets, linear_model from homework2_rent import score_rent # Load the diabetes dataset testData = datasets.load_diabetes() # Load the diabetes dataset # testData = datasets.load_diabetes() # Use only one feature data_X = testData.data[:, np.newaxis, 2] # Split the data into training/testing sets X_train = data_X[:-20] X_test = data_X[-20:] y_train = testData.target[:-20] y_test = testData.target[-20:] print("Mean squared error is: %.2f" % score_rent(X_test,y_test,X_train,y_train))
def test_rent(): R2 = score_rent() assert R2> 0.5
def test_rent(): assert score_rent() > 0.25
def test_rent(): assert (h.score_rent() < 0.3)
import homework2_rent as p if __name__ == "__main__": assert(p.score_rent()>0.5)
def test_rent(): if (h.score_rent() < 0.2): return 1 else: return 0
def test_rent(): """Run test to check accuracy """ accuracy = score_rent() assert accuracy >= 0.42
def test_rent(): p = score_rent() assert p >= 0.59
def test_rent(): r2_value, _, _, _ = score_rent() assert r2_value > 0.5