lale.helpers module

exception lale.helpers.SubschemaError(sub, sup, sub_name='sub', sup_name='super')[source]

Bases: Exception

lale.helpers.append_batch(data, batch_data)[source]
class lale.helpers.assert_raises(expected_exc_type)[source]

Bases: object

class lale.helpers.assert_warns(expected_exc_type)[source]

Bases: object

lale.helpers.assignee_name(level=1)[source]
lale.helpers.best_estimator(obj)[source]
lale.helpers.caml_to_snake(name)[source]
lale.helpers.create_data_loader(X, y=None, batch_size=1)[source]
lale.helpers.create_individual_op_using_reflection(class_name, operator_name, param_dict)[source]
lale.helpers.create_instance_from_hyperopt_search_space(lale_object, hyperparams)[source]

Hyperparams is a n-tuple of dictionaries of hyper-parameters, each dictionary corresponds to an operator in the pipeline

lale.helpers.create_operator_using_reflection(class_name, operator_name, param_dict)[source]
lale.helpers.cross_val_score(estimator, X, y=None, scoring=<function accuracy_score>, cv=5)[source]

Use the given estimator to perform fit and predict for splits defined by ‘cv’ and compute the given score on each of the splits. :param estimator: A valid sklearn_wrapper estimator :param X, y: Valid data and target values that work with the estimator :param scoring: a scorer object from sklearn.metrics (https://scikit-learn.org/stable/modules/classes.html#module-sklearn.metrics)

Default value is accuracy_score.

Parameters

cv – an integer or an object that has a split function as a generator yielding (train, test) splits as arrays of indices. Integer value is used as number of folds in sklearn.model_selection.StratifiedKFold, default is 5. Note that any of the iterators from https://scikit-learn.org/stable/modules/cross_validation.html#cross-validation-iterators can be used here.

Returns

cv_results: a list of scores corresponding to each cross validation fold

lale.helpers.cross_val_score_track_trials(estimator, X, y=None, scoring=<function accuracy_score>, cv=5)[source]

Use the given estimator to perform fit and predict for splits defined by ‘cv’ and compute the given score on each of the splits.

Parameters

:param : :type : return: cv_results: a list of scores corresponding to each cross validation fold

lale.helpers.data_to_json(data, subsample_array=True)[source]
lale.helpers.dict_without(orig_dict, key)[source]
lale.helpers.get_default_schema(impl)[source]
lale.helpers.get_hyperparam_names(op)[source]
lale.helpers.get_lib_schema(impl)[source]
lale.helpers.import_from_sklearn_pipeline(sklearn_pipeline)[source]
lale.helpers.is_schema(value)[source]
lale.helpers.json_meta_schema()[source]
lale.helpers.load_yaml(dir_name, file_name, meta_dir=True)[source]
lale.helpers.ndarray_to_json(arr, subsample_array=True)[source]
lale.helpers.print_yaml(what, doc, file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>)[source]
lale.helpers.println_pos(message, out_file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>)[source]
lale.helpers.signature_to_schema(sig)[source]
lale.helpers.to_graphviz(lale_operator, **dot_graph_attr)[source]
class lale.helpers.val_wrapper(base)[source]

Bases: object

This is used to wrap values that cause problems for hyper-optimizer backends lale will unwrap these when given them as the value of a hyper-parameter

classmethod unwrap(obj)[source]
unwrap_self()[source]
lale.helpers.validate_is_schema(value)[source]
lale.helpers.validate_method(op, m)[source]
lale.helpers.validate_schema(value, schema, subsample_array=True)[source]
lale.helpers.validate_subschema(sub, sup, sub_name='sub', sup_name='super')[source]
lale.helpers.wrap_imported_operators()[source]
lale.helpers.write_batch_output_to_file(file_obj, file_path, total_len, batch_idx, batch_X, batch_y, batch_out_X, batch_out_y)[source]