Package: creme
cremeis a Python library foronline machine learning. All the tools in the library can be updated with a single observation at a time, and can therefore be used tolearn from streaming data.⚡️QuickstartAs a quick example, we'll train a logistic regression to classify thewebsite phishing dataset. Here's a look at the first observation in the dataset.>>>frompprintimportpprint>>>fromcremeimportdatasets>>>X_y=datasets.Phishing()# this is a generator>>>forx,yinX_y:...pprint(x)...print(y)...break{'age_of_domain':1,'anchor_from_other_domain':0.0,'empty_server_form_handler':0.0,'https':0.0,'ip_in_url':1,'is_popular':0.5,'long_url':1.0,'popup_window':0.0,'request_from_other_domain':0.0}TrueNow let's run the model on the dataset in a streaming fashion. We sequentially interleave predictions and model updates. Meanwhile, we update a performance metric to see how well the model is doing.>>>fromcremeimportcompose>>>fromcremeimportlinear_model>>>fromcremeimportmetrics>>>fromcremeimportpreprocessing>>>model=compose.Pipeline(...preprocessing.StandardScaler(),...linear_model.LogisticRegression()...)>>>metric=metrics.Accuracy()>>>forx,yinX_y:...y_pred=model.predict_one(x)# make a prediction...metric=metric.update(y,y_pred)# update the metric...model=model.fit_one(x,y)# make the model learn>>>metricAccuracy:89.20%🛠 Installationcremeis intended to work withPython 3.6 or above. Installation can be done withpip:pipinstallcremeThere arewheels availablefor Linux, MacOS, and Windows, which means that in most cases you won't have to buildcremefrom source.You can install the latest development version from GitHub as so:pipinstallgit+https://github.com/creme-ml/creme--upgradeOr, through SSH:pipinstallgit+ssh://git@github.com/creme-ml/creme.git--upgrade🧠 PhilosophyMachine learning is often done in a batch setting, whereby a model is fitted to a dataset in one go. This results in a static model which has to be retrained in order to learn from new data. In many cases, this isn't elegant nor efficient, and usually incursa fair amount of technical debt. Indeed, if you're using a batch model, then you need to think about maintaining a training set, monitoring real-time performance, model retraining, etc.Withcreme, we encourage a different approach, which is to continuously learn a stream of data. This means that the model process one observation at a time, and can therefore be updated on the fly. This allows to learn from massive datasets that don't fit in main memory. Online machine learning also integrates nicely in cases where new data is constantly arriving. It shines in many use cases, such as time series forecasting, spam filtering, recommender systems, CTR prediction, and IoT applications. If you're bored with retraining models and want to instead build dynamic models, then online machine learning (and thereforecreme!) might be what you're looking for.Here are some benefits of usingcreme(and online machine learning in general):Incremental: models can update themselves in real-time.Adaptive: models can adapt toconcept drift.Production-ready: working with data streams makes it simple to replicate production scenarios during model development.Efficient: models don't have to be retrained and require little compute power, whichlowers their carbon footprintFast: when the goal is to learn and predict with a single instance at a time, thencremeis a order of magnitude faster than PyTorch, Tensorflow, and scikit-learn.🔥 FeaturesLinear models with a wide array of optimizersNearest neighbors, decision trees, naïve BayesProgressive model validationModel pipelines as a first-class citizenAnomaly detectionRecommender systemsTime series forecastingImbalanced learningClusteringFeature extraction and selectionOnline statistics and metricsBuilt-in datasetsAndmuch more🔗 Useful linksDocumentationAPI referenceUser guideFAQChange historyBenchmarksIssue trackerPackage releases💬 MediaPyData Amsterdam 2019 presentation (slides,video)Toulouse Data Science presentationOnline/Incremental Learning with Keras and Cremeon pyimagesearchMachine learning for streaming data with cremeon Medium👍 ContributingFeel free to contribute in any way you like, we're always open to new ideas and approaches. If you want to contribute to the code base please check out theCONTRIBUTING.md file. Also take a look at theissue trackerand see if anything takes your fancy.This project follows theall-contributorsspecification. Again, contributions of any kind are welcome!Max Halford📆💻AdilZouitine💻Raphael Sourty💻Geoffrey Bolmier💻vincent d warmerdam💻VaysseRobin💻Lygon Bowen-West💻Florent Le Gac💻Adrian Rosebrock📝Jovan Veljanoski💻Dimitri💻Gaurav Sharma💻📝 Licensecremeis free and open-source software licensed under the3-clause BSD license.