khiops.core.helpers
Submodule of khiops.core
Helper functions for specific and/or advanced treatments
| FUNCTION | DESCRIPTION |
|---|---|
deploy_coclustering |
Deploys a coclustering on a data table |
deploy_predictor_for_metrics |
Deploys the necessary data to estimate the performance metrics of a predictor |
visualize_report |
Opens a Khiops or Khiops Coclustering report with the desktop visualization app |
Classes
Functions:
deploy_coclustering(dictionary_file_path_or_domain, dictionary_name, data_table_path, coclustering_file_path, key_variable_names, deployed_variable_name, coclustering_dictionary_file_path, output_data_table_path, detect_format=True, header_line=None, field_separator=None, output_header_line=True, output_field_separator='\t', max_preserved_information=0, max_cells=0, max_total_parts=0, max_part_numbers=None, build_cluster_variable=True, build_distance_variables=False, build_frequency_variables=False, variables_prefix='', log_file_path=None, output_scenario_path=None, task_file_path=None, trace=False)
Deploys a coclustering on a data table
This procedure generates the following files:
- coclustering_dictionary_file_path: A multi-table dictionary file for
further deployments of the coclustering with deploy_model
- output_data_table_path: A data table file containing the deployed
coclustering model
| PARAMETER | DESCRIPTION |
|---|---|
dictionary_file_path_or_domain
|
Path of a Khiops dictionary file or a DictionaryDomain object.
TYPE:
|
dictionary_name
|
Name of the dictionary to be analyzed.
TYPE:
|
data_table_path
|
Path of the data table file.
TYPE:
|
coclustering_file_path
|
Path of the coclustering model file (extension Note Instance-variable coclustering is not currently supported.
TYPE:
|
key_variable_names
|
Names of the variables forming the unique keys of the individuals.
TYPE:
|
deployed_variable_name
|
Name of the coclustering variable to deploy.
TYPE:
|
coclustering_dictionary_file_path
|
Path of the coclustering dictionary file to deploy.
TYPE:
|
output_data_table_path
|
Path of the output data file.
TYPE:
|
detect_format
|
If True detects automatically whether the data table file has a header and its
field separator. It's ignored if
TYPE:
|
header_line
|
If True it uses the first line of the data as column names. Overrides
TYPE:
|
field_separator
|
A field separator character, overrides
TYPE:
|
output_header_line
|
If True writes a header line containing the column names in the output table.
TYPE:
|
output_field_separator
|
A field separator character (empty string counts as tab).
TYPE:
|
max_preserved_information
|
Maximum information preserve in the simplified coclustering. If equal to 0 there is no limit.
TYPE:
|
max_cells
|
Maximum number of cells in the simplified coclustering. If equal to 0 there is no limit.
TYPE:
|
max_total_parts
|
Maximum number of parts totaled over all variables. If equal to 0 there is no limit.
TYPE:
|
max_part_numbers
|
Dictionary associating variable names to their maximum number of parts
to preserve in the simplified coclustering. For variables not present
in
TYPE:
|
build_cluster_variable
|
If True includes a cluster id variable in the deployment.
TYPE:
|
build_distance_variables
|
If True includes a cluster distance variable in the deployment.
TYPE:
|
build_frequency_variables
|
If True includes the frequency variables in the deployment.
TYPE:
|
variables_prefix
|
Prefix for the variables in the deployment dictionary.
TYPE:
|
See Also
- [KhiopsRunner.run][] : Additional options.
| RETURNS | DESCRIPTION |
|---|---|
tuple
|
A 2-tuple containing:
|
| RAISES | DESCRIPTION |
|---|---|
TypeError
|
Invalid type |
ValueError
|
If the type of the dictionary key variables is not equal to |
NotImplementedError
|
If the coclustering to be deployed is of the instance-variable type |
Examples:
See the following function of the samples.py documentation script:
- samples.deploy_coclustering()
deploy_predictor_for_metrics(dictionary_file_path_or_domain, dictionary_name, data_table_path, output_data_table_path, detect_format=True, header_line=None, field_separator=None, sample_percentage=70, sampling_mode='Include sample', additional_data_tables=None, output_header_line=True, output_field_separator='\t', trace=False)
Deploys the necessary data to estimate the performance metrics of a predictor
For each instance for each instance it deploys:
- The true value of the target variable
- The predicted value of the target variable
- The probabilities of each value of the target variable (classifier only)
Note
To obtain the data of the default Khiops test dataset use sample_percentage =
70` and `sampling_mode = "Exclude sample".
| PARAMETER | DESCRIPTION |
|---|---|
dictionary_file_path_or_domain
|
Path of a Khiops dictionary file or a DictionaryDomain object.
TYPE:
|
dictionary_name
|
Name of the predictor dictionary.
TYPE:
|
data_table_path
|
Path of the data table file.
TYPE:
|
output_data_table_path
|
Path of the scores output data file.
TYPE:
|
detect_format
|
If True detects automatically whether the data table file has a header and its
field separator. It's ignored if
TYPE:
|
header_line
|
If True it uses the first line of the data as column names. Overrides
TYPE:
|
field_separator
|
A field separator character, overrides
TYPE:
|
sample_percentage
|
See
TYPE:
|
sampling_mode
|
If equal to "Include sample" deploys the predictor on
TYPE:
|
additional_data_tables
|
A dictionary containing the data paths and file paths for a multi-table dictionary file. For more details see Multi-Table Learning Primer documentation.
TYPE:
|
output_header_line
|
If True writes a header line containing the column names in the output table.
TYPE:
|
output_field_separator
|
A field separator character ("" counts as "\t").
TYPE:
|
See Also
visualize_report(report_path)
Opens a Khiops or Khiops Coclustering report with the desktop visualization app
Before using this function, make sure you have installed the Khiops Visualization app and/or the Khiops Co-Visualization app. More info at https://khiops.org/setup/visualization/
| PARAMETER | DESCRIPTION |
|---|---|
report_path
|
The path of the report file to be open. It must have extension '.khj' (Khiops report) or '.khcj' (Khiops Coclustering report).
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If the report file path does not have extension '.khj' or '.khcj'. |
FileNotFoundError
|
If the report file does not exist. |
RuntimeError
|
If the report file is executable. |