scikit keras_Scikit学习,TensorFlow,PyTorch,Keras…但是天秤座呢?
scikit keras
Welcome all! In the first episode of this series, I investigated the four most known machine learning frameworks and discussed which of these you should learn depending on your needs and goals.
w ^迎閱讀所有! 在本系列的第一集中 ,我研究了四種最著名的機(jī)器學(xué)習(xí)框架,并討論了根據(jù)您的需求和目標(biāo)應(yīng)該學(xué)習(xí)的機(jī)器學(xué)習(xí)框架。
Of course, we all know how PyTorch and TensorFlow are overwhelmingly effective and thorough when it comes to building deep learning algorithms from scratch. Similarly, Scikit-learn comes with excellent non-neural solutions and a whole lot of convenient data processing and evaluation functions.
當(dāng)然,當(dāng)我們從頭開始構(gòu)建深度學(xué)習(xí)算法時(shí),我們都知道PyTorch和TensorFlow如何具有壓倒性的優(yōu)勢(shì)和全面性。 同樣, Scikit-learn具有出色的非神經(jīng)解決方案以及大量便捷的數(shù)據(jù)處理和評(píng)估功能。
Today, I would like to draw your attention to something different: a rising machine learning framework, Libra, that absolutely deserves your attention and has tripled its amount of GitHub stars in only a week (reaching 1.8K)!
今天,我想提請(qǐng)您注意一些不同的東西:新興的機(jī)器學(xué)習(xí)框架Libra絕對(duì)值得您的注意,并且在短短一周內(nèi)將GitHub star的數(shù)量增加了兩倍(達(dá)到1.8K)!
In this article, I will cover:
在本文中,我將介紹:
The basic concept of the framework
框架的基本概念
The interesting features I spotted
我發(fā)現(xiàn)的有趣功能
The expected downsides
預(yù)期的缺點(diǎn)
A concrete use example
具體的使用示例
一,基本概念 (I. Base Concept)
Libra is an easy-to-use machine learning framework that will allow you to load data, process it, train models and visualize results with only a few lines of code.
Libra是一個(gè)易于使用的機(jī)器學(xué)習(xí)框架,使您僅需幾行代碼即可加載數(shù)據(jù),處理數(shù)據(jù),訓(xùn)練模型并可視化結(jié)果。
The major advantage of this framework is its user-friendliness and beginner-friendliness. The diagram below shows about how fast you can setup an ML project compared to more common frameworks:
這個(gè)框架的主要優(yōu)點(diǎn)是它的用戶友好性和初學(xué)者友好性 。 下圖顯示了與更常見的框架相比,您可以更快地設(shè)置ML項(xiàng)目:
https://libradocs.github.io/https://libradocs.github.io/This literally means that you can come with no or nearly no technical machine learning knowledge and implement a full project in about 5 minutes.
從字面上看,這意味著您可能沒(méi)有或幾乎沒(méi)有任何機(jī)器學(xué)習(xí)知識(shí),而僅需5分鐘即可實(shí)現(xiàn)一個(gè)完整的項(xiàng)目。
The library is built for Python (?3.6) and revolves around a Client object that will handle your data but also the models you want to build, inference, plotting, etc.
該庫(kù)是為Python(?3.6)構(gòu)建的,圍繞一個(gè)Client對(duì)象運(yùn)行,該對(duì)象不僅可以處理數(shù)據(jù),還可以處理要構(gòu)建,推斷,繪制等的模型。
You can easily install and initialize the library in a project with only lines of code: first, you need to install Libra and all the dependencies in your environment with pip install libra. Next, simply write from libra import client in a Python file and you’re all set!
您只需使用幾行代碼即可輕松地在項(xiàng)目中安裝和初始化該庫(kù):首先,您需要使用pip install libra安裝Libra以及環(huán)境中的所有依賴項(xiàng)。 接下來(lái),只需from libra import client編寫一個(gè)Python文件即可,一切就緒!
二。 有趣的功能 (II. Interesting Features)
Photo by Tim Mossholder on Unsplash Tim Mossholder在Unsplash上拍攝的照片The first interesting feature I noticed is that some “queries” try to infer what is asked of them: for example, if you call a neural_network_query(), the only required argument is a quick explanation of what you want to do, like “please model the median number of households”.
我注意到的第一個(gè)有趣的功能是一些“查詢” 嘗試推斷出他們的要求 :例如,如果您調(diào)用Neuro_network_query() ,則唯一需要的參數(shù)是對(duì)您想做什么的快速說(shuō)明,例如“請(qǐng)模擬住戶中位數(shù)”。
The target variable in your data will then be determined through the parsing of your explanation and computing the levenshtein distance on the column names.
然后,將通過(guò)解析您的解釋并計(jì)算列名上的levenshtein區(qū)別來(lái)確定數(shù)據(jù)中的目標(biāo)變量。
Kind of cool, right?
有點(diǎn)酷吧?
Moreover, you can simply load your .csv data file and it will automatically be handled in a Pandas DataFrame and preprocessed for you during the query, which is convenient if you want fast results!
此外,您只需加載.csv數(shù)據(jù)文件,它將在Pandas DataFrame中自動(dòng)處理并在查詢過(guò)程中為您進(jìn)行預(yù)處理,如果您想要快速的結(jié)果,這將非常方便!
The fact that Libra relies on other machine learning libraries means that all ML tasks are virtually doable. Here is a list of the currently available queries, and includes Feedforward NN, CNN, SVM, Text generation, Sentiment analysis, etc.
Libra依賴于其他機(jī)器學(xué)習(xí)庫(kù)這一事實(shí)意味著所有ML任務(wù)實(shí)際上都是可行的。 這是當(dāng)前可用查詢的列表,包括前饋NN,CNN,SVM,文本生成,情感分析等。
When you fine tune a model in with the Libra client, the evaluation results and plots are automatically displayed for you. Here is an example where I tried to predict sentiment scores of tweets from this Kaggle dataset using a simple neural network:
當(dāng)您使用Libra客戶端微調(diào)模型時(shí),評(píng)估結(jié)果和圖將自動(dòng)為您顯示。 這是一個(gè)示例,我嘗試使用簡(jiǎn)單的神經(jīng)網(wǎng)絡(luò)從該Kaggle數(shù)據(jù)集中預(yù)測(cè)推文的情感評(píng)分:
The project is growing pretty fast and even though the core development has been done, you can put your skills to use and contribute by adding missing bits of code and correcting bugs!
該項(xiàng)目正在Swift發(fā)展,即使完成了核心開發(fā),您也可以通過(guò)添加缺少的代碼并更正錯(cuò)誤來(lái)利用和貢獻(xiàn)自己的技能!
三, 缺點(diǎn) (III. Downsides)
Photo by Bernard Hermant on Unsplash照片由Bernard Hermant在Unsplash上拍攝The major downside you will experience with an ML framework that is so beginner-friendly is process over-simplification: by providing such high-level wrapping techniques, you sort of lose the sense of control over what is happening.
ML框架對(duì)初學(xué)者非常友好,這將給您帶來(lái)的主要缺點(diǎn)是過(guò)分簡(jiǎn)化了流程 :通過(guò)提供這種高級(jí)包裝技術(shù),您會(huì)失去對(duì)正在發(fā)生的事情的控制感。
For example, when using the “neural network query”, the number of distinct target variables in your data will determine if a classification or regression task will be performed, and you will not have a choice in the neural net’s architecture details.
例如,當(dāng)使用“神經(jīng)網(wǎng)絡(luò)查詢”時(shí),數(shù)據(jù)中不同目標(biāo)變量的數(shù)量將確定是否要執(zhí)行分類或回歸任務(wù),并且您將無(wú)法選擇神經(jīng)網(wǎng)絡(luò)的體系結(jié)構(gòu)詳細(xì)信息。
As of today (August 2020), Libra is still being developed by the creators and the community, meaning that a lot of bugs appear here and there, which can be discouraging at first.
截至今天(2020年8月),天秤座仍由創(chuàng)作者和社區(qū)開發(fā),這意味著到處都會(huì)出現(xiàn)許多錯(cuò)誤 ,一開始可能會(huì)令人沮喪。
Even though Libra is a relatively new machine learning framework, it hasn’t (yet) re-invented the wheel, and relies on popular libraries like Keras, Transformers, Scikit-learn and NLTK. This mainly means that the number of hard dependencies is quite high, and can be an issue if you like to keep a light environment.
盡管Libra是一個(gè)相對(duì)較新的機(jī)器學(xué)習(xí)框架,但它(尚未)重新發(fā)明輪子,而是依賴于Keras,Transformers,Scikit-learn和NLTK等流行的庫(kù)。 這主要意味著硬依賴性的數(shù)量非常高 ,如果您希望保持一個(gè)輕量級(jí)的環(huán)境,則可能會(huì)成為一個(gè)問(wèn)題。
IV。 簡(jiǎn)單項(xiàng)目示例 (IV. Simple Project Example)
To show you how easy and fun it is to use Libra, let’s implement a small project together: based on the beginning of J.R.R Tolkien’s Silmarillion, we will generate new text with only 3 lines of code.
為了向您展示使用Libra是多么容易和有趣,讓我們一起實(shí)現(xiàn)一個(gè)小項(xiàng)目:基于JRR Tolkien的Silmarillion的開頭,我們將只用3行代碼生成新文本 。
from libra import clienttolkien_client = client('silma_beg.txt') tolkien_client.generate_text("generate some text please", return_sequences=1) print(tolkien_client.models['text_generation']['generated_text'])Libra will load GPT-2 from OpenAI and generate new text for us.
天秤座將從OpenAI加載GPT-2并為我們生成新文本。
In the following Gist, the first line is actually the input file I fed the network with. All the rest was automatically output by the model, and it’s pretty amazing!
在下面的要點(diǎn)中,第一行實(shí)際上是我為網(wǎng)絡(luò)提供的輸入文件。 其余的全部由模型自動(dòng)輸出,這真是太神奇了!
There was Eru, the One, who in Arda is called Ilúvatar; and he made first the Ainur, the Holy Ones, that were the offspring of his thought, and they were with him before aught else was made. And he spoke to them, propounding to them themes of music; and they sang before him, and he was glad. But for a long while they sang only each alone, or but few together, while the rest hearkened; for each comprehended only that part of me mind of Ilúvatar from which he came, and in the understanding of their brethren they grew but slowly. Yet ever as they listened they came to deeper understanding, and increased in unison and harmony. And the time came when they saw that, at last, by the love which the people gave her, there had been a way of getting over her by the love of her Creator. And they arose from their hiding place, and sought the land in the wilderness, and there they were put to the slaughter, for they were of the blood of the sons of Ilúvatar, and it was not easy to get over them. For those who had been left by their parents, as it were, had come to know the true nature of what they had done, and to believe that they had done what had been done, and that they had found the love of the Holy Ones; but Ilúvatar said to the other:Thy sons are born of the Father, and thou shalt have their hearts at my feet, and thou shalt have my prayers to thee in the heavens.And the angels said to Ilúvatar:Father, take these people, O Ilúvatar; make them come back.And Ilúvatar said unto them:Thou are worthy, O Ilúvatar, of these sons.And when they were come back to their hiding place, they were put to the slaughter; for they had seen that their father was not in the way of righteousness, but rather from a power of the Holy One, whom they saw the sons of Ilúvatar.And the angels, then, said unto Ilúvatar:The love of God, Ilúvatar, is strong and great; and thou shalt be glad, O Ilúvatar, if thou hast the Holy One with you. For there are few who ever have been so much as children, andThe model probably was pre-trained on the entire book, but the output grammar and generation relevance is nonetheless very good.
該模型可能已在整本書中進(jìn)行了預(yù)訓(xùn)練,但是輸出語(yǔ)法和生成相關(guān)性仍然非常好。
Photo by Alex Guillaume on Unsplash Alex Guillaume在Unsplash上拍攝的照片This is what Libra is about: creating with only a handful of lines of code. The opportunity to load, train, infer, evaluate and plot without prior extended knowledge.
這就是Libra的目的: 只用幾行代碼創(chuàng)建 。 在沒(méi)有事先擴(kuò)展知識(shí)的情況下進(jìn)行加載,訓(xùn)練,推斷,評(píng)估和繪圖的機(jī)會(huì)。
I hope you have enjoyed this article, thank you very much for reading through and make sure to try out this framework when you get the chance!
我希望您喜歡這篇文章,非常感謝您通讀,并確保在有機(jī)會(huì)的情況下嘗試使用此框架!
翻譯自: https://towardsdatascience.com/scikit-learn-tensorflow-pytorch-keras-but-what-about-libra-a5102c2d834d
scikit keras
總結(jié)
以上是生活随笔為你收集整理的scikit keras_Scikit学习,TensorFlow,PyTorch,Keras…但是天秤座呢?的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 为啥做梦老是梦到蛇
- 下一篇: 数据结构两个月学完_这是我作为数据科学家