Package: skplumber
______         ______                 ______
__________  /____________  /___  ________ ______  /______________
__  ___/_  //_/__  __ \_  /_  / / /_  __ `__ \_  __ \  _ \_  ___/
_(__  )_  ,<  __  /_/ /  / / /_/ /_  / / / / /  /_/ /  __/  /
/____/ /_/|_| _  .___//_/  \__,_/ /_/ /_/ /_//_.___/\___//_/
              /_/skplumber is a Machine Learning (ML) package with two core things to offer:AnAutomated Machine Learning (AutoML) systemfor automatically sampling, training, scoring, and tuning machine learning pipelines on classification or regression problems. This is available as theskplumber.skplumber.SKPlumberclass.Alightweight ML frameworkfor composing ML primitives into pipelines (skplumber.pipeline.Pipeline) of arbitrary shape, and for training and fitting those pipelines using various evaluation techniques (e.g. train/test split, k-fold cross validation, and down-sampling). Also, all primitive hyperparameters come pre-annotated with types and range information so hyperparameters can be more easily interacted with. Additionally, an existing hyperparameter tuning technique is provided byskplumber.tuners.ga.ga_tune.The base pipeline and primitive constructs take heavily from the same constructs as they exist in theData Driven Discovery of Models (D3M)core package.API documentation for the project is locatedhere.InstallationpipinstallskplumberUsageTheSKPlumberAutoML SystemThe top-level API of the package is theskplumber.skplumber.SKPlumberclass. You instantiate the class, then use it'sfitmethod to perform a search for an optimal machine learning (ML) pipeline, given your input dataX, andy(apandas.DataFrameandpandas.Seriesrespectively). Here is an example using the classic iris dataset:fromskplumberimportSKPlumberimportpandasaspdfromsklearn.datasetsimportload_irisdataset=load_iris()X=pd.DataFrame(data=dataset["data"],columns=dataset["feature_names"])y=pd.Series(dataset["target"])# Ask plumber to find the best machine learning pipeline it# can for the problem in 60 seconds.plumber=SKPlumber(problem="classification",budget=60)plumber.fit(X,y)# To use the best found machine learning pipeline on unseen data:predictions=plumber.predict(unseen_X)PipelineTheskplumber.pipeline.Pipelineclass is a slightly lower level API for the package that can be used to build, fit, and predict arbitrarily shaped machine learning pipelines. For example, we can create a basic single level stacking pipeline, where the output from predictors are fed into another predictor to ensemble in a learned way:fromskplumberimportPipelinefromskplumber.primitivesimporttransformers,classifiersimportpandasaspdfromsklearn.datasetsimportload_irisdataset=load_iris()X=pd.DataFrame(data=dataset["data"],columns=dataset["feature_names"])y=pd.Series(dataset["target"])# A random imputation of missing values step and one hot encoding of# non-numeric features step are automatically added.pipeline=Pipeline()# Preprocess the inputspipeline.add_step(transformers["StandardScalerPrimitive"])# Save the pipeline step index of the preprocessor's outputsstack_input=pipeline.curr_step_i# Add three classifiers to the pipeline that all take the# preprocessor's outputs as inputsstack_outputs=[]forclf_namein["LinearDiscriminantAnalysisPrimitive","DecisionTreeClassifierPrimitive","KNeighborsClassifierPrimitive"]:pipeline.add_step(classifiers[clf_name],[stack_input])stack_outputs.append(pipeline.curr_step_i)# Add a final classifier that takes the outputs of all the previous# three classifiers as inputspipeline.add_step(classifiers["RandomForestClassifierPrimitive"],stack_outputs)# Train the pipelinepipeline.fit(X,y)# Have fitted pipeline make predictionspipeline.predict(X)Package OpinionsA pipeline's final step must be the step that produces the pipeline's final output.All missing values are imputed.All columns of typeobjectandcategoryare one hot encoded.