未验证 提交 41b8102a 编写于 作者: P pycaret 提交者: GitHub

Add files via upload

上级 46b41274
......@@ -36,66 +36,52 @@ from pycaret.datasets import get_data
juice = get_data('juice')
```
Initializing the pycaret environment setup
1. Initializing the pycaret environment setup
```python
exp1 = setup(juice, 'Purchase')
```
Creating a simple logistic regression (includes fitting, CV and metric evaluation)
2. Creating a simple logistic regression (includes fitting, CV and metric evaluation)
```python
lr = create_model('lr')
```
List of available estimators:
Estimator Abbreviated String Original Implementation
--------- ------------------ -----------------------
Logistic Regression 'lr' linear_model.LogisticRegression
K Nearest Neighbour 'knn' neighbors.KNeighborsClassifier
Naives Bayes 'nb' naive_bayes.GaussianNB
Decision Tree 'dt' tree.DecisionTreeClassifier
SVM (Linear) 'svm' linear_model.SGDClassifier
SVM (RBF) 'rbfsvm' svm.SVC
Gaussian Process 'gpc' gaussian_process.GPC
Multi Level Perceptron 'mlp' neural_network.MLPClassifier
Ridge Classifier 'ridge' linear_model.RidgeClassifier
Random Forest 'rf' ensemble.RandomForestClassifier
Quadratic Disc. Analysis 'qda' discriminant_analysis.QDA
AdaBoost 'ada' ensemble.AdaBoostClassifier
Gradient Boosting 'gbc' ensemble.GradientBoostingClassifier
Linear Disc. Analysis 'lda' discriminant_analysis.LDA
Extra Trees Classifier 'et' ensemble.ExtraTreesClassifier
Extreme Gradient Boosting 'xgboost' xgboost.readthedocs.io
Light Gradient Boosting 'lightgbm' github.com/microsoft/LightGBM
Tuning a model using GridSearchCV with pre-defined grids.
```python
tuned_lr = tune_model('lr')
```
Ensembling trained model
Logistic Regression (lr)
K Nearest Neighbour (knn)
Naive Bayes (nb)
Decision Tree (dt)
Support Vector Machine - Linear (svm)
SVM Radial Function (rbfsvm)
Gaussian Process Classifier (gpc)
Multi Level Perceptron (mlp)
Ridge Classifier (ridge)
Random Forest (rf)
Quadtratic Discriminant Analysis (qda)
Adaboost (ada)
Gradient Boosting Classifier (gbc)
Linear Discriminant Analysis (lda)
Extra Trees Classifier (et)
Extreme Gradient Boosting - xgboost (xgboost)
Light Gradient Boosting - Microsoft LightGBM (lightgbm)
3. Tuning a model using inbuilt grids.
```python
dt = create_model('dt')
dt_bagging = ensemble_model('dt', method='Bagging')
dt_boosting = ensemble_model('dt', method='Boosting')
tuned_xgb = tune_model('xgboost')
```
Creating a voting classifier
4. Ensembling Model
```python
voting_clf1 = blend_models() #creates voting classifier for entire library
#create voting classifier for specific models
lr = create_model('lr')
svm = create_model('svm')
mlp = create_model('mlp')
xgboost = create_model('xgboost')
voting_clf2 = blend_models( [lr, svm, mlp, xgboost] )
dt = create_model('dt')
dt_bagging = ensemble_model(dt, method='Bagging')
dt_boosting = ensemble_model(dt, method='Boosting')
```
Creating a voting classifier
5. Creating a voting classifier
```python
voting_clf1 = blend_models() #creates voting classifier for entire library
voting_all = blend_models() #creates voting classifier for entire library
#create voting classifier for specific models
lr = create_model('lr')
......@@ -103,10 +89,10 @@ svm = create_model('svm')
mlp = create_model('mlp')
xgboost = create_model('xgboost')
voting_clf2 = blend_models( [lr, svm, mlp, xgboost] )
voting_clf2 = blend_models( [ lr, svm, mlp, xgboost ] )
```
Stacking Models in one layer
6. Stacking Models in Single Layer
```python
#create individual classifiers
lr = create_model('lr')
......@@ -117,7 +103,7 @@ xgboost = create_model('xgboost')
stacker = stack_models( [lr,svm,mlp], meta_model = xgboost )
```
Stacking Models in Multiple layers
7. Stacking Models in Multiple Layers
```python
#create individual classifiers
lr = create_model('lr')
......@@ -133,49 +119,63 @@ stacknet = create_stacknet( [ [lr,svm,mlp], [gbc, nb], [lightgbm, knn] ], meta_m
#meta model by default is Logistic Regression
```
Plot Models
8. Plot Models
```python
lr = create_model('lr')
plot_model(lr, plot='auc')
```
List of available plots:
Name Abbreviated String Original Implementation
--------- ------------------ -----------------------
Area Under the Curve 'auc' .. / rocauc.html
Discrimination Threshold 'threshold' .. / threshold.html
Precision Recall Curve 'pr' .. / prcurve.html
Confusion Matrix 'confusion_matrix' .. / confusion_matrix.html
Class Prediction Error 'error' .. / class_prediction_error.html
Classification Report 'class_report' .. / classification_report.html
Decision Boundary 'boundary' .. / boundaries.html
Recursive Feat. Selection 'rfe' .. / rfecv.html
Learning Curve 'learning' .. / learning_curve.html
Manifold Learning 'manifold' .. / manifold.html
Calibration Curve 'calibration' .. / calibration_curve.html
Validation Curve 'vc' .. / validation_curve.html
Dimension Learning 'dimension' .. / radviz.html
Feature Importance 'feature' N/A
Model Hyperparameter 'parameter' N/A
Saving Model for Deployment
Area Under the Curve (auc)
Discrimination Threshold (threshold)
Precision Recall Curve (pr)
Confusion Matrix (confusion_matrix)
Class Prediction Error (error)
Classification Report (class_report)
Decision Boundary (boundary)
Recursive Feature Selection (rfe)
Learning Curve (learning)
Manifold Learning (manifold)
Calibration Curve (calibration)
Validation Curve (vc)
Dimension Learning (dimension)
Feature Importance (feature)
Model Hyperparameter (parameter)
9. Evaluate Model
```python
lr = create_model('lr')
evaluate_model(lr) #displays user interface for interactive plotting
```
10. Interpret Tree Based Models
```python
xgboost = create_model('xgboost')
interpret_model(xgboost)
```
11. Saving Model for Deployment
```python
lr = create_model('lr')
save_model(lr, 'lr_23122019')
```
Saving Entire Experiment Pipeline
12. Saving Entire Experiment Pipeline
```python
save_experiment('expname1')
```
Loading Model / Experiment
13. Loading Model / Experiment
```python
m = load_model('lr_23122019')
e = load_experiment('expname1')
```
AutoML
14. AutoML
```python
aml1 = automl()
```
## Documentation
Documentation work is in progress. They will be uploaded on our website http://www.pycaret.org as soon as they are available. (Target Availability : 21/01/2020)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册