Package: auto-ml-cl
auto-ml-clGet best models with only3lines of code no matter what type of data withauto-ml-cl.How to create a machine learning and deep learning models with just a few lines of code by just provide data, then framework will get best trained models based on the data we have? We don't need to care aboutData Loading,Feature Engineering,Model Training,Model Selection,Model EvaluationandModel Sink, evenRESTfulwith best trained model. NowAuto-MLcomes in to show power!This repository is based onscikit-learnandTensorFlowto create both machine learning models and nueral network models with3lines of code by just providing a training file, if there is a test file will be nicer to evaluate trained model without any bias, but if with just one file will also be fine.Happy to accounce:Bothclassificationandregressionproblems are supported now!InstallationIt's highly recommended that to create avirtual environmentto installauto-ml-clas this will be at least of affect for root user path.LinuxInstall virtual env:sudo apt-get install python3-venvCreate virtual env folder:python3 -m venv your_env_nameactivate your virtual env:source your_env_name/bin/activateInstallauto-ml-clpackage:pip install auto-ml-clWindowsInstall virtual env:python -m pip install virtualenvCreate virtual env folder:python -m venv your_env_nameactivate your virtual env:.\your_env_name\Scripts\activateInstallauto-ml-clpackage:pip install auto-ml-clGetting startedClassificationSample code to useauto_mlpackage by usingTitanicdataset from Kaggle competion, as this dataset contain different kinds of data types also contain some missing values with different threasholds.fromauto_ml.automlimportClassificationAutoML,FileLoadfile_load=FileLoad(file_name="train.csv",file_path=r"C:\auto_ml\test",label_name='Survived')auto_est=ClassificationAutoML()auto_est.fit(file_load=file_load,val_split=0.2)That's it all you need to get best models based on your dataset!If you need to get model prediction based on best trained model, that's easy just callpredictfunction based on test data file like bellow code.# Get prediction based on best trained modelsfile_load_test=FileLoad(file_name="test.csv",file_path=r"C:\auto_ml\test")pred=auto_est.predict(file_load=file_load_test)Then we could get whole trained models' evaluation score for each trained model score, we could get best trained model based on validation score if we would love to use trained model for production, one important thing is that these models are stored in local server, we could use them any time with RESTFul API calls.If we want to use GCP cloud storage as a data source for train and test data, what needed is just get the service account file with proper authority, last is just provide with parameter:service_account_nameand file local path:service_account_file_pathtoFileLoadobject, then training will start automatically.file_name="train.csv"file_path="gs://bucket_name"service_account_name="service_account.json"service_account_file_path=r"C:\auto_ml\test"file_load=FileLoad(file_name,file_path,label_name='Survived',service_account_file_name=service_account_name,service_account_file_path=service_account_file_path)auto_est=ClassificationAutoML()auto_est.fit(file_load=file_load)If we have datain memory, we could also use memory objects to train, test and predict withauto_mlobject, just likescikit-learn.fromsklearn.datasetsimportload_irisfromsklearn.model_selectionimporttrain_test_splitx,y=load_iris(return_X_y=True)xtrain,xtest,ytrain,ytest=train_test_split(x,y,test_size=.2)auto_est=ClassificationAutoML()auto_est.fit(xtrain,ytrain)score=auto_est.score(xtest,ytest)pred=auto_est.predict(xtest)prob=auto_est.predict_proba(xtest)RegressionFull functionality for bothclassificationandregressionis same, so the only difference is to change imported class fromClassificationAutoMLtoRegressionAutoMLjust like snippet codefromauto_ml.automlimportRegressionAutoML,FileLoadfile_load=FileLoad(file_name="train.csv",file_path=r"C:\auto_ml\test",label_name="label")# Just change this classauto_est=RegressionAutoML()auto_est.fit(file_load=file_load,val_split=0.2)Key featuresmachine learningandneural network modelsare supported.Automatically data pre-processingwith missing, unstable, categorical various data types.Ensemble logicto combine models to build more powerful models.Nueral network models searchwithkerastunnerto find best hyper-parameter for specific type of algorithm.Cloud filesare supported like:Cloud storagefor GCP or local files.Loggingdifferent processing information into one date file for future reference.Processing monitoringfor each algorithm training status.RESTful APIfor API call to get prediction based on best trained model.Algorithms supportedCurrent supported algorithms:Logistic RegressionSupport vector machineGradient boosting treeRandom forestDecision TreeAdaboost TreeK-neighborsXGBoostLightGBMDeep nueral networkAlso supported withEnsemblelogic to combine different models to build more powerful model by adding model diversity:VotingStackingFor raw data file, will try with some common pre-procesing steps to create dataset for algorithms, currently some pre-processing algorithms are supported:Imputation with statistic analysis for continuous and categorical columns, also support with KNN imputaion for categorical columns.Standarize with data standard dataNormalizeOneHot Encoding for categorical columnsMinMax for continuous columns to avoid data volumn biasPCA to demension reduction with threasholdFeature selection with variance or LinearRegression or ExtraTreeInsightsInsight for logics toautomachine learning training steps.Load data from file or memory for both training and testinig with classFileLoad, support with GCP'sGCSfiles as source file.Build processing pipeline object based on data.(1).Imputationfor both categorical and numerical data with different logic, if data missing column is over a threshold, will delete that column. Support with algorithmKNNImputerto impute data orSimpleImputerto fill missing data.(2).OneHot Encodingfor categorical columns and add created columns into original data.(3).Standardizedata to avoid data range, also benefit for some algorithms likeSVMetc.(4).MinMaxdata to keep data into a 0-1 range.(5).FeatureSelectionto keep features with a default threshold or using algorithm withExtraTreeorLinearRegreesionto select features.(6).PCAto reduce dimenssion if feature variance over a threshold and just keep satisfied features.Build aSingletonbackend object to do file or data related functions.Build training pipeline to instant each algorithm with afactoryclass based on pre-defined used algorithms.Build aSearchModelclass for each algorithm to find best parameters based onRandomSearchorGridSearch.Pre-processing pipelinefitandtranform, save trained pipeline into disk for future use.Starttrainingwith training pipeline with processed data with doing parameters search to findbest parameter's model, also combined with Neural network search to find best neural models. If needvalidationwill use some data to do validation that will reduce training data size, or could use traindedauto_mlobject to do validation will also be fine.UseEnsemblelogic to dovotingorstackingto combine trained models as a new more diverse model based on best trained model.Evaluateeach trained models based on validation data and return a ditionary withtraining model name,training scoreandvalidation score.Support toexport trained models into a pre-defined folderthat we want.SupportRESTful APIcall based on best trained model based ontest score.