Advertisement

决策树实战波士顿房价

阅读量:
复制代码
    import numpy as np
    import sklearn.datasets as sd
    import pandas as pd
    import matplotlib.pyplot as plt
    
    boston = sd.load_boston()
    boston.keys()
    
    boston.filename
    
    print(boston.DESCR)
    
    print(boston.feature_names)
    
    print(boston.data.shape)#x
    
    boston.target.shape
    
    #划分训练集和测试集
    import sklearn.model_selection as ms
    
    x = boston.data
    y = boston.target
    
    train_x,\
    test_x,\
    train_y,\
    test_y = ms.train_test_split(x,y,test_size=0.1,random_state=7)
    
    res = ms.train_test_split(x,y,test_size=

全部评论 (0)

还没有任何评论哟~