日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程语言 > python >内容正文

python

python模型部署方法_终极开箱即用的自动化Python模型选择方法

發(fā)布時間:2023/12/15 python 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python模型部署方法_终极开箱即用的自动化Python模型选择方法 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

python模型部署方法

Choosing the best model is a key step after feature selection in any data science projects. This process consists of using the best algorithms (supervised, unsupervised) for obtaining the best predictions. Automate model selection methods for high dimensional datasets generally include Libra and Pycaret. A unicorn data-scientist needs to master the most advanced Automate model selections methods. In this article, we will review the 2 best Kaggle winners’ Automate model selections methods which can be implemented in short python codes.

在任何數(shù)據(jù)科學(xué)項目中選擇特征之后,選擇最佳模型都是關(guān)鍵的一步。 此過程包括使用最佳算法(有監(jiān)督,無監(jiān)督)來獲得最佳預(yù)測。 用于高維數(shù)據(jù)集的自動模型選擇方法通常包括LibraPycaret 。 獨角獸數(shù)據(jù)科學(xué)家需要掌握最先進的自動模型選擇方法。 在本文中,我們將介紹2種最佳的Kaggle獲獎?wù)叩腁utomate模型選擇方法,這些方法可以用簡短的python代碼實現(xiàn)。

For this article, we will analyze the sample chocolate bar rating dataset you can find here.

對于本文,我們將分析示例巧克力條評級數(shù)據(jù)集,您可以在此處找到。

Photo by Klara Avsenik on Unsplash照片由Klara Avsenik在Unsplash上拍攝

A challenging dataset which after features selections contains 20 from 3400 features correlate to the target feature ‘review date’.

