Package: mlblocks
An Open Source Project from theData to AI Lab, at MITPipelines and Primitives for Machine Learning and Data Science.MLBlocksDocumentation:https://mlbazaar.github.io/MLBlocksGithub:https://github.com/MLBazaar/MLBlocksLicense:MITDevelopment Status:Pre-AlphaOverviewMLBlocks is a simple framework for composing end-to-end tunable Machine Learning Pipelines by
seamlessly combining tools from any python library with a simple, common and uniform interface.Features include:Build Machine Learning Pipelines combiningany Machine Learning Library in Python.Access a repository with hundreds of primitives and pipelines ready to be used with little to
no python code to write, carefully curated by Machine Learning and Domain experts.Extract machine-readable information about which hyperparameters can be tuned and within
which ranges, allowing automated integration with Hyperparameter Optimization tools likeBTB.Complex multi-branch pipelines and DAG configurations, with unlimited number of inputs and
outputs per primitive.Easy save and load Pipelines using JSON Annotations.InstallRequirementsMLBlockshas been developed and tested onPython 3.6, 3.7, 3.8, 3.9, and 3.10Install withpipThe easiest and recommended way to installMLBlocksis usingpip:pipinstallmlblocksThis will pull and install the latest stable release fromPyPi.If you want to install from source or contribute to the project please read theContributing Guide.MLPrimitivesIn order to be usable, MLBlocks requires a compatible primitives library.The official library, required in order to follow the following MLBlocks tutorial,
isMLPrimitives, which you can install
with this command:pipinstallmlprimitivesQuickstartBelow there is a short example about how to useMLBlocksto solve theAdult Census
Datasetclassification problem using a
pipeline which combines primitives fromMLPrimitives,scikit-learnandxgboost.importpandasaspdfrommlblocksimportMLPipelinefromsklearn.model_selectionimporttrain_test_splitfromsklearn.metricsimportaccuracy_scoredataset=pd.read_csv('http://mlblocks.s3.amazonaws.com/census.csv')label=dataset.pop('label')X_train,X_test,y_train,y_test=train_test_split(dataset,label,stratify=label)primitives=['mlprimitives.custom.preprocessing.ClassEncoder','mlprimitives.custom.feature_extraction.CategoricalEncoder','sklearn.impute.SimpleImputer','xgboost.XGBClassifier','mlprimitives.custom.preprocessing.ClassDecoder']pipeline=MLPipeline(primitives)pipeline.fit(X_train,y_train)predictions=pipeline.predict(X_test)accuracy_score(y_test,predictions)What's Next?If you want to learn more about how to tune the pipeline hyperparameters, save and load
the pipelines using JSON annotations or build complex multi-branched pipelines, please
check ourdocumentation site.Also do not forget to have a look at thenotebook tutorials!Citing MLBlocksIf you use MLBlocks for your research, please consider citing our related papers.For the current design of MLBlocks and its usage within the largerMachine Learning Bazaarproject at
the MIT Data To AI Lab, please see:Micah J. Smith, Carles Sala, James Max Kanter, and Kalyan Veeramachaneni."The Machine Learning Bazaar:
Harnessing the ML Ecosystem for Effective System Development."arXiv
Preprint 1905.08942. 2019.@article{smith2019mlbazaar,author={Smith, Micah J. and Sala, Carles and Kanter, James Max and Veeramachaneni, Kalyan},title={The Machine Learning Bazaar: Harnessing the ML Ecosystem for Effective System Development},journal={arXiv e-prints},year={2019},eid={arXiv:1905.08942},pages={arXiv:1905.08942},archivePrefix={arXiv},eprint={1905.08942},}For the first MLBlocks version from 2015, designed for only multi table, multi entity temporal data, please
refer to Bryan Collazo’s thesis:Machine learning blocks.
Bryan Collazo. Masters thesis, MIT EECS, 2015.With recent availability of a multitude of libraries and tools, we decided it was time to integrate
them and expand the library to address other data types: images, text, graph, time series and
integrate with deep learning libraries.Changelog0.6.1 - 2023-09-26Add python 3.11 to MLBlocks -Issue #143by @sarahmish0.6.0 - 2023-04-14Support python 3.9 and 3.10 -Issue #141by @sarahmish0.5.0 - 2023-01-22Updatenumpydependency and isolate tests -Issue #139by @sarahmish0.4.1 - 2021-10-08Update NumPy dependency -Issue #136by @sarahmishSupport dynamic inputs and outputs -Issue #134by @pvk-developer0.4.0 - 2021-01-09Stop pipeline fitting after the last block -Issue #131by @sarahmishAdd memory debug and profiling -Issue #130by @pvk-developerUpdate Python support -Issue #129by @csalaGet execution time for each block -Issue #127by @sarahmishAllow loading a primitive or pipeline directly from the JSON path -Issue #114by @csalaPipeline Diagrams -Issue #113by @erica-chiuGet Pipeline Inputs -Issue #112by @erica-chiu0.3.4 - 2019-11-01Ability to return intermediate context -Issue #110by @csalaSupport for static or class methods -Issue #107by @csala0.3.3 - 2019-09-09Improved intermediate outputs management -Issue #105by @csala0.3.2 - 2019-08-12Allow passing fit and produce arguments asinit_params-Issue #96by @csalaSupport optional fit and produce args and arg defaults -Issue #95by @csalaIsolate primitives from their hyperparameters dictionary -Issue #94by @csalaAdd functions to explore the available primitives and pipelines -Issue #90by @csalaAdd primitive caching -Issue #22by @csala0.3.1 - Pipelines DiscoverySupport flat hyperparameter dictionaries -Issue #92by @csalaLoad pipelines by name and register them asentry_points-Issue #88by @csalaImplement partial re-fit -Issue #61by @csalaMove argument parsing to MLBlock -Issue #86by @csalaAllow getting intermediate outputs -Issue #58by @csala0.3.0 - New Primitives DiscoveryNew primitives discovery system based onentry_points.Conditional Hyperparameters filtering in MLBlock initialization.Improved logging and exception reporting.0.2.4 - New Datasets and Unit TestsAdd a new multi-table dataset.Add Unit Tests up to 50% coverage.Improve documentation.Fix minor bug in newsgroups dataset.0.2.3 - Demo DatasetsAdd new methods to Dataset class.Add documentation for the datasets module.0.2.2 - MLPipeline Load/SaveImplement save and load methods for MLPipelinesAdd more datasets0.2.1 - New DocumentationAdd mlblocks.datasets module with demo data download functions.Extensive documentation, including multiple pipeline examples.0.2.0 - New MLBlocks APIA new MLBlocks API and Primitive format.This is a summary of the changes:Primitives JSONs and Python code has been moved to a different repository, called MLPrimitivesOptional usage of multiple JSON primitive folders.JSON format has been changed to allow more flexibility and features:input and output arguments, as well as argument types, can be specified for each methodboth classes and function as primitives are supportedmultitype and conditional hyperparameters fully supporteddata modalities and primitive classifiers introducedmetadata such as documentation, description and author fields addedParsers are removed, and now the MLBlock class is responsible for loading and reading the
JSON primitive.Multiple blocks of the same primitive are supported within the same pipeline.Arbitrary inputs and outputs for both pipelines and blocks are allowed.Shared variables during pipeline execution, usable by multiple blocks.0.1.9 - Bugfix ReleaseDisable some NetworkX functions for incompatibilities with some types of graphs.0.1.8 - New primitives and some improvementsImprove the NetworkX primitives.Add String Vectorization and Datetime Featurization primitives.Refactor some Keras primitives to work with single dimensionyarrays and be compatible withpickle.Add XGBClassifier and XGBRegressor primitives.Add somekeras.applicationspretrained networks as preprocessing primitives.Add helper class to allow function primitives.0.1.7 - Nested hyperparams dictsSupport passing hyperparams as nested dicts.0.1.6 - Text and Graph PipelinesAdd LSTM classifier and regressor primitives.Add OneHotEncoder and MultiLabelEncoder primitives.Add several NetworkX graph featurization primitives.Addcommunity.best_partitionprimitive.0.1.5 - Collaborative Filtering PipelinesAdd LightFM primitive.0.1.4 - Image pipelines improvedAllow passinginit_paramsonMLPipelinecreation.Fix bug with MLHyperparam types and Keras.Renameproduce_paramsaspredict_params.Add SingleCNN Classifier and Regressor primitives.Simplify and improve Trivial Predictor0.1.3 - Multi Table pipelines improvedImprove RandomForest primitive rangesImprove DFS primitiveAdd Tree Based Feature Selection primitivesFix bugs in TrivialPredictorImproved documentation0.1.2 - Bugfix releaseFix bug in TrivialMedianPredictorFix bug in OneHotLabelEncoder0.1.1 - Single Table pipelines improvedNew project structure and primitives for integration into MIT-TA2.MIT-TA2 default pipelines and single table pipelines fully working.0.1.0First release on PyPI.