current position:Home>Python libraries you may not know

Python libraries you may not know

2022-01-30 13:55:03 DebugUsery

You may not know Python library

In this article , I put forward some things that many people don't know Python A rare Library in . These libraries are excellent at performing specific tasks . therefore , It's good to have some contact with them .

Let's get started !

1. Pattern

This Python library Pattern It's an open source library , For natural language processing 、 Network mining and data analysis tasks based on machine learning . The main focus of this library is its ease of use for users .

This library can perform various tasks , Such as Text processing data mining And from various sources Extract the data . The syntax of this library is very simple and clear . therefore , Users with both scientific and non scientific backgrounds can easily use it .

Installation method

pip install pattern
 Copy code 

Example

from pattern.en import sentiment
 Copy code 

Emotional scores and subjectivity have been returned as output .

The emotional score of a given sentence is 0.75, This means that it is a highly positive sentence . Subjectivity 0.8 It means that the given sentence is the user's personal opinion .

2.Eli5

Eli5 It's a useful Python library , It is used to debug and check machine learning classifiers and interpret the prediction results of these classifiers . It supports various machine learning packages and frameworks , Such as Kerasscikit-learnLightGBMXGBoostCatBoost etc. .

There are two ways to understand machine learning models using this library .

  1. Understand the weight of the model by analyzing the weight of the model global performance .
  2. By analyzing the prediction of a single sample to understand the accuracy of the model local performance .

Installation method .

pip install eli5
 Copy code 

3.CatBoost

stay Python in ,CatBoost By Yandex An open source machine learning algorithm developed by the company .CatBoost It's made up of two words ,Category and Boosting.

This library can be used to process different types of data , Such as images 、 Text 、 Audio and other classified data .Boost It means that this library is based on gradient lifting Library , Compared with other lifting algorithms, such as XGBoost It works the same way .

The advantage of this library is that it can provide... Without adjusting parameters High accuracy , And it also provides GPU Support To speed up training .

Installation method

pip install catboost
 Copy code 

Example

import numpy as npfrom catboost import CatBoost, Pool
 Copy code 

This is how we use this algorithm to predict .

4.Bokeh

Bokeh yes Python A data visualization Library in , Used to create interactive charts 、 Drawing and graphics . The output and visualization of this library can be used in various media , Such as Notebook、HTML and Flask, And based on Django Internet applications .

adopt Boken, We can create various visualizations , From simple diagrams to complex and high-end dashboards . It also allows us to write without JavaScript Code created by JavaScript Driven Visualization .

Installation method

pip install bokeh
 Copy code 

Example

from bokeh.plotting import figure, output_notebook, show
 Copy code 

Output

The picture is provided by the author

use Bokeh Visualization is quite simple and direct .

5.StatsModels

This StatsModels Library is one of the most useful modules for statistical analysis of data . This library allows users to perform statistical tests and explore data .

This library is built on Numpy and Scipy On top of the library . If you want to analyze the data and estimate the statistical model , This library is a good tool .

Installation method

pip install statsmodels
 Copy code 

Example

import numpy as npimport statsmodels.api as sm
 Copy code 

Output

6.SpaCy

spaCy It's a Python Open source library , Natural language processing for analyzing and processing data . It has many built-in functions , Because it uses Cython Compiling . It has user-friendly API, It's very simple to use .

Installation method

pip install -U pip setuptools wheel
 Copy code 

Example

We will look at... Through an example of discourse tagging spaCy Operating condition . Voice part or PoS Tagging is a common task in natural language processing .

import spacy nlp = spacy.load('en_core_web_sm')
 Copy code 

Output

Apple --> PROPN is --> AUX the --> DET first --> ADJ U.S. --> PROPN public --> ADJ company --> NOUN to --> PART reach --> VERB a --> DET $ --> SYM 1 --> NUM trillion --> NUM market --> NOUN value --> NOUN
 Copy code 

Conclusion

That's all for this article . In this article , We discussed some that are not very popular but are useful for performing specific tasks Python library .

These libraries are for those who Python Programming doesn't have much contact with its library , But it's also convenient for people who want to perform specific tasks . Because the syntax of these libraries is simple and clear , So it's very convenient for them .

Thanks for reading !

copyright notice
author[DebugUsery],Please bring the original link to reprint, thank you.
https://en.pythonmana.com/2022/01/202201301355000242.html

Random recommended