学习机用皮带

wolvr的Python项目详细描述


BuildTestPythonVersionPyPi_versionDownloadsLicense

高级机器学习实用程序库模块

安装

pip install wolvr

例1:naivebayes

^{pr2}$

所选输出:

This demo uses a public dataset of SMS spam, which has a total of 5574 messages = 747 spam and 4827 ham (legitimate).
The goal is to use 'term frequency in message' to predict whether the message is ham (class=0) or spam (class=1).

Using a grid search and a multinomial naive bayes classifier, the best hyperparameters were found as following:
   Step1: Tokenizing text: CountVectorizer(analyzer = 'word', ngram_range = (1, 1));
   Step2: Transforming from occurrences to frequency: TfidfTransformer(use_idf = True).

The top 2 terms with highest probability of a message being a spam (the classification is either spam or ham):
   "claim": 80.73%
   "prize": 80.06%

Application example:
   - Message: "URGENT! We are trying to contact U. Todays draw shows that you have won a 2000 prize GUARANTEED. Call 090 5809 4507 from a landline. Claim 3030. Valid 12hrs only."
   - Probability of class=1 (spam): 98.32%
   - Classification: spam
image_naive_bayes_confusion_matrix
^{tb2}$

例2:k-最近邻

fromwolvrimportkNNkNN.demo("Social_Network_Ads")

所选输出:

This demo uses a public dataset of Social Network Ads, which is used to determine what audience a car company should target in its ads in order to sell a SUV on a social network website.

Using a grid search and a kNN classifier, the best hyperparameters were found as following:
   Step1: scaler: StandardScaler(with_mean=True, with_std=True);
   Step2: classifier: kNN_classifier(n_neighbors=8, weights='uniform', p=1.189207115002721, metric='minkowski').
image_kNN_confusion_matriximage_kNN_decision_boundary_testing_set
image_kNN_ROC_curveimage_kNN_PR_curve

例3:决策边界比较

fromwolvrimportkNNkNN.demo("Social_Network_Ads")fromwolvrimportnaive_bayesasnbnb.demo("Social_Network_Ads")fromwolvrimportSVMSVM.demo("Social_Network_Ads")
image_kNN_decision_boundary_testing_setimage_Gaussian_NB_decision_boundary_testing_set
image_SVM_decision_boundary_testing_set

模块:模型评估

functiondescription
plot_confusion_matrix()plots the confusion matrix, along with key statistics, and returns accuracy
plot_ROC_curve()plots the ROC (Receiver Operating Characteristic) curve, along with statistics
plot_PR_curve()plots the precision-recall curve, along with statistics
plot_ROC_and_PR_curves()plots both the ROC and the precision-recall curves, along with statistics
demo()provides a demo of the major functions in this module

模块:Naivey_bayes

functiondescription
naive_bayes_Bernoulli()when X are independent binary variables (e.g., whether a word occurs in a document or not)
naive_bayes_multinomial()when X are independent discrete variables with 3+ levels (e.g., term frequency in the document)
naive_bayes_Gaussian()when X are continuous variables
demo()provides a demo of selected functions in this module

模块:kNN

functiondescription
demo()provides a demo of selected functions in this module

模块:神经网络

functiondescription
rnn()Recurrent neural network
demo()provides a demo of selected functions in this module

模块:决策树

functiondescription
boost()Boosting
demo()provides a demo of selected functions in this module

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
使用多个参数的枚举   从Oracle到Redis的java复制表   java如何保护tomcat服务器中的db用户名和密码。xml   java如何使用注册密钥保护移动应用程序?   java在什么情况下超类不应该是抽象的?   java Backspace键在macOS上的Scala REPL中不起作用   arduino Java+Uno+RFID:调用方法读取Java中的RFID   带有where语句中集合的java JPA查询   java如何向基于Tyrus注释的客户端添加请求头   java对我的二进制搜索算法的反馈   java重新访问数据库时文件的内容不正确   用户在字符串中输入值后退出While循环(Java)   java如何在Maven中的多个项目之间共享项目依赖关系?   java Close从未在数据库上被明确调用   在java中从文件读入布尔矩阵   Java:如何使用父节点将XML流拆分为小型XML文档。VTDXML