Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenDocCN
pycaret
提交
ba9ab4c1
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 搜索 >>
未验证
提交
ba9ab4c1
编写于
1月 26, 2020
作者:
P
pycaret
提交者:
GitHub
1月 26, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add files via upload
上级
3f456027
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
65 addition
and
30 deletion
+65
-30
classification.py
classification.py
+29
-15
regression.py
regression.py
+36
-15
未找到文件。
classification.py
浏览文件 @
ba9ab4c1
...
...
@@ -6699,6 +6699,7 @@ def predict_model(estimator,
#no active tests
#general dependencies
import
sys
import
numpy
as
np
import
pandas
as
pd
import
re
...
...
@@ -6706,19 +6707,22 @@ def predict_model(estimator,
from
copy
import
deepcopy
from
IPython.display
import
clear_output
,
update_display
estimator
=
deepcopy
(
estimator
)
clear_output
()
if
type
(
estimator
)
is
str
:
if
platform
==
'aws'
:
estimator
=
load_model
(
str
(
estimator
),
platform
=
'aws'
,
estimator
_
=
load_model
(
str
(
estimator
),
platform
=
'aws'
,
authentication
=
{
'bucket'
:
authentication
.
get
(
'bucket'
)},
verbose
=
False
)
else
:
estimator
=
load_model
(
str
(
estimator
),
verbose
=
False
)
estimator
_
=
load_model
(
str
(
estimator
),
verbose
=
False
)
e
stimator
=
deepcopy
(
estimator
)
estimator_
=
estimator
clear_output
()
e
lse
:
estimator_
=
estimator
if
type
(
estimator_
)
is
list
:
if
'sklearn.pipeline.Pipeline'
in
str
(
type
(
estimator_
[
0
])):
...
...
@@ -6728,17 +6732,28 @@ def predict_model(estimator,
estimator
=
estimator_
[
0
]
else
:
try
:
prep_pipe_transformer
=
prep_pipe
model
=
estimator
estimator
=
estimator
except
:
sys
.
exit
(
"(Type Error): Transformation Pipe Missing. "
)
else
:
try
:
prep_pipe_transformer
=
prep_pipe
model
=
estimator
estimator
=
estimator
else
:
prep_pipe_transformer
=
prep_pipe
model
=
estimator
estimator
=
estimator
except
:
sys
.
exit
(
"(Type Error): Transformation Pipe Missing. "
)
#dataset
if
data
is
None
:
...
...
@@ -6753,6 +6768,7 @@ def predict_model(estimator,
X_test_
.
reset_index
(
drop
=
True
,
inplace
=
True
)
y_test_
.
reset_index
(
drop
=
True
,
inplace
=
True
)
model
=
estimator
estimator_
=
estimator
else
:
...
...
@@ -6765,13 +6781,10 @@ def predict_model(estimator,
estimator_
=
estimator
#try:
# model = finalize_model(estimator)
#except:
# model = estimator
if
type
(
estimator
)
is
list
:
...
...
@@ -7198,3 +7211,4 @@ def predict_model(estimator,
return
X_test_
regression.py
浏览文件 @
ba9ab4c1
...
...
@@ -5300,6 +5300,7 @@ def finalize_model(estimator):
return
model_final
def
save_model
(
model
,
model_name
,
verbose
=
True
):
"""
...
...
@@ -5343,14 +5344,19 @@ def save_model(model, model_name, verbose=True):
"""
model_
=
[]
model_
.
append
(
prep_pipe
)
model_
.
append
(
model
)
import
joblib
model_name
=
model_name
+
'.pkl'
joblib
.
dump
(
model
,
model_name
)
joblib
.
dump
(
model
_
,
model_name
)
if
verbose
:
print
(
'Transformation Pipeline and Model Succesfully Saved'
)
def
load_model
(
model_name
,
platform
=
None
,
authentication
=
None
,
...
...
@@ -5706,6 +5712,7 @@ def predict_model(estimator,
#no active tests
#general dependencies
import
sys
import
numpy
as
np
import
pandas
as
pd
import
re
...
...
@@ -5713,19 +5720,22 @@ def predict_model(estimator,
from
copy
import
deepcopy
from
IPython.display
import
clear_output
,
update_display
estimator
=
deepcopy
(
estimator
)
clear_output
()
if
type
(
estimator
)
is
str
:
if
platform
==
'aws'
:
estimator
=
load_model
(
str
(
estimator
),
platform
=
'aws'
,
estimator
_
=
load_model
(
str
(
estimator
),
platform
=
'aws'
,
authentication
=
{
'bucket'
:
authentication
.
get
(
'bucket'
)},
verbose
=
False
)
else
:
estimator
=
load_model
(
str
(
estimator
),
verbose
=
False
)
e
stimator
=
deepcopy
(
estimator
)
estimator_
=
estimator
clear_output
()
estimator
_
=
load_model
(
str
(
estimator
),
verbose
=
False
)
e
lse
:
estimator_
=
estimator
if
type
(
estimator_
)
is
list
:
if
'sklearn.pipeline.Pipeline'
in
str
(
type
(
estimator_
[
0
])):
...
...
@@ -5735,16 +5745,28 @@ def predict_model(estimator,
estimator
=
estimator_
[
0
]
else
:
try
:
prep_pipe_transformer
=
prep_pipe
model
=
estimator
estimator
=
estimator
except
:
sys
.
exit
(
"(Type Error): Transformation Pipe Missing. "
)
else
:
try
:
prep_pipe_transformer
=
prep_pipe
model
=
estimator
estimator
=
estimator
else
:
prep_pipe_transformer
=
prep_pipe
model
=
estimator
estimator
=
estimator
except
:
sys
.
exit
(
"(Type Error): Transformation Pipe Missing. "
)
#dataset
if
data
is
None
:
...
...
@@ -5771,7 +5793,6 @@ def predict_model(estimator,
X_test_
.
reset_index
(
drop
=
True
,
inplace
=
True
)
estimator_
=
estimator
#try:
# model = finalize_model(estimator)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录