MaCh3PythonUtils.machine_learning package
Submodules
MaCh3PythonUtils.machine_learning.file_ml_interface module
- class FileMLInterface(chain: ChainHandler, prediction_variable: str, fit_name: str)[source]
Bases:
ABC
- add_model(ml_model: Any) None [source]
Add model to data set
- Parameters:
ml_model (Any) – Sets model to be ml_model
- property chain: ChainHandler
- evaluate_model(predicted_values: Iterable, true_values: Iterable, outfile: str = '')[source]
Evalulates model
- Parameters:
predicted_values (Iterable) – Label values predicted by model
true_values (Iterable) – Actual label values
outfile (str, optional) – File to output plots to, defaults to “”
- property model: Any
Model used
- Returns:
Returns ML model being used
- Return type:
Any
- abstract model_predict(testing_data: DataFrame) Iterable [source]
Abstract method, should return model prediction
- Parameters:
testing_data (pd.DataFrame) – Data to test model on
- save_model(output_file: str)[source]
Save model to pickle
- Parameters:
output_file (str) – Pickle file to save to
- set_training_test_set(test_size: float)[source]
Splits data/labels into training and testing tests
- Parameters:
test_size (float) – Proportion of data used for testing
- property test_data: DataFrame
Gets training data
- Returns:
Training data set
- Return type:
pd.DataFrame
- property training_data: DataFrame
Gets training data
- Returns:
Training data set
- Return type:
pd.DataFrame
- white_viridis = <matplotlib.colors.LinearSegmentedColormap object>
MaCh3PythonUtils.machine_learning.ml_factory module
ML Factory implementation, effectively a selector for making models
- class MLFactory(input_chain: ChainHandler, prediction_variable: str, plot_name: str)[source]
Bases:
object