学习机用皮带

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第三方库


热门话题
构造函数的java条件调用   类Dog中的java构造函数Dog不能应用于给定类型   java jsch和运行“sudo su”   java将队列和堆栈相互复制   java如何在netbeans项目的文件夹中添加库   java While循环在我的代码中不存在   如何在XML中使用java方法的返回值   java是否可以在不写入文件的情况下将字符串/字节数组作为文件发布?   java为什么这些字符串不相等?   sockets客户机-服务器java编程,用户可选择   java如何在SpringMVC和hibernate中保存模型返回视图的列表   java如何修复组织。openqa。硒。WebDriverException:未知错误   Java,Ant错误:编码Cp1252的不可映射字符   JAVAlang.ClassCastException:[Ljava.lang.String;与java.lang.String不兼容   java如何使用JDK8(可选)为空字段创建自定义IntelliJ getter模板   java Tomcat6响应。sendRedirect()404错误