33# Author: Sebastian Raschka <sebastianraschka.com>
44#
55# License: BSD 3 clause
6- from mlxtend .data import boston_housing_data
76import numpy as np
87import pandas as pd
98from numpy import nan
2019from sklearn .pipeline import Pipeline
2120
2221from mlxtend .classifier import SoftmaxRegression
22+ from mlxtend .data import boston_housing_data
2323from mlxtend .feature_selection import SequentialFeatureSelector as SFS
2424from mlxtend .utils import assert_raises
2525
@@ -443,8 +443,7 @@ def test_regression():
443443
444444
445445def test_regression_sffs ():
446- boston = load_boston ()
447- X , y = boston .data , boston .target
446+ X , y = boston_housing_data ()
448447 lr = LinearRegression ()
449448 sfs_r = SFS (
450449 lr ,
@@ -460,8 +459,7 @@ def test_regression_sffs():
460459
461460
462461def test_regression_sbfs ():
463- boston = load_boston ()
464- X , y = boston .data , boston .target
462+ X , y = boston_housing_data ()
465463 lr = LinearRegression ()
466464 sfs_r = SFS (
467465 lr ,
@@ -477,8 +475,7 @@ def test_regression_sbfs():
477475
478476
479477def test_regression_in_range ():
480- boston = load_boston ()
481- X , y = boston .data , boston .target
478+ X , y = boston_housing_data ()
482479 lr = LinearRegression ()
483480 sfs_r = SFS (
484481 lr ,
@@ -722,9 +719,7 @@ def test_string_scoring_clf():
722719
723720
724721def test_max_feature_subset_size_in_tuple_range ():
725- boston = load_boston ()
726- X , y = boston .data , boston .target
727-
722+ X , y = boston_housing_data ()
728723 lr = LinearRegression ()
729724
730725 sfs = SFS (
@@ -741,8 +736,7 @@ def test_max_feature_subset_size_in_tuple_range():
741736
742737
743738def test_max_feature_subset_best ():
744- boston = load_boston ()
745- X , y = boston .data , boston .target
739+ X , y = boston_housing_data ()
746740 lr = LinearRegression ()
747741
748742 sfs = SFS (lr , k_features = "best" , forward = True , floating = False , cv = 10 )
@@ -752,8 +746,7 @@ def test_max_feature_subset_best():
752746
753747
754748def test_max_feature_subset_parsimonious ():
755- boston = load_boston ()
756- X , y = boston .data , boston .target
749+ X , y = boston_housing_data ()
757750 lr = LinearRegression ()
758751
759752 sfs = SFS (lr , k_features = "parsimonious" , forward = True , floating = False , cv = 10 )
0 commit comments