발 sklearn.linear_model 수입 릿지 로부터 sklearn.preprocessing 수입 StandardScaler를 으로부터 sklearn.svm의 수입 SVC 에서 sklearn.tree 수입 DecisionTreeClassifier, export_graphviz 에서 IPython.display의 수입 표시 수입 PLT의로 matplotlib.pyplot 수입 순이익 등 NumPy와 수입 금강산로서하기 matplotlib 수입 PD 등 팬더 에서 sklearn.decomposition의 수입 PCA 에서 sklearn.datasets의 수입load_breast_cancer 에서 sklearn.model_selection의 수입 train_test_split의 RND = np.random.RandomState (0) X_org = rnd.normal (크기 = (1000, 3 )) w rnd.normal = (크기 = 3 ) X = rnd.poisson (10 *의 NP .EXP (X_org)) Y = np.dot (X_org, w) 인쇄 ( " 기능 출전 수 : \ n {} " .format (np.bincount (X [:, 0]))) X_train, X_test, y_train , y_test = train_test_split (X, Y, random_state = 0) # 岭回归验证测试分数 점수 =리지 () 적합 (X_train, y_train) .score (X_test, y_test). 인쇄 ( " 리지 시험 점수 : {: .3f} " .format (점수)) X_train_log = np.log (X_train + 1 ) X_test_log는 = NP. (X_test + 1 로그 ) 점수 = . 리지 () 적합 (X_train_log, y_train) .score (X_test_log, y_test) 인쇄 ( " 시험 점수 : {: .3f} " .format (점수))
리지 시험 점수 : 0.622
시험 점수 : 0.875
로그 변환에 의해 일반적으로 증가하는 연속적인 값을 절단 할 때 사용된다.