:py:mod:`orcanet_contrib.orca_handler_util` =========================================== .. py:module:: orcanet_contrib.orca_handler_util .. autoapi-nested-parse:: Michael's orcanet utility stuff. .. !! processed by numpydoc !! Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: orcanet_contrib.orca_handler_util.update_objects orcanet_contrib.orca_handler_util.orca_sample_modifiers orcanet_contrib.orca_handler_util.orca_label_modifiers orcanet_contrib.orca_handler_util.orca_dataset_modifiers orcanet_contrib.orca_handler_util.dict_to_recarray orcanet_contrib.orca_handler_util.orca_learning_rates .. py:function:: update_objects(orga, model_file) Update the organizer for using the model. Look up and load in the respective sample-, label-, and dataset- modifiers, as well as the custom objects. Will assert that the respective objects have not already been set to a non-default value (nothing is overwritten). :Parameters: **orga** : object Organizer Contains all the configurable options in the OrcaNet scripts. **model_file** : str Path to a toml file which has the infos about which modifiers to use. .. !! processed by numpydoc !! .. py:function:: orca_sample_modifiers(name) Returns one of the sample modifiers used for Orca networks. They will permute columns, and/or add permuted columns to xs. The input to the functions is: xs_files : dict Dict that contains the input samples from the file(s). The keys are the names of the inputs in the toml list file. The values are a single batch of data from each corresponding file. The output is: xs_layer : dict Dict that contains the input samples for a Keras NN. The keys are the names of the input layers of the network. The values are a single batch of data for each input layer. :Parameters: **name** : None/str Name of the sample modifier to return. :Returns: **sample_modifier** : function The sample modifier function. .. !! processed by numpydoc !! .. py:function:: orca_label_modifiers(name) Returns one of the label modifiers used for Orca networks. CAREFUL: y_values is a structured numpy array! if you use advanced numpy indexing, this may lead to errors. Let's suppose you want to assign a particular value to one or multiple elements of the y_values array. E.g. y_values[1]['bjorkeny'] = 5 This works, since it is basic indexing. Likewise, y_values[1:3]['bjorkeny'] = 5 works as well, because basic indexing gives you a view (!). Advanced indexing though, gives you a copy. So this y_values[[1,2,4]]['bjorkeny'] = 5 will NOT work! Same with boolean indexing, like bool_idx = np.array([True,False,False,True,False]) # if len(y_values) = 5 y_values[bool_idx]['bjorkeny'] = 10 This will NOT work as well!! Instead, use np.place(y_values['bjorkeny'], bool_idx, 10) This works. :Parameters: **name** : str Name of the label modifier that should be used. :Returns: **label_modifier** : function The label modifier function. .. !! processed by numpydoc !! .. py:function:: orca_dataset_modifiers(name) Returns one of the dataset modifiers used for predicting with OrcaNet. :Parameters: **name** : str Name of the dataset modifier that should be used. .. !! processed by numpydoc !! .. py:function:: dict_to_recarray(data_dict) Convert a dict with 2d np arrays to a 2d struc array, with column names derived from the dict keys. :Parameters: **data_dict** : dict Keys: name of the output layer. Values: 2d arrays, first dimension matches :Returns: **recarray** : ndarray .. .. !! processed by numpydoc !! .. py:function:: orca_learning_rates(name, total_file_no) Returns one of the learning rate schedules used for Orca networks. :Parameters: **name** : str Name of the schedule. **total_file_no** : int How many files there are to train on. :Returns: **learning_rate** : function The learning rate schedule. .. !! processed by numpydoc !!