Package: palma
Project for Automated Learning MAchineThis library aims at providing tools for an automatic machine learning approach.
As many tools already exist to establish one or the other component of an AutoML
approach, the idea of this library is to provide a structure rather than to
implement a complete service.
In this library, a broad definition of AutoML is used : it covers the
optimization of hyperparameters, the historization of models, the analysis
of performances etc. In short, any element that can be replicated and that must,
in most cases, be included in the analysis results of the models.
Also, thanks to the use of components, this
library is designed to be modular and allows the user to add his own
analyses.It therefore contains the following elementsA vanilla approach described below (in basic usage section) and in the notebooksclassificationandregressionA collection ofcomponentsthat can be added to enrich
analysisInstall it withpython-mpipinstallpalmaDocumentationAccess thefull documentation here.Basic usageStart your projectTo start using the library, use the project classimportpandasaspdfromsklearnimportmodel_selectionfromsklearn.datasetsimportmake_classificationfrompalmaimportProjectX,y=make_classification(n_informative=2,n_features=100)X,y=pd.DataFrame(X),pd.Series(y).astype(bool)project=Project(problem="classification",project_name="default")project.start(X,y,splitter=model_selection.ShuffleSplit(n_splits=10,random_state=42),)The instantiation defines the type of problem and thestartmethod will set
what is needed to carry out ML project :A testing strategy (argumentsplitter). That will define train and test
instances.
Note that we use cross validator from sklearn to do that. In the
optimisation of hyper-parameters, a train test split will be operated, in this
case, the first split will be used.
This implies for instance that if you want 80/20 splitting method that shuffle
the dataset, you should usesplitter=model_selection.ShuffleSplit(n_splits=5,random_state=42)Training dataXand targetyRun hyper-optimisationThe hyper-optimisation process will look for the best model in pool of models
that tend to perform well on various problem.
For this specific task we make use of FLAML module. After hyper parametrisation,
the metric to track can be computedfrompalmaimportModelSelectorms=ModelSelector(engine="FlamlOptimizer",engine_parameters=dict(time_budget=30))ms.start(project)print(ms.best_model_)Tailoring and analysing your estimatorfrompalmaimportModelEvaluationfromsklearn.ensembleimportRandomForestClassifier# Use your ownmodel=ModelEvaluation(estimator=RandomForestClassifier())model.fit(project)# Get the optimized estimatormodel=ModelEvaluation(estimator=ms.best_model_)model.fit(project)ContributingYou are very welcome to contribute to the project, by requesting features,
pointing out new tools that can be added as component, by identifying issues and creating new features.
Development guidelines will be detailed in near future.Fork the repositoryClone your forked repositorygit clone https://github.com/$USER/palma.gitTest using pytestpip install pytest; pytest tests/Submit you work with a pull request.AuthorsEurobios Mews Labs