Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_get_params():
"""Assert that get_params returns the exact dictionary of parameters used by TPOT."""
kwargs = {
'population_size': 500,
'generations': 1000,
'config_dict': 'TPOT light',
'offspring_size': 2000,
'verbosity': 1
}
tpot_obj = TPOTClassifier(**kwargs)
# Get default parameters of TPOT and merge with our specified parameters
initializer = inspect.getargspec(TPOTBase.__init__)
default_kwargs = dict(zip(initializer.args[1:], initializer.defaults))
default_kwargs.update(kwargs)
assert tpot_obj.get_params()['config_dict'] == 'TPOT light'
assert tpot_obj.get_params() == default_kwargs
def test_TPOTBase():
"""Assert that TPOTBase class raises RuntimeError when using it directly."""
assert_raises(RuntimeError, TPOTBase)
from .base import TPOTBase
from .config_classifier import classifier_config_dict
from .config_regressor import regressor_config_dict
class TPOTClassifier(TPOTBase):
"""TPOT estimator for classification problems"""
scoring_function = 'accuracy' # Classification scoring
default_config_dict = classifier_config_dict # Classification dictionary
classification = True
regression = False
class TPOTRegressor(TPOTBase):
"""TPOT estimator for regression problems"""
scoring_function = 'neg_mean_squared_error' # Regression scoring
default_config_dict = regressor_config_dict # Regression dictionary
classification = False
regression = True
from .base import TPOTBase
from .config.classifier import classifier_config_dict
from .config.regressor import regressor_config_dict
class TPOTClassifier(TPOTBase):
"""TPOT estimator for classification problems."""
scoring_function = 'accuracy' # Classification scoring
default_config_dict = classifier_config_dict # Classification dictionary
classification = True
regression = False
class TPOTRegressor(TPOTBase):
"""TPOT estimator for regression problems."""
scoring_function = 'neg_mean_squared_error' # Regression scoring
default_config_dict = regressor_config_dict # Regression dictionary
classification = False
regression = True
TPOT is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with TPOT. If not, see .
"""
from .base import TPOTBase
from .config.classifier import classifier_config_dict
from .config.regressor import regressor_config_dict
class TPOTClassifier(TPOTBase):
"""TPOT estimator for classification problems."""
scoring_function = 'accuracy' # Classification scoring
default_config_dict = classifier_config_dict # Classification dictionary
classification = True
regression = False
class TPOTRegressor(TPOTBase):
"""TPOT estimator for regression problems."""
scoring_function = 'neg_mean_squared_error' # Regression scoring
default_config_dict = regressor_config_dict # Regression dictionary
classification = False
regression = True
any later version.
The TPOT library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details. You should have received a copy of the GNU General Public License along
with the TPOT library. If not, see http://www.gnu.org/licenses/.
"""
from .base import TPOTBase
from .config_classifier import classifier_config_dict
from .config_regressor import regressor_config_dict
class TPOTClassifier(TPOTBase):
"""TPOT estimator for classification problems"""
scoring_function = 'accuracy' # Classification scoring
default_config_dict = classifier_config_dict # Classification dictionary
classification = True
regression = False
class TPOTRegressor(TPOTBase):
"""TPOT estimator for regression problems"""
scoring_function = 'neg_mean_squared_error' # Regression scoring
default_config_dict = regressor_config_dict # Regression dictionary
classification = False
regression = True