Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenDocCN
pycaret
提交
1f4470fe
pycaret
项目概览
OpenDocCN
/
pycaret
通知
2
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
pycaret
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
1f4470fe
编写于
7月 03, 2020
作者:
P
PyCaret
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
added exception checking on all modules
上级
f5a69428
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
343 addition
and
10 deletion
+343
-10
pycaret/anomaly.py
pycaret/anomaly.py
+69
-1
pycaret/classification.py
pycaret/classification.py
+46
-1
pycaret/clustering.py
pycaret/clustering.py
+66
-5
pycaret/nlp.py
pycaret/nlp.py
+53
-1
pycaret/regression.py
pycaret/regression.py
+107
-0
pycaret/utils.py
pycaret/utils.py
+1
-1
setup.py
setup.py
+1
-1
未找到文件。
pycaret/anomaly.py
浏览文件 @
1f4470fe
...
...
@@ -482,6 +482,30 @@ def setup(data,
if
type
(
group_names
)
is
not
list
:
sys
.
exit
(
'(Type Error): group_names must be of type list. '
)
#silent
if
type
(
silent
)
is
not
bool
:
sys
.
exit
(
"(Type Error): silent parameter only accepts True or False. "
)
#html
if
type
(
html
)
is
not
bool
:
sys
.
exit
(
'(Type Error): html parameter only accepts True or False.'
)
#logging
if
type
(
logging
)
is
not
bool
:
sys
.
exit
(
'(Type Error): logging parameter only accepts True or False.'
)
#log_plots
if
type
(
log_plots
)
is
not
bool
:
sys
.
exit
(
'(Type Error): log_plots parameter only accepts True or False.'
)
#log_data
if
type
(
log_data
)
is
not
bool
:
sys
.
exit
(
'(Type Error): log_data parameter only accepts True or False.'
)
#log_profile
if
type
(
log_profile
)
is
not
bool
:
sys
.
exit
(
'(Type Error): log_profile parameter only accepts True or False.'
)
"""
error handling ends here
...
...
@@ -3503,4 +3527,48 @@ def get_outliers(data,
dataset
=
assign_model
(
c
,
verbose
=
False
)
return
dataset
\ No newline at end of file
return
dataset
def
models
():
"""
returns table of models available in model library
"""
import
pandas
as
pd
model_id
=
[
'abod'
,
'iforest'
,
'cluster'
,
'cof'
,
'histogram'
,
'knn'
,
'lof'
,
'svm'
,
'pca'
,
'mcd'
,
'sod'
,
'sos'
]
model_name
=
[
'Angle-base Outlier Detection'
,
'Isolation Forest'
,
'Clustering-Based Local Outlier'
,
'Connectivity-Based Outlier Factor'
,
'Histogram-based Outlier Detection'
,
'k-Nearest Neighbors Detector'
,
'Local Outlier Factor'
,
'One-class SVM detector'
,
'Principal Component Analysis'
,
'Minimum Covariance Determinant'
,
'Subspace Outlier Detection'
,
'Stochastic Outlier Selection'
]
model_ref
=
[
'pyod.models.abod.ABOD'
,
'pyod.models.iforest'
,
'pyod.models.cblof'
,
'pyod.models.cof'
,
'pyod.models.hbos'
,
'pyod.models.knn'
,
'pyod.models.lof'
,
'pyod.models.ocsvm'
,
'pyod.models.pca'
,
'pyod.models.mcd'
,
'pyod.models.sod'
,
'pyod.models.sos'
]
df
=
pd
.
DataFrame
({
'ID'
:
model_id
,
'Name'
:
model_name
,
'Reference'
:
model_ref
})
df
.
set_index
(
'ID'
,
inplace
=
True
)
return
df
\ No newline at end of file
pycaret/classification.py
浏览文件 @
1f4470fe
...
...
@@ -721,6 +721,51 @@ def setup(data,
if
type
(
silent
)
is
not
bool
:
sys
.
exit
(
"(Type Error): silent parameter only accepts True or False. "
)
#remove_perfect_collinearity
if
type
(
remove_perfect_collinearity
)
is
not
bool
:
sys
.
exit
(
'(Type Error): remove_perfect_collinearity parameter only accepts True or False.'
)
#html
if
type
(
html
)
is
not
bool
:
sys
.
exit
(
'(Type Error): html parameter only accepts True or False.'
)
#folds_shuffle
if
type
(
folds_shuffle
)
is
not
bool
:
sys
.
exit
(
'(Type Error): folds_shuffle parameter only accepts True or False.'
)
#data_split_shuffle
if
type
(
data_split_shuffle
)
is
not
bool
:
sys
.
exit
(
'(Type Error): data_split_shuffle parameter only accepts True or False.'
)
#logging
if
type
(
logging
)
is
not
bool
:
sys
.
exit
(
'(Type Error): logging parameter only accepts True or False.'
)
#log_plots
if
type
(
log_plots
)
is
not
bool
:
sys
.
exit
(
'(Type Error): log_plots parameter only accepts True or False.'
)
#log_data
if
type
(
log_data
)
is
not
bool
:
sys
.
exit
(
'(Type Error): log_data parameter only accepts True or False.'
)
#log_profile
if
type
(
log_profile
)
is
not
bool
:
sys
.
exit
(
'(Type Error): log_profile parameter only accepts True or False.'
)
#fix_imbalance
if
type
(
fix_imbalance
)
is
not
bool
:
sys
.
exit
(
'(Type Error): fix_imbalance parameter only accepts True or False.'
)
#fix_imbalance_method
if
fix_imbalance_method
is
not
None
:
if
hasattr
(
fix_imbalance_method
,
'fit_sample'
):
pass
else
:
sys
.
exit
(
'(Type Error): fix_imbalance_method must contain resampler with fit_sample method.'
)
#pre-load libraries
import
pandas
as
pd
import
ipywidgets
as
ipw
...
...
@@ -10806,7 +10851,7 @@ def pull():
def
models
():
"""
returns table of models available in model
zoo
returns table of models available in model
library
"""
import
pandas
as
pd
...
...
pycaret/clustering.py
浏览文件 @
1f4470fe
...
...
@@ -482,7 +482,30 @@ def setup(data,
if
type
(
group_names
)
is
not
list
:
sys
.
exit
(
'(Type Error): group_names must be of type list. '
)
#silent
if
type
(
silent
)
is
not
bool
:
sys
.
exit
(
"(Type Error): silent parameter only accepts True or False. "
)
#html
if
type
(
html
)
is
not
bool
:
sys
.
exit
(
'(Type Error): html parameter only accepts True or False.'
)
#logging
if
type
(
logging
)
is
not
bool
:
sys
.
exit
(
'(Type Error): logging parameter only accepts True or False.'
)
#log_plots
if
type
(
log_plots
)
is
not
bool
:
sys
.
exit
(
'(Type Error): log_plots parameter only accepts True or False.'
)
#log_data
if
type
(
log_data
)
is
not
bool
:
sys
.
exit
(
'(Type Error): log_data parameter only accepts True or False.'
)
#log_profile
if
type
(
log_profile
)
is
not
bool
:
sys
.
exit
(
'(Type Error): log_profile parameter only accepts True or False.'
)
"""
error handling ends here
"""
...
...
@@ -1088,15 +1111,15 @@ def create_model(model = None,
Model Abbreviated String Original Implementation
--------- ------------------ -----------------------
K-Means
c
lustering 'kmeans' sklearn.cluster.KMeans.html
K-Means
C
lustering 'kmeans' sklearn.cluster.KMeans.html
Affinity Propagation 'ap' AffinityPropagation.html
Mean shift
c
lustering 'meanshift' sklearn.cluster.MeanShift.html
Mean shift
C
lustering 'meanshift' sklearn.cluster.MeanShift.html
Spectral Clustering 'sc' SpectralClustering.html
Agglomerative Clustering 'hclust' AgglomerativeClustering.html
Density-Based Spatial Clustering 'dbscan' sklearn.cluster.DBSCAN.html
OPTICS Clustering 'optics' sklearn.cluster.OPTICS.html
Birch Clustering 'birch' sklearn.cluster.Birch.html
K-Modes
c
lustering 'kmodes' git/nicodv/kmodes
K-Modes
C
lustering 'kmodes' git/nicodv/kmodes
num_clusters: int, default = None
Number of clusters to be generated with the dataset. If None, num_clusters is set to 4.
...
...
@@ -3754,4 +3777,42 @@ def get_clusters(data,
except
:
c
=
create_model
(
model
=
model
,
verbose
=
False
,
system
=
False
)
dataset
=
assign_model
(
c
,
verbose
=
False
)
return
dataset
\ No newline at end of file
return
dataset
def
models
():
"""
returns table of models available in model library
"""
import
pandas
as
pd
model_id
=
[
'kmeans'
,
'ap'
,
'meanshift'
,
'sc'
,
'hclust'
,
'dbscan'
,
'optics'
,
'birch'
,
'kmodes'
]
model_name
=
[
'K-Means Clustering'
,
'Affinity Propagation'
,
'Mean shift Clustering'
,
'Spectral Clustering'
,
'Agglomerative Clustering'
,
'Density-Based Spatial Clustering'
,
'OPTICS Clustering'
,
'Birch Clustering'
,
'K-Modes Clustering'
]
model_ref
=
[
'sklearn.cluster.KMeans'
,
'sklearn.cluster.AffinityPropagation'
,
'sklearn.cluster.MeanShift'
,
'sklearn.cluster.SpectralClustering'
,
'sklearn.cluster.AgglomerativeClustering'
,
'sklearn.cluster.DBSCAN'
,
'sklearn.cluster.OPTICS'
,
'sklearn.cluster.Birch'
,
'git/nicodv/kmodes'
]
df
=
pd
.
DataFrame
({
'ID'
:
model_id
,
'Name'
:
model_name
,
'Reference'
:
model_ref
})
df
.
set_index
(
'ID'
,
inplace
=
True
)
return
df
\ No newline at end of file
pycaret/nlp.py
浏览文件 @
1f4470fe
...
...
@@ -143,7 +143,30 @@ def setup(data,
except
:
sys
.
exit
(
'(Type Error): spacy english model is not yet downloaded. See the documentation of setup to see installation guide.'
)
#silent
if
type
(
silent
)
is
not
bool
:
sys
.
exit
(
"(Type Error): silent parameter only accepts True or False. "
)
#html
if
type
(
html
)
is
not
bool
:
sys
.
exit
(
'(Type Error): html parameter only accepts True or False.'
)
#logging
if
type
(
logging
)
is
not
bool
:
sys
.
exit
(
'(Type Error): logging parameter only accepts True or False.'
)
#log_plots
if
type
(
log_plots
)
is
not
bool
:
sys
.
exit
(
'(Type Error): log_plots parameter only accepts True or False.'
)
#log_data
if
type
(
log_data
)
is
not
bool
:
sys
.
exit
(
'(Type Error): log_data parameter only accepts True or False.'
)
#verbose
if
type
(
verbose
)
is
not
bool
:
sys
.
exit
(
'(Type Error): verbose parameter only accepts True or False.'
)
"""
error handling ends here
"""
...
...
@@ -3200,3 +3223,32 @@ def get_topics(data, text, model=None, num_topics=4):
return
dataset
def
models
():
"""
returns table of models available in model library
"""
import
pandas
as
pd
model_id
=
[
'lda'
,
'lsi'
,
'hdp'
,
'rp'
,
'nmf'
]
model_name
=
[
'Latent Dirichlet Allocation'
,
'Latent Semantic Indexing'
,
'Hierarchical Dirichlet Process'
,
'Random Projections'
,
'Non-Negative Matrix Factorization'
]
model_ref
=
[
'gensim/models/ldamodel'
,
'gensim/models/lsimodel'
,
'gensim/models/hdpmodel'
,
'gensim/models/rpmodel'
,
'sklearn.decomposition.NMF'
]
df
=
pd
.
DataFrame
({
'ID'
:
model_id
,
'Name'
:
model_name
,
'Reference'
:
model_ref
})
df
.
set_index
(
'ID'
,
inplace
=
True
)
return
df
\ No newline at end of file
pycaret/regression.py
浏览文件 @
1f4470fe
...
...
@@ -711,7 +711,40 @@ def setup(data,
#silent
if
type
(
silent
)
is
not
bool
:
sys
.
exit
(
"(Type Error): silent parameter only accepts True or False. "
)
#remove_perfect_collinearity
if
type
(
remove_perfect_collinearity
)
is
not
bool
:
sys
.
exit
(
'(Type Error): remove_perfect_collinearity parameter only accepts True or False.'
)
#html
if
type
(
html
)
is
not
bool
:
sys
.
exit
(
'(Type Error): html parameter only accepts True or False.'
)
#folds_shuffle
if
type
(
folds_shuffle
)
is
not
bool
:
sys
.
exit
(
'(Type Error): folds_shuffle parameter only accepts True or False.'
)
#data_split_shuffle
if
type
(
data_split_shuffle
)
is
not
bool
:
sys
.
exit
(
'(Type Error): data_split_shuffle parameter only accepts True or False.'
)
#logging
if
type
(
logging
)
is
not
bool
:
sys
.
exit
(
'(Type Error): logging parameter only accepts True or False.'
)
#log_plots
if
type
(
log_plots
)
is
not
bool
:
sys
.
exit
(
'(Type Error): log_plots parameter only accepts True or False.'
)
#log_data
if
type
(
log_data
)
is
not
bool
:
sys
.
exit
(
'(Type Error): log_data parameter only accepts True or False.'
)
#log_profile
if
type
(
log_profile
)
is
not
bool
:
sys
.
exit
(
'(Type Error): log_profile parameter only accepts True or False.'
)
#pre-load libraries
import
pandas
as
pd
import
ipywidgets
as
ipw
...
...
@@ -9343,4 +9376,78 @@ def automl(optimize='r2', use_holdout=False):
def
pull
():
return
display_container
[
-
1
]
def
models
():
"""
returns table of models available in model library
"""
import
pandas
as
pd
model_id
=
[
'lr'
,
'lasso'
,
'ridge'
,
'en'
,
'lar'
,
'llar'
,
'omp'
,
'br'
,
'ard'
,
'par'
,
'ransac'
,
'tr'
,
'huber'
,
'kr'
,
'svm'
,
'knn'
,
'dt'
,
'rf'
,
'et'
,
'ada'
,
'gbr'
,
'mlp'
,
'xgboost'
,
'lightgbm'
,
'catboost'
]
model_name
=
[
'Linear Regression'
,
'Lasso Regression'
,
'Ridge Regression'
,
'Elastic Net'
,
'Least Angle Regression'
,
'Lasso Least Angle Regression'
,
'Orthogonal Matching Pursuit'
,
'Bayesian Ridge'
,
'Automatic Relevance Determination'
,
'Passive Aggressive Regressor'
,
'Random Sample Consensus'
,
'TheilSen Regressor'
,
'Huber Regressor'
,
'Kernel Ridge'
,
'Support Vector Machine'
,
'K Neighbors Regressor'
,
'Decision Tree'
,
'Random Forest'
,
'Extra Trees Regressor'
,
'AdaBoost Regressor'
,
'Gradient Boosting Regressor'
,
'Multi Level Perceptron'
,
'Extreme Gradient Boosting'
,
'Light Gradient Boosting Machine'
,
'CatBoost Regressor'
]
model_ref
=
[
'sklearn.linear_model.LinearRegression'
,
'sklearn.linear_model.Lasso'
,
'sklearn.linear_model.Ridge'
,
'sklearn.linear_model.ElasticNet'
,
'sklearn.linear_model.Lars'
,
'sklearn.linear_model.LassoLars'
,
'sklearn.linear_model.OMP'
,
'sklearn.linear_model.BayesianRidge'
,
'sklearn.linear_model.ARDRegression'
,
'sklearn.linear_model.PAR'
,
'sklearn.linear_model.RANSACRegressor'
,
'sklearn.linear_model.TheilSenRegressor'
,
'sklearn.linear_model.HuberRegressor'
,
'sklearn.kernel_ridge.KernelRidge'
,
'sklearn.svm.SVR'
,
'sklearn.neighbors.KNeighborsRegressor'
,
'sklearn.tree.DecisionTreeRegressor'
,
'sklearn.ensemble.RandomForestRegressor'
,
'sklearn.ensemble.ExtraTreesRegressor'
,
'sklearn.ensemble.AdaBoostRegressor'
,
'sklearn.ensemble.GradientBoostingRegressor'
,
'sklearn.neural_network.MLPRegressor'
,
'xgboost.readthedocs.io'
,
'github.com/microsoft/LightGBM'
,
'https://catboost.ai'
]
model_turbo
=
[
True
,
True
,
True
,
True
,
True
,
True
,
True
,
True
,
False
,
True
,
True
,
True
,
True
,
False
,
True
,
True
,
True
,
True
,
True
,
True
,
True
,
False
,
True
,
True
,
True
]
df
=
pd
.
DataFrame
({
'ID'
:
model_id
,
'Name'
:
model_name
,
'Reference'
:
model_ref
,
'Turbo'
:
model_turbo
})
df
.
set_index
(
'ID'
,
inplace
=
True
)
return
df
\ No newline at end of file
pycaret/utils.py
浏览文件 @
1f4470fe
...
...
@@ -3,7 +3,7 @@
# License: MIT
def
version
():
print
(
"pycaret-nightly-0.1
4
"
)
print
(
"pycaret-nightly-0.1
5
"
)
def
check_metric
(
actual
,
prediction
,
metric
,
round
=
4
):
...
...
setup.py
浏览文件 @
1f4470fe
...
...
@@ -13,7 +13,7 @@ with open('requirements.txt') as f:
setup
(
name
=
"pycaret-nightly"
,
version
=
"0.1
4
"
,
version
=
"0.1
5
"
,
description
=
"Nightly build of PyCaret - An open source, low-code machine learning library in Python."
,
long_description
=
readme
(),
long_description_content_type
=
"text/markdown"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录