9.2 About Model Settings
You can specify settings that affect the characteristics of a model.
Some settings are general, some are specific to an Oracle Machine Learning function, and some are specific to an algorithm.
All settings have default values. If you want to override one or more of the settings for a model, then you must specify the settings with the **params
parameter when instantiating the model or later by using the set_params
method of the model.
For the _init_
method, the argument can be key-value pairs or a dict
. Each list element’s name and value refer to a machine learning algorithm parameter setting name and value, respectively. The setting value must be numeric or a string.
The argument for the **params
parameter of the set_params
method is a dict
object mapping a str
to a str
. The key should be the name of the setting, and the value should be the new setting.
Example 9-1 Specifying Model Settings
This example shows the creation of an Expectation Maximization (EM) model and the changing of a setting. For the complete code of the EM model example, see Example 9-10.
# Specify settings.
setting = {'emcs_num_iterations': 100}
# Create an EM model object
em_mod = em(n_clusters = 2, **setting)
# Intervening code not shown.
# Change the random seed and refit the model.
em_mod.set_params(EMCS_RANDOM_SEED = '5').fit(train_dat)