一個極具挑戰(zhàn)性的數(shù)據(jù)集,在特征選擇之后包含3400個特征中的20個,與目標(biāo)特征“審查日期”相關(guān)。

  • Libra

    天秤座

  • The challenge is to find the best performing combination of techniques so that you can minimize the error in your predictions. Libra provides out-of-the-box automated supervised machine learning that optimizes machine (or deep) learning pipelines, automatically searching for the best learning algorithms (Neural network, SVM, decision tree, KNN, etc) and best hyperparameters in seconds. Click here to see a complete list of estimators/models available in Libra.

    面臨的挑戰(zhàn)是找到性能最佳的技術(shù)組合,以使預(yù)測誤差最小。 Libra提供了開箱即用的自動監(jiān)督機器學(xué)習(xí),可優(yōu)化機器(或深度)學(xué)習(xí)管道,自動在幾秒鐘內(nèi)搜索最佳學(xué)習(xí)算法(神經(jīng)網(wǎng)絡(luò),SVM,決策樹,KNN等)和最佳超參數(shù)。 單擊此處查看天秤座中可用的估計器/模型的完整列表。

    Here an example predicting the review_date feature of the chocolate rating dataset, a complex multiclass classification (labels: 2006–2020).

    這是一個預(yù)測巧克力評分?jǐn)?shù)據(jù)集的review_date功能的示例,這是一個復(fù)雜的多類分類(標(biāo)簽:2006–2020)。

    #import libraries!pip install libra
    from libra import client#open the dataseta_client = client('../input/preprocess-choc/dfn.csv')
    print(a_client)#choose the modela_client.neural_network_query('review_date', epochs=20)
    a_client.analyze()Automate Neural network using Libra使用Libra自動化神經(jīng)網(wǎng)絡(luò)

    Libra result in a neural network with an accuracy before optimizations of 0.796 and after of 0.860 reducing overfitting from train/test = 0.796–0.764 (0.35) to train/test = 0.860–0.851 (0.009) resulting in the best numbers of neural network layers from 3 to 6.

    天秤座導(dǎo)致神經(jīng)網(wǎng)絡(luò)的精度在優(yōu)化之前為0.796,在優(yōu)化之后為0.860,減少了從訓(xùn)練/測試= 0.796–0.764(0.35)到訓(xùn)練/測試= 0.860–0.851(0.009)的過度擬合,從而獲得了最佳的神經(jīng)網(wǎng)絡(luò)層數(shù)從3到6。

    Photo by Nick Kavounidis on Unsplash 尼克·卡沃尼迪斯 ( Nick Kavounidis)在Unsplash上拍攝的照片

    2. Pycaret

    2. 皮卡雷

    PyCaret is simple and easy to use sequential pipeline including a well integrate preprocessing functions with hyperparameters tuning and train models ensembling.

    PyCaret是簡單易用的順序流水線,包括具有超參數(shù)調(diào)整和訓(xùn)練模型集成的良好集成的預(yù)處理功能。

    #import libraries!pip install pycaret
    from pycaret.classification import *#open the datasetdfn = pd.read_csv('../input/preprocess-choc/dfn.csv')#define target label and parametersexp1 = setup(dfn, target = 'review_date', feature_selection = True)Pycaret preprocessing functionsPycaret預(yù)處理功能

    All the preprocessing steps are applied within setup(). With more than 40 features to prepare data for machine learning including missing values imputation, categorical variable encoding, label encoding (converting yes or no into 1 or 0), and train-test-split are automatically performed when setup() is initialized. For more details about PyCaret’s preprocessing abilities Click here.

    所有預(yù)處理步驟都在setup()中應(yīng)用。 初始化setup()時,將自動執(zhí)行40多種功能來為機器學(xué)習(xí)準(zhǔn)備數(shù)據(jù),包括缺失值插補,分類變量編碼,標(biāo)簽編碼(將yes或no轉(zhuǎn)換為1或0)和train-test-split。 有關(guān)PyCaret預(yù)處理功能的更多詳細信息,請單擊此處 。

    Photo by toby otti on Unsplash照片由Toby otti在Unsplash上拍攝

    Pycaret makes model comparisons in one line, returning a table with k-fold cross-validated scores and algorithms scored metrics.

    Pycaret在一行中進行模型比較,返回一張帶有k倍交叉驗證得分和算法得分指標(biāo)的表格。

    compare_models(fold = 5, turbo = True)Best compare classifiers最佳比較分類器

    PyCaret has over 60 open-source ready-to-use algorithms. Click here to see a complete list of estimators/models available in PyCaret.

    PyCaret具有60多種開源即用型算法。 單擊此處查看PyCaret中可用的估算器/模型的完整列表。

    The tune_model function is used for automatically tuning hyperparameters of a machine learning model. PyCaret uses random grid search over a predefined search space. This function returns a table with k-fold cross-validated scores.

    tune_model函數(shù)用于自動調(diào)整機器學(xué)習(xí)模型的超參數(shù) PyCaret在預(yù)定義的搜索空間上使用隨機網(wǎng)格搜索 。 此函數(shù)返回具有k倍交叉驗證得分的表格。

    The ensemble_model function is used for ensembling trained models. It takes only trained model object returning a table with k-fold cross validated scores.

    ensemble_model函數(shù)用于組合訓(xùn)練后的模型。 它僅需要訓(xùn)練的模型對象返回具有k倍交叉驗證得分的表格。

    # creating a decision tree modeldt = create_model(dt)# ensembling a trained dt modeldt_bagged = ensemble_model(dt)#plot_model dtplot_model(estimator = dt, plot = 'learning')# plot_model dt_baggedplot_model(estimator = dt_bagged, plot = 'learning')Simple and bagging decisions tree evaluations metrics簡單而袋裝的決策樹評估指標(biāo)

    Performance evaluation and diagnostics of a trained machine learning model can be done using the plot_model function.

    可以使用plot_model函數(shù)對經(jīng)過訓(xùn)練的機器學(xué)習(xí)模型進行性能評估和診斷。

    #hyperparameters tunningtuned_dt = tune_model(dt,optimize = "Accuracy", n_iter = 500)#evaluate modelevaluate_model(estimator=tuned_dt)#plot tuned dt confusion matrixplot_model(tuned_dt, plot = 'confusion_matrix')Decision tree classifier evaluations methods using Pycaret使用Pycaret的決策樹分類器評估方法

    Finally, predict_model function can be used to predict unseen dataset.

    最后, predict_model函數(shù)可用于預(yù)測看不見的數(shù)據(jù)集。

    #predicting label on a new datasetpredictions = predict_model(dt)Review_date predictions using decision tree使用決策樹的Review_date預(yù)測 Photo by Element5 Digital on Unsplash Element5 Digital在Unsplash上拍攝的照片

    If you have some spare time I’d recommend, you’ll read this:

    如果您有空閑時間,建議您閱讀以下內(nèi)容:

    Sum Up

    總結(jié)

    Refer to these links :

    請參考以下鏈接:

    https://jovian.ml/yeonathan/libra

    https://jovian.ml/yeonathan/libra

    https://jovian.ml/yeonathan/pycaret

    https://jovian.ml/yeonathan/pycaret

    For complete algorithms selections of chocolate bar review date estimations using these 2 methods.

    對于完整的算法選擇,使用這兩種方法選擇巧克力棒的日期估計。

    This brief overview is a reminder of the importance of using the right algorithms selection methods in data science. This post has for scope to cover the 2 best Python automate algorithms selection methods for high dimensional datasets, as well as share useful documentation.

    這個簡短的概述提醒我們在數(shù)據(jù)科學(xué)中使用正確的算法選擇方法的重要性。 這篇文章的范圍涵蓋了針對高維數(shù)據(jù)集的2種最佳Python自動算法選擇方法,并分享了有用的文檔。

    Photo by Ingmar on Unsplash Ingmar在Unsplash上的照片

    I hope you enjoy it, keep exploring!

    希望您喜歡它,繼續(xù)探索!

    翻譯自: https://towardsdatascience.com/the-ultimate-out-of-the-box-automated-python-model-selection-methods-f2188472d2a

    python模型部署方法

    總結(jié)

    以上是生活随笔為你收集整理的python模型部署方法_终极开箱即用的自动化Python模型选择方法的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。