Create a complex Machine Learning model in one line with Libra

栏目: IT技术 · 发布时间: 4年前

内容简介:So, what exactly is this Libra package? According to their statement, it is a machine learning API to let us build and deploy machine learning in just one line of code. How neat is that!Moreover, Target detection, preprocessing, and scoring are done by def

Libra

So, what exactly is this Libra package? According to their statement, it is a machine learning API to let us build and deploy machine learning in just one line of code. How neat is that!

Moreover, Target detection, preprocessing, and scoring are done by default. What we only need to do is selecting the model and input the data.

Let’s just try how it works.

Before we are installing our Libra package, we need to have Python 3.6 version or higher installed. Anything lower than that would not work. To install the package, we just need to run the following code in the command prompt.

pip install libra

After you have done installing the package, we would try how is the package works. Let’s set up all the necessary things we would use. First, for the purpose of our learning, I would use the dataset from Kaggle about education here . The following image is the data information.

Create a complex Machine Learning model in one line with Libra

Now, let’s say that we want to create a prediction model to classify the Class columns. Using Libra, it makes all things easier.

#The only thing we need to importfrom libra import client

In Libra, the dataset is still needed to be read from the external; say, CSV files. That is why we would create a client class that reads the file directly.

#Creating a client object that read the data to create the prediction modeledu_client = client('xAPI-Edu-Data.csv')

The above codes are all we need; The next part is more like querying the model in the way that we want and get the result immediately.

Currently, the only machine learning model present in Libra is:

  • Neural Network
  • Convolutional Neural Network
  • Support Vector Machine
  • Nearest Neighbors
  • Decision Tree
  • K-Means Clustering

And several Natural Language Processing , including:

  • Text Classification
  • Document Summarization
  • Image Caption Generation

Although, for our case, we only would try using the Neural Network model. Let’s try to create the prediction model then. In order to create a prediction model, we need to call the machine learning we want from the client method.

In our example, it would be .neural_network_query accepting a text in the parameter. The query we pass is a simple English text, such as ‘classify the class’ or ‘estimate accurately the StudentAbsenceDays’ . What is important is the target column; you need to specify it in the query. After that, the API would predict whether it is a classification or regression problem. Let’s see in the example below.

#Creating the model by simple query, for example classify the class. Using Libra, you would need to specify which column you want as the target and the rest would be preprocessed automaticallyedu_client.neural_network_query('classify the class')

Create a complex Machine Learning model in one line with Libra

Just using a simple query, the model is preprocessed automatically, and the learning process is initiated. Furthermore, all the repetition processes and the metrics also present immediately.

Create a complex Machine Learning model in one line with Libra

Additionally, the model presents us with the accuracy and model loss plot during each epoch.

If you want to know all the parameters you could pass in the model, please consult the API guide here .


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

实用程序育儿法

实用程序育儿法

(美)特蕾西·霍格、(美)梅林达·布劳 / 张雪兰 / 北京联合出版社 / 2009-1 / 39.00元

《实用程序育儿法》作者世界闻名的实战型育儿专家特蕾西·霍格(Tracy Hogg)以“宝宝耳语专家(Baby Whisperer)”享誉全球,她深入到数千名宝宝的家里解决宝宝和妈妈面临的日常难题,通过演讲、电台、电视台、信件、电子邮件以及住她的网站上发帖跟她交流、向她请教的妈妈们更是不计其数。由她亲自实景示范拍摄的“和宝宝说悄悄话(Thc Baby Whisperer)”DVD全球发行上千万张。她......一起来看看 《实用程序育儿法》 这本书的介绍吧!

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试