-
Notifications
You must be signed in to change notification settings - Fork 0
/
Co_AMPpred.py
117 lines (70 loc) · 2.42 KB
/
Co_AMPpred.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/usr/bin/env python
# coding: utf-8
# Required packages
import numpy as np
import pandas as pd
import os, sys
from IPython.display import display
from pycaret.utils import version
# Loading the data
train = pd.read_csv('Train_All_AMB.csv')
test = pd.read_csv('Test_data_all_AMB.csv')
# Setting up Environment in PyCaret
from pycaret.classification import *
clf1 = setup (data = train,
target = 'Class', test_data = test, preprocess= True, feature_selection = True, feature_selection_threshold= 0.9, feature_selection_method= 'boruta', normalize = True, normalize_method = "robust", transformation = True)
#Comparing All Models
best = compare_models()
#Create a Model 'lightgbm'
lightgbm = create_model('lightgbm')
#trained model object is stored in the variable:"lightgbm"
print(lightgbm)
#Plot a Model
plot_model(estimator = lightgbm)#AUC
plot_model(estimator = lightgbm, plot = 'confusion_matrix')
plot_model(estimator = lightgbm, plot = 'feature')
#Predict on test / hold-out Sample
predict_model(lightgbm)
#Create a Model 'gbc'
gbc = create_model('gbc')
#trained model object is stored in the variable:"gbc"
print(gbc)
#Plot a Model
plot_model(estimator = gbc)
plot_model(estimator = gbc, plot = 'confusion_matrix')
plot_model(estimator = gbc, plot = 'feature')
#Predict on test / hold-out Sample
predict_model(gbc)
plot_model(estimator = tuned_gbc) #AUC
plot_model(estimator = tuned_gbc, plot = 'confusion_matrix')
plot_model(estimator = tuned_gbc, plot = 'feature')
#Create a Model
et = create_model('et')
#trained model object is stored in the variable:"et"
print(et)
# Plot Model
plot_model(estimator = et)
plot_model(estimator = et, plot = 'confusion_matrix')
plot_model(estimator = tuned_et, plot = 'feature')
#Predict on test / hold-out Sample
predict_model(et)
#Create a Model
rf = create_model('rf')
# trained model object is stored in the variable:"rf"
print(rf)
# Plot Model
plot_model(estimator = rf) #AUC
plot_model(estimator = rf, plot = 'confusion_matrix')
plot_model(estimator =rf, plot = 'feature')
#Predict on test / hold-out Sample
predict_model(rf)
#Create a Model
catboost = create_model('catboost')
# trained model object is stored in the variable:"catboost"
print(catboost)
# Plot Model
plot_model(estimator = catboost)
plot_model(estimator = catboost, plot = 'confusion_matrix')
plot_model(estimator = catboost, plot = 'feature')
#Predict on test / hold-out Sample
predict_model(catboost)