Package: autopredictor
autopredictorSummary|Functions|Installation|Usage|DependenciesAboutAutopredictor simplifies machine learning model selection for regression tasks. This Python package provides an intuitive approach, minimizing coding for model exploration. Assuming preprocessed data, it swiftly evaluates models with default settings, allowing quick comparison of their effectiveness.SummaryThis Autopredictor Python package streamlines the process of selecting and assessing machine learning models, offering a simplified approach to assess various regression models without the need of intricate manual setup. Designed for datasets with continuous response variable, this tool expedites the exploration of multiple models, minimizing the coding effort required for model selection and fitting. Leveraging preprocessed and trained data, this package evaluates models using default settings, allowing users to swiftly comprehend model performance. By computing and showcasing diverse performance metrics for each model, it offers an efficient means to compare their effectiveness. The key metrics used for evaluating model performance include Mean Absolute Error (MAE), Mean Absolute Percentage Error (MAPE), R2 Square, Mean Squared Error (MSE), and Root Mean Squared Error (RMSE). The Autopredictor package encompasses eight regression models, enhancing flexibility and choices in model selection:Linear RegressionLasso RegressionRidge RegressionLinear Support Vector MachineSupport Vector MachineDecision TreeRandom ForestGradient BoostingAdaBoostFor a detailed explanation of each model, refer to theAudopredictor Tutorial. Overall, Autopredictor delivers a convenient and efficient framework for preliminary model evaluation and the comparison of regression models in machine learning workflows.FunctionsThis package includes four main functions:fit: Fits a clean, preprocessed training data into eight different regression models. This function returns a dictionary containing five metric scores for each modelshow_all: Generates a DataFrame presenting each scoring metric alongside the respective model, while outputting a clear overview of the results in a table formatdisplay_best_score: Identifies the best score with respect to a specific scoring metric along with the corresponding modelselect_model: Returns a summary of all the scoring metrics associated with a specific machine learning modelA comprehensize walkthrough of each function can be found in theAudopredictor Tutorial.This package focuses on eight widely used regressor models, providing a curated selection that covers a broad range of algorithmic approaches. This package are designed to be user-friendly through automation with default configurations for each model. It is catered for both beginners by eliminating complicated model arguments and for experts by providing baseline results. However, this package may not be suitable for experienced practitioner who requires customized regressor models. Within the Python ecosystem, there is an existing, well developed and maintained library namedlazypredictthat offer similar functionality with a wider range of models, including classification models.InstallationIn order to use this package, please run the instructions provided below.For Users: Using PyPIThis package is published on PyPi. Run the following command to install autopredictor in the desired environment:pipinstallautopredictorFor Developers: Using PoetryAlldependenciesinstallation used in this package will be handled by Poetry through the following commands:Clone this GitHub repository using this command:gitclonehttps://github.com/UBC-MDS/autopredictor.gitInstall poetry in your base environment by following theseinstructions.Run the following commands from the root directory of this project to create a virtual environment for this package and install autopredictor through poetry:condacreate--nameautopredictorpython=3.9-y
condaactivateautopredictor
poetryinstallUsageTo useautopredictor, follow these simple steps:Import the package:importautopredictorLoad your preprocessed training data.Once you have your data split into training and testing, you can start by fitting the data to obtain scores for eight different regression models:results_test,results_train=autopredictor.fit(X_train,X_test,y_train,y_test,return_train=True)Thefitfunction returns a dictionary containing four metric scores for each model.Display an overview of the results in a table format:scores_test=autopredictor.show_all(results_test)scores_train=autopredictor.show_all(results_train)By callingautopredictor.show_all(results), the function will print a tabulated version of the resulting DataFrame for easier visualization.Identify the best score with respect to a specific metric:autopredictor.display_best_score(metric='r2')Get a summary of all scoring metrics associated with a specific model:autopredictor.select_model(model='Linear Regression')Exampleimportautopredictor# return_train will always default to False assuming the user does not want to see the train scoresscores,_=autopredictor.fit(X_train,X_test,y_train,y_test)# Display an overview of the resultstest_df=autopredictor.show_all(scores)# Identify the best score with respect to the R-squared metricautopredictor.display_best_score(metric='r2')# Get a summary of scoring metrics for the Linear Regression modelautopredictor.select_model(model='Linear Regression')Developer notes:Running The TestsRun the following command in the terminal from the project's root directory to execute the tests written for each function in this package:pytesttests/To assess the branch coverage for this package:pytest--cov=autopredictor--cov-branchDependenciesThis package relies on the following dependencies as outlined inpyproject.toml:python = "^3.9"pandas = "^2.1.4"tabulate = "^0.9.0"scikit-learn = "^1.3.2"pytest = "^7.4.4"pytest-cov = "^4.1.0"jupyter = "^1.0.0"myst-nb = "^1.0.0"sphinx-autoapi = "^3.0.0"sphinx-rtd-theme = "^2.0.0"DocumentationsOnline documentation is availablehere.ContributingInterested in contributing? Check out the contributingguidelines. Please note that this project is released with aCode of Conduct. By contributing to this project, you agree to abide by its terms. Please find the list of contributorshere.Licenseautopredictorwas created by Anu Banga, Arturo Rey, Sharon Voon, Zeily Garcia. It is licensed under the terms of the GNU GENERAL PUBLIC LICENSE.Important LinksOfficial source code repo:https://github.com/UBC-MDS/autopredictor.gitOfficial read the doc:https://autopredictor.readthedocs.io/en/latest/?badge=latestThis package uses the following models fromscikit-learn:Linear Regression:https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LinearRegression.htmlLinear Regression (L1) (Lasso):https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.Lasso.htmlLinear Regression (L2) (Ridge):https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.Ridge.htmlSupport Vector Machine:https://scikit-learn.org/stable/modules/generated/sklearn.svm.SVR.htmlDecision Tree:https://scikit-learn.org/stable/modules/generated/sklearn.tree.DecisionTreeRegressor.htmlRandom Forest:https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestRegressor.htmlGradient Boosting:https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.GradientBoostingRegressor.htmlAdaBoost:https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.AdaBoostRegressor.htmlReferencesPandala, S. R. (2022). LazyPredict. Retrived fromhttps://pypi.org/project/lazypredict/Pedregosa, F., Varoquaux, G., Gramfort, A., Michel, V., Thirion, B., Grisel, O., … Duchesnay, É. (1970). Scikit-Learn: Machine learning in Python. Retrieved fromhttps://jmlr.csail.mit.edu/papers/v12/pedregosa11a.htmlCreditsautopredictorwas created withcookiecutterand thepy-pkgs-cookiecuttertemplate.