def default_config(): return { "plugins": { "supervised_classifier": plugin.make_config(get_supervised_classifier_impls()), "descriptor_index": plugin.make_config(get_descriptor_index_impls()), "classification_factory": ClassificationElementFactory.get_default_config(), }, "cross_validation": { "truth_labels": None, "num_folds": 6, "random_seed": None, "classification_use_multiprocessing": True, }, "pr_curves": { "enabled": True, "show": False, "output_directory": None, "file_prefix": None, }, "roc_curves": { "enabled": True, "show": False, "output_directory": None, "file_prefix": None, }, }
def default_config(): return { 'plugins': { 'classifier': plugin.make_config(get_classifier_impls()), 'classification_factory': ClassificationElementFactory.get_default_config(), 'descriptor_index': plugin.make_config(get_descriptor_index_impls()) }, 'utility': { 'train': False, 'csv_filepath': 'CHAMGEME :: PATH :: a csv file', 'output_plot_pr': None, 'output_plot_roc': None, 'output_plot_confusion_matrix': None, 'output_uuid_confusion_matrix': None, 'curve_confidence_interval': False, 'curve_confidence_interval_alpha': 0.4, }, "parallelism": { "descriptor_fetch_cores": 4, "classification_cores": None, }, }
def get_default_config(cls): """ Generate and return a default configuration dictionary for this class. This will be primarily used for generating what the configuration dictionary would look like for this class without instantiating it. :return: Default configuration dictionary for the class. :rtype: dict """ c = super(NearestNeighborServiceServer, cls).get_default_config() merge_dict( c, { "descriptor_factory": DescriptorElementFactory.get_default_config(), "descriptor_generator": plugin.make_config(get_descriptor_generator_impls()), "nn_index": plugin.make_config(get_nn_index_impls()), "descriptor_index": plugin.make_config(get_descriptor_index_impls()), "update_descriptor_index": False, }) return c
def get_default_config(cls): """ Generate and return a default configuration dictionary for this class. This will be primarily used for generating what the configuration dictionary would look like for this class without instantiating it. By default, we observe what this class's constructor takes as arguments, turning those argument names into configuration dictionary keys. If any of those arguments have defaults, we will add those values into the configuration dictionary appropriately. The dictionary returned should only contain JSON compliant value types. It is not be guaranteed that the configuration dictionary returned from this method is valid for construction of an instance of this class. :return: Default configuration dictionary for the class. :rtype: dict """ default = super(LSHNearestNeighborIndex, cls).get_default_config() lf_default = plugin.make_config(get_lsh_functor_impls()) default['lsh_functor'] = lf_default di_default = plugin.make_config(get_descriptor_index_impls()) default['descriptor_index'] = di_default hi_default = plugin.make_config(get_hash_index_impls()) default['hash_index'] = hi_default default['hash_index_comment'] = "'hash_index' may also be null to " \ "default to a linear index built at " \ "query time." return default
def get_default_config(cls): d = super(IqrSearch, cls).get_default_config() # Remove parent_app slot for later explicit specification. del d['parent_app'] # fill in plugin configs d['data_set'] = plugin.make_config(get_data_set_impls()) d['descr_generator'] = \ plugin.make_config(get_descriptor_generator_impls()) d['nn_index'] = plugin.make_config(get_nn_index_impls()) ri_config = plugin.make_config(get_relevancy_index_impls()) if d['rel_index_config']: ri_config.update(d['rel_index_config']) d['rel_index_config'] = ri_config df_config = DescriptorElementFactory.get_default_config() if d['descriptor_factory']: df_config.update(d['descriptor_factory'].get_config()) d['descriptor_factory'] = df_config return d
def get_default_config(cls): """ Generate and return a default configuration dictionary for this class. This will be primarily used for generating what the configuration dictionary would look like for this class without instantiating it. By default, we observe what this class's constructor takes as arguments, turning those argument names into configuration dictionary keys. If any of those arguments have defaults, we will add those values into the configuration dictionary appropriately. The dictionary returned should only contain JSON compliant value types. It is not be guaranteed that the configuration dictionary returned from this method is valid for construction of an instance of this class. :return: Default configuration dictionary for the class. :rtype: dict """ default = super(LSHNearestNeighborIndex, cls).get_default_config() lf_default = plugin.make_config(get_lsh_functor_impls) default['lsh_functor'] = lf_default di_default = plugin.make_config(get_descriptor_index_impls) default['descriptor_index'] = di_default hi_default = plugin.make_config(get_hash_index_impls) default['hash_index'] = hi_default default['hash_index_comment'] = "'hash_index' may also be null to " \ "default to a linear index built at " \ "query time." return default
def get_default_config(): return { 'plugins': { 'descriptor_set': plugin.make_config(get_descriptor_index_impls()), 'nn_index': plugin.make_config(get_nn_index_impls()) } }
def get_default_config(cls): """ Generate and return a default configuration dictionary for this class. This will be primarily used for generating what the configuration dictionary would look like for this class without instantiating it. By default, we observe what this class's constructor takes as arguments, turning those argument names into configuration dictionary keys. If any of those arguments have defaults, we will add those values into the configuration dictionary appropriately. The dictionary returned should only contain JSON compliant value types. It is not be guaranteed that the configuration dictionary returned from this method is valid for construction of an instance of this class. :return: Default configuration dictionary for the class. :rtype: dict """ default = super(FaissNearestNeighborsIndex, cls).get_default_config() data_element_default_config = plugin.make_config( get_data_element_impls()) default['index_element'] = data_element_default_config default['index_param_element'] = deepcopy(data_element_default_config) di_default = plugin.make_config(get_descriptor_index_impls()) default['descriptor_set'] = di_default kvs_default = plugin.make_config(get_key_value_store_impls()) default['idx2uid_kvs'] = kvs_default default['uid2idx_kvs'] = deepcopy(kvs_default) return default
def default_config(): return { "descriptor_generator": plugin.make_config(get_descriptor_generator_impls()), "descriptor_factory": DescriptorElementFactory.get_default_config(), "descriptor_index": plugin.make_config(get_descriptor_index_impls()) }
def get_default_config(cls): c = super(IqrService, cls).get_default_config() c_rel_index = plugin.make_config( get_relevancy_index_impls() ) merge_dict(c_rel_index, iqr_session.DFLT_REL_INDEX_CONFIG) merge_dict(c, { "iqr_service": { "positive_seed_neighbors": 500, "plugin_notes": { "relevancy_index_config": "The relevancy index config provided should not have " "persistent storage configured as it will be used in " "such a way that instances are created, built and " "destroyed often.", "descriptor_index": "This is the index from which given positive and " "negative example descriptors are retrieved from. " "Not used for nearest neighbor querying. " "This index must contain all descriptors that could " "possibly be used as positive/negative examples and " "updated accordingly.", "neighbor_index": "This is the neighbor index to pull initial near-" "positive descriptors from.", "classifier_config": "The configuration to use for training and using " "classifiers for the /classifier endpoint. " "When configuring a classifier for use, don't fill " "out model persistence values as many classifiers " "may be created and thrown away during this service's " "operation.", "classification_factory": "Selection of the backend in which classifications " "are stored. The in-memory version is recommended " "because normal caching mechanisms will not account " "for the variety of classifiers that can potentially " "be created via this utility.", }, "plugins": { "relevancy_index_config": c_rel_index, "descriptor_index": plugin.make_config( get_descriptor_index_impls() ), "neighbor_index": plugin.make_config(get_nn_index_impls()), "classifier_config": plugin.make_config(get_classifier_impls()), "classification_factory": ClassificationElementFactory.get_default_config(), } } }) return c
def get_default_config(): return { "descriptor_factory": DescriptorElementFactory.get_default_config(), "descriptor_generator": plugin.make_config(get_descriptor_generator_impls), "classification_factory": ClassificationElementFactory.get_default_config(), "classifier": plugin.make_config(get_classifier_impls), }
def get_default_config(cls): c = super(IqrService, cls).get_default_config() c_rel_index = plugin.make_config(get_relevancy_index_impls()) merge_dict(c_rel_index, iqr_session.DFLT_REL_INDEX_CONFIG) merge_dict( c, { "iqr_service": { "positive_seed_neighbors": 500, "plugin_notes": { "relevancy_index_config": "The relevancy index config provided should not have " "persistent storage configured as it will be used in " "such a way that instances are created, built and " "destroyed often.", "descriptor_index": "This is the index from which given positive and " "negative example descriptors are retrieved from. " "Not used for nearest neighbor querying. " "This index must contain all descriptors that could " "possibly be used as positive/negative examples and " "updated accordingly.", "neighbor_index": "This is the neighbor index to pull initial near-" "positive descriptors from.", "classifier_config": "The configuration to use for training and using " "classifiers for the /classifier endpoint. " "When configuring a classifier for use, don't fill " "out model persistence values as many classifiers " "may be created and thrown away during this service's " "operation.", "classification_factory": "Selection of the backend in which classifications " "are stored. The in-memory version is recommended " "because normal caching mechanisms will not account " "for the variety of classifiers that can potentially " "be created via this utility.", }, "plugins": { "relevancy_index_config": c_rel_index, "descriptor_index": plugin.make_config(get_descriptor_index_impls()), "neighbor_index": plugin.make_config(get_nn_index_impls()), "classifier_config": plugin.make_config(get_classifier_impls()), "classification_factory": ClassificationElementFactory.get_default_config(), } } }) return c
def get_default_config(): return { "descriptor_factory": DescriptorElementFactory.get_default_config(), "descriptor_generator": plugin.make_config(get_descriptor_generator_impls()), "classification_factory": ClassificationElementFactory.get_default_config(), "classifier": plugin.make_config(get_classifier_impls()), }
def default_config(): return { "utility": { "report_interval": 1.0, "use_multiprocessing": False, "pickle_protocol": -1, }, "plugins": { "descriptor_index": plugin.make_config(get_descriptor_index_impls()), "lsh_functor": plugin.make_config(get_lsh_functor_impls()), }, }
def default_config(): return { "utility": { "report_interval": 1.0, "use_multiprocessing": False, }, "plugins": { "descriptor_index": plugin.make_config(get_descriptor_index_impls()), "lsh_functor": plugin.make_config(get_lsh_functor_impls()), "hash2uuid_kvstore": plugin.make_config(get_key_value_store_impls()), }, }
def default_config(): return { 'plugins': { 'descriptor_index': plugin.make_config(get_descriptor_index_impls()), } }
def get_default_config(cls): """ Generate and return a default configuration dictionary for this class. This will be primarily used for generating what the configuration dictionary would look like for this class without instantiating it. By default, we observe what this class's constructor takes as arguments, turning those argument names into configuration dictionary keys. If any of those arguments have defaults, we will add those values into the configuration dictionary appropriately. The dictionary returned should only contain JSON compliant value types. It is not be guaranteed that the configuration dictionary returned from this method is valid for construction of an instance of this class. :return: Default configuration dictionary for the class. :rtype: dict """ default = super(MRPTNearestNeighborsIndex, cls).get_default_config() di_default = plugin.make_config(get_descriptor_index_impls()) default['descriptor_set'] = di_default return default
def default_config(): # Trick for mixing in our Configurable class API on top of scikit-learn's # MiniBatchKMeans class in order to introspect construction parameters. # We never construct this class so we do not need to implement "pure # virtual" instance methods. # noinspection PyAbstractClass class MBKTemp (MiniBatchKMeans, Configurable): pass c = { "minibatch_kmeans_params": MBKTemp.get_default_config(), "descriptor_index": make_config(get_descriptor_index_impls()), # Number of descriptors to run an initial fit with. This brings the # advantage of choosing a best initialization point from multiple. "initial_fit_size": 0, # Path to save generated KMeans centroids "centroids_output_filepath_npy": "centroids.npy" } # Change/Remove some KMeans params for more appropriate defaults del c['minibatch_kmeans_params']['compute_labels'] del c['minibatch_kmeans_params']['verbose'] c['minibatch_kmeans_params']['random_state'] = 0 return c
def test_make_config(self): self.assertEqual( make_config(dummy_getter()), { 'type': None, 'DummyAlgo1': DummyAlgo1.get_default_config(), 'DummyAlgo2': DummyAlgo2.get_default_config(), })
def default_config(): # Trick for mixing in our Configurable class API on top of scikit-learn's # MiniBatchKMeans class in order to introspect construction parameters. # We never construct this class so we do not need to implement "pure # virtual" instance methods. # noinspection PyAbstractClass class MBKTemp(MiniBatchKMeans, Configurable): pass c = { "minibatch_kmeans_params": MBKTemp.get_default_config(), "descriptor_index": make_config(get_descriptor_index_impls()), # Number of descriptors to run an initial fit with. This brings the # advantage of choosing a best initialization point from multiple. "initial_fit_size": 0, # Path to save generated KMeans centroids "centroids_output_filepath_npy": "centroids.npy" } # Change/Remove some KMeans params for more appropriate defaults del c['minibatch_kmeans_params']['compute_labels'] del c['minibatch_kmeans_params']['verbose'] c['minibatch_kmeans_params']['random_state'] = 0 return c
def get_default_config(cls): """ Generate and return a default configuration dictionary for this class. This will be primarily used for generating what the configuration dictionary would look like for this class without instantiating it. By default, we observe what this class's constructor takes as arguments, turning those argument names into configuration dictionary keys. If any of those arguments have defaults, we will add those values into the configuration dictionary appropriately. The dictionary returned should only contain JSON compliant value types. It is not be guaranteed that the configuration dictionary returned from this method is valid for construction of an instance of this class. :return: Default configuration dictionary for the class. :rtype: dict """ default = super(ITQNearestNeighborsIndex, cls).get_default_config() # replace ``code_index`` with nested plugin configuration index_conf = plugin.make_config(get_code_index_impls) if default['code_index'] is not None: # Only overwrite default config if there is a default value index_conf.update(plugin.to_plugin_config(default['code_index'])) default['code_index'] = index_conf return default
def get_config(self): # Recursively get config from data element if we have one. if hasattr(self._cache_element, 'get_config'): elem_config = to_plugin_config(self._cache_element) else: # No cache element, output default config with no type. elem_config = make_config(get_data_element_impls()) return {'cache_element': elem_config}
def get_default_config(cls): """ Generate and return a default configuration dictionary for this class. This will be primarily used for generating what the configuration dictionary would look like for this class without instantiating it. :return: Default configuration dictionary for the class. :rtype: dict """ c = super(NearestNeighborServiceServer, cls).get_default_config() merge_configs(c, { "descriptor_factory": DescriptorElementFactory.get_default_config(), "descriptor_generator": plugin.make_config(get_descriptor_generator_impls), "nn_index": plugin.make_config(get_nn_index_impls), }) return c
def test_make_config(self): self.assertEqual( make_config(dummy_getter()), { 'type': None, 'DummyAlgo1': DummyAlgo1.get_default_config(), 'DummyAlgo2': DummyAlgo2.get_default_config(), } )
def default_config(): return { "utility": { "classify_overwrite": False, "parallel": { "use_multiprocessing": False, "index_extraction_cores": None, "classification_cores": None, } }, "plugins": { "classifier": plugin.make_config(get_classifier_impls()), "classification_factory": plugin.make_config(get_classification_element_impls()), "descriptor_index": plugin.make_config(get_descriptor_index_impls()), } }
def get_config(self): # Recursively get config from data element if we have one. if hasattr(self._cache_element, 'get_config'): elem_config = to_plugin_config(self._cache_element) else: # No cache element, output default config with no type. elem_config = make_config(get_data_element_impls()) return { 'cache_element': elem_config }
def default_config(): return { "utility": { "classify_overwrite": False, "parallel": { "use_multiprocessing": False, "index_extraction_cores": None, "classification_cores": None, } }, "plugins": { "classifier": plugin.make_config(get_classifier_impls()), "classification_factory": plugin.make_config( get_classification_element_impls() ), "descriptor_index": plugin.make_config( get_descriptor_index_impls() ), } }
def get_default_config(cls): c = super(ClassifierCollection, cls).get_default_config() # We list the label-classifier mapping on one level, so remove the # nested map parameter that can optionally be used in the constructor. del c['classifiers'] # Add slot of a list of classifier plugin specifications c[cls.EXAMPLE_KEY] = plugin.make_config(get_classifier_impls()) return c
def default_config(): return { 'tool': { 'girder_api_root': 'http://localhost:8080/api/v1', 'api_key': None, 'api_query_batch': 1000, 'dataset_insert_batch_size': None, }, 'plugins': { 'data_set': plugin.make_config(get_data_set_impls()), } }
def get_default_config(cls): default = super(ItqFunctor, cls).get_default_config() # Cache element parameters need to be split out into sub-configurations data_element_default_config = \ plugin.make_config(get_data_element_impls()) default['mean_vec_cache'] = data_element_default_config # Need to deepcopy source to prevent modifications on one sub-config # from reflecting in the other. default['rotation_cache'] = deepcopy(data_element_default_config) return default
def get_default_config(cls): d = super(IqrSearch, cls).get_default_config() # Remove parent_app slot for later explicit specification. del d['parent_app'] d['iqr_service_url'] = None # fill in plugin configs d['data_set'] = plugin.make_config(get_data_set_impls()) return d
def get_default_config(cls): """ Generate and return a default configuration dictionary for this class. This will be primarily used for generating what the configuration dictionary would look like for this class without instantiating it. It is not be guaranteed that the configuration dictionary returned from this method is valid for construction of an instance of this class. :return: Default configuration dictionary for the class. :rtype: dict """ return make_config(get_classification_element_impls())
def get_default_config(cls): """ Generate and return a default configuration dictionary for this class. This will be primarily used for generating what the configuration dictionary would look like for this class without instantiating it. It is not be guaranteed that the configuration dictionary returned from this method is valid for construction of an instance of this class. :return: Default configuration dictionary for the class. :rtype: dict """ return make_config(get_classification_element_impls)
def get_default_config(cls): """ Generate and return a default configuration dictionary for this class. It is not be guaranteed that the configuration dictionary returned from this method is valid for construction of an instance of this class. :return: Default configuration dictionary for the class. :rtype: dict """ c = super(KVSDataSet, cls).get_default_config() c['kvstore'] = merge_dict( plugin.make_config(get_key_value_store_impls()), plugin.to_plugin_config(c['kvstore'])) return c
def get_default_config(cls): """ Generate and return a default configuration dictionary for this class. This will be primarily used for generating what the configuration dictionary would look like for this class without instantiating it. It is not be guaranteed that the configuration dictionary returned from this method is valid for construction of an instance of this class. :return: Default configuration dictionary for the class. :rtype: dict """ default = super(MemoryKeyValueStore, cls).get_default_config() default['cache_element'] = make_config(get_data_element_impls()) return default
def get_default_config(cls): """ Generate and return a default configuration dictionary for this class. It is not be guaranteed that the configuration dictionary returned from this method is valid for construction of an instance of this class. :return: Default configuration dictionary for the class. :rtype: dict """ c = super(KVSDataSet, cls).get_default_config() c['kvstore'] = merge_dict( plugin.make_config(get_key_value_store_impls()), plugin.to_plugin_config(c['kvstore']) ) return c
def get_default_config(cls): """ Generate and return a default configuration dictionary for this class. This will be primarily used for generating what the configuration dictionary would look like for this class without instantiating it. :return: Default configuration dictionary for the class. :rtype: dict """ c = super(DescriptorServiceServer, cls).get_default_config() merge_configs(c, { "descriptor_factory": DescriptorElementFactory.get_default_config(), "descriptor_generators": { "example": plugin.make_config(get_descriptor_generator_impls) } }) return c
def default_config(): class MBKTemp (MiniBatchKMeans, Configurable): pass c = { "minibatch_kmeans_params": MBKTemp.get_default_config(), "descriptor_index": make_config(get_descriptor_index_impls()), # Number of descriptors to run an initial fit with. This brings the # advantage of choosing a best initialization point from multiple. "initial_fit_size": 0, # Path to save generated KMeans centroids "centroids_output_filepath_npy": "centroids.npy" } # Change/Remove some KMeans params for more appropriate defaults del c['minibatch_kmeans_params']['compute_labels'] del c['minibatch_kmeans_params']['verbose'] c['minibatch_kmeans_params']['random_state'] = 0 return c
def get_default_config(cls): """ Generate and return a default configuration dictionary for this class. This will be primarily used for generating what the configuration dictionary would look like for this class without instantiating it. By default, we observe what this class's constructor takes as arguments, turning those argument names into configuration dictionary keys. If any of those arguments have defaults, we will add those values into the configuration dictionary appropriately. The dictionary returned should only contain JSON compliant value types. It is not be guaranteed that the configuration dictionary returned from this method is valid for construction of an instance of this class. :return: Default configuration dictionary for the class. :rtype: dict """ c = super(LinearHashIndex, cls).get_default_config() c['cache_element'] = plugin.make_config(get_data_element_impls()) return c
def get_default_config(): return { "classifier": make_config(get_classifier_impls()), }
def default_config(): return { "data_set": plugin.make_config(get_data_set_impls()) }
def default_config(): return { "descriptor_generator": make_config(get_descriptor_generator_impls), "descriptor_factory": DescriptorElementFactory.get_default_config(), }
def default_config(): return {"data_set": plugin.make_config(get_data_set_impls())}
def default_config(): return { "itq_config": ItqFunctor.get_default_config(), "uuids_list_filepath": None, "descriptor_index": plugin.make_config(get_descriptor_index_impls()), }