:py:mod:`python.dgbpy.mlio` =========================== .. py:module:: python.dgbpy.mlio Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: python.dgbpy.mlio.getInfo python.dgbpy.mlio.datasetCount python.dgbpy.mlio.getDatasetNms python.dgbpy.mlio.getChunks python.dgbpy.mlio.hasScaler python.dgbpy.mlio.getDatasetsByGroup python.dgbpy.mlio.getSomeDatasets python.dgbpy.mlio.getTrainingData python.dgbpy.mlio.getTrainingDataByInfo python.dgbpy.mlio.getClasses python.dgbpy.mlio.normalize_class_vector python.dgbpy.mlio.unnormalize_class_vector python.dgbpy.mlio.saveModel python.dgbpy.mlio.getModel python.dgbpy.mlio.getApplyInfoFromFile python.dgbpy.mlio.getApplyInfo python.dgbpy.mlio.modelNameIsFree python.dgbpy.mlio.modelNameExists python.dgbpy.mlio.dbInfoForModel python.dgbpy.mlio.getModelType python.dgbpy.mlio.getSaveLoc Attributes ~~~~~~~~~~ .. autoapisummary:: python.dgbpy.mlio.nladbdirid python.dgbpy.mlio.mlinpgrp python.dgbpy.mlio.mltrlgrp python.dgbpy.mlio.dgbtrl python.dgbpy.mlio.dblistall .. py:data:: nladbdirid :annotation: = 100060 .. py:data:: mlinpgrp :annotation: = Deep Learning Example Data .. py:data:: mltrlgrp :annotation: = Deep Learning Model .. py:data:: dgbtrl :annotation: = dGB .. py:function:: getInfo(filenm, quick=False) Gets information from an example file Parameters: * filenm (str): ffile name/path in hdf5 format * quick (bool): when set to True, info is gottenn quickly leaving out some info(e.g. datasets), defaults to False and loads all informaton Returns: * dict: information from data file or model file .. py:function:: datasetCount(dsets) Gets count of dataset Parameters: * dsets (dict): dataset Returns: * dict: counts for target attribute(s) or well(s) for project .. py:function:: getDatasetNms(dsets, validation_split=None, valid_inputs=None) Gets train and validation indices of dataset Parameters: * dsets (dict): dataset * validation_split (float): size of validation data (between 0-1) * valid_inputs (iter): Returns: * dict: train and validation indices .. py:function:: getChunks(dsets, nbchunks) Splits dataset object into smaller chunks Parameters: * dsets (dict): dataset * nbchunks (int): number of data chunks to be created Returns: * dict: chunks from dataset stored as dictionaries .. py:function:: hasScaler(infos, inputsel=None) Checks if example file has scaleror not from info Parameters: * infos (dict): information about example file * inputsel (bool or NoneType): Returns: bool: True if dataset info has scaler key, False if other .. py:function:: getDatasetsByGroup(dslist, groupnm) .. py:function:: getSomeDatasets(dslist, decim=None) .. py:function:: getTrainingData(filenm, decim=False) Gets training data from file name Parameters: * filenm (str): path to file in hdf5 format * decim (bool): Returns: * dict: train, validation datasets as arrays, and info on example file .. py:function:: getTrainingDataByInfo(info, dsetsel=None) Gets training data from file info Parameters: * info (dict): information about example file * dsetsel (): Returns: * dict: train, validation datasets as arrays, and info on example file .. py:function:: getClasses(info, y_vectors) .. py:function:: normalize_class_vector(arr, classes) .. py:function:: unnormalize_class_vector(arr, classes) .. py:function:: saveModel(model, inpfnm, platform, infos, outfnm) Saves trained model for any platform workflow Parameters: * model (obj): trained model on any platform * inpfnm (str): example file name in hdf5 format * platform (str): machine learning platform (options; keras, Scikit-learn, torch) * infos (dict): example file info * outfnm (str): name of model to be saved .. py:function:: getModel(modelfnm, fortrain=False, pars=None) Get model and model information Parameters: * modelfnm (str): model file path/name in hdf5 format * fortrain (bool): specifies if the model might be further trained * pars (dict): parameters to be used when restoring the model if needed Returs: * tuple: (trained model and model/project info) .. py:function:: getApplyInfoFromFile(modelfnm, outsubsel=None) Gets model apply info from file name Parameters: * modelfnm (str): model file path/name in hdf5 format * outsubsel (): Returns: * dict: apply information .. py:function:: getApplyInfo(infos, outsubsel=None) Gets model apply info from example file info Parameters: * infos (dict): example file info * outsubsel (): Returns: * dict: apply information .. py:data:: dblistall .. py:function:: modelNameIsFree(modnm, type, args, reload=True) .. py:function:: modelNameExists(modnm, type, args, reload=True) .. py:function:: dbInfoForModel(modnm, args, reload=True) .. py:function:: getModelType(infos) Gets model type Parameters: * infos (dict): example file info Returns: * str: Type ofmodel/workflow .. py:function:: getSaveLoc(outnm, ftype, args)