特徴量の選択のノートブック¶
In [1]:
Copied!
import datarobot as dr
import datarobot as dr
In [2]:
Copied!
from datarobot_bp_workshop import Workshop, Visualize
from datarobot_bp_workshop import Workshop, Visualize
In [3]:
Copied!
with open('../api.token', 'r') as f:
token = f.read()
dr.Client(token=token, endpoint='https://app.datarobot.com/api/v2')
with open('../api.token', 'r') as f:
token = f.read()
dr.Client(token=token, endpoint='https://app.datarobot.com/api/v2')
初期化する¶
In [4]:
Copied!
w = Workshop()
w = Workshop()
特徴量選択ワークフロー¶
このセクションはプロジェクトによって異なります。
In [5]:
Copied!
w = Workshop(project_id='5eb9656901f6bb026828f14e')
w = Workshop(project_id='5eb9656901f6bb026828f14e')
In [6]:
Copied!
w.Features.Accident_Last2
w.Features.Accident_Last2
Out[6]:
Single Column Converter: 'Accident_Last2' (SCPICK) Input Summary: Categorical Data Output Method: TaskOutputMethod.TRANSFORM Task Parameters: column_name (cn) = '4163636964656e745f4c61737432'
In [7]:
Copied!
w.Feature('Insurance_Duration')
w.Feature('Insurance_Duration')
Out[7]:
Single Column Converter: 'Insurance_Duration' (SCPICK) Input Summary: Categorical Data Output Method: TaskOutputMethod.TRANSFORM Task Parameters: column_name (cn) = '496e737572616e63655f4475726174696f6e'
In [8]:
Copied!
pni = w.Tasks.PNI2(w.Features.Age)
rdt = w.Tasks.RDT5(pni)
binning = w.Tasks.BINNING(pni)
keras = w.Tasks.KERASC(rdt, binning)
keras.set_task_parameters_by_name(learning_rate=0.123)
keras_blueprint = w.BlueprintGraph(keras, name='A blueprint I made with the Python API')
pni = w.Tasks.PNI2(w.Features.Age)
rdt = w.Tasks.RDT5(pni)
binning = w.Tasks.BINNING(pni)
keras = w.Tasks.KERASC(rdt, binning)
keras.set_task_parameters_by_name(learning_rate=0.123)
keras_blueprint = w.BlueprintGraph(keras, name='A blueprint I made with the Python API')
In [9]:
Copied!
source_code = keras_blueprint.to_source_code(to_stdout=True)
source_code = keras_blueprint.to_source_code(to_stdout=True)
w = Workshop(project_id='5eb9656901f6bb026828f14e') age = w.Features.Age pni2 = w.Tasks.PNI2(age) binning = w.Tasks.BINNING(pni2) rdt5 = w.Tasks.RDT5(pni2) kerasc = w.Tasks.KERASC(binning, rdt5) kerasc.set_task_parameters(learning_rate=0.123) kerasc_blueprint = w.BlueprintGraph(kerasc, name='A blueprint I made with the Python API')
In [10]:
Copied!
exec(compile(source_code, 'blueprint', 'exec'), locals())
exec(compile(source_code, 'blueprint', 'exec'), locals())
In [11]:
Copied!
kerasc_blueprint.show()
kerasc_blueprint.show()
In [12]:
Copied!
w.set_project(project_id='605ab63ecd8a6669dfd64901')
w.set_project(project_id='605ab63ecd8a6669dfd64901')
Out[12]:
<workshop.workshop.Workshop at 0x7ffad3b7e650>
In [14]:
Copied!
kerasc_blueprint.train(w.project.id)
kerasc_blueprint.train(w.project.id)
Out[14]:
Name: 'A blueprint I made with the Python API' Input Data: Numeric Tasks: Single Column Converter: 'Age' | Missing Values Imputed | Binning of numerical variables | Smooth Ridit Transform | Keras Neural Network Classifier
In [101]:
Copied!
starred_models = w.project.get_models(search_params=dict(is_starred=True))
starred_models = w.project.get_models(search_params=dict(is_starred=True))
In [102]:
Copied!
model_to_clone = starred_models[0].blueprint_id
model_to_clone = starred_models[0].blueprint_id
In [104]:
Copied!
bp = w.clone(blueprint_id=model_to_clone, name='Now featuring selected columns!')
bp = w.clone(blueprint_id=model_to_clone, name='Now featuring selected columns!')
In [105]:
Copied!
bp.show()
bp.show()
In [106]:
Copied!
bp.delete()
bp.delete()
Blueprint deleted.
更新しました March 13, 2024
このページは役に立ちましたか?
ありがとうございます。どのような点が役に立ちましたか?
より良いコンテンツを提供するには、どうすればよいでしょうか?
アンケートにご協力いただき、ありがとうございました。