forked from enviPath/enviPy
Model Building UI Flag (#39)
Fixes #8 Flag only disables UI Elements Co-authored-by: Tim Lorsbach <tim@lorsba.ch> Reviewed-on: enviPath/enviPy#39
This commit is contained in:
@ -260,6 +260,8 @@ CELERY_RESULT_BACKEND = 'redis://localhost:6379/1'
|
|||||||
CELERY_ACCEPT_CONTENT = ['json']
|
CELERY_ACCEPT_CONTENT = ['json']
|
||||||
CELERY_TASK_SERIALIZER = 'json'
|
CELERY_TASK_SERIALIZER = 'json'
|
||||||
|
|
||||||
|
MODEL_BUILDING_ENABLED = os.environ.get('MODEL_BUILDING_ENABLED', 'False') == 'True'
|
||||||
|
|
||||||
DEFAULT_RF_MODEL_PARAMS = {
|
DEFAULT_RF_MODEL_PARAMS = {
|
||||||
'base_clf': RandomForestClassifier(
|
'base_clf': RandomForestClassifier(
|
||||||
n_estimators=100,
|
n_estimators=100,
|
||||||
@ -312,3 +314,12 @@ if SENTRY_ENABLED:
|
|||||||
# see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
|
# see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
|
||||||
send_default_pii=True,
|
send_default_pii=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# compile into digestible flags
|
||||||
|
FLAGS = {
|
||||||
|
'MODEL_BUILDING': MODEL_BUILDING_ENABLED,
|
||||||
|
'CELERY': FLAG_CELERY_PRESENT,
|
||||||
|
'PLUGINS': PLUGINS_ENABLED,
|
||||||
|
'SENTRY': SENTRY_ENABLED,
|
||||||
|
'ENVIFORMER': ENVIFORMER_PRESENT,
|
||||||
|
}
|
||||||
|
|||||||
@ -158,7 +158,7 @@ def get_base_context(request, for_user=None) -> Dict[str, Any]:
|
|||||||
'writeable_packages': PackageManager.get_all_writeable_packages(current_user),
|
'writeable_packages': PackageManager.get_all_writeable_packages(current_user),
|
||||||
'available_groups': GroupManager.get_groups(current_user),
|
'available_groups': GroupManager.get_groups(current_user),
|
||||||
'available_settings': SettingManager.get_all_settings(current_user),
|
'available_settings': SettingManager.get_all_settings(current_user),
|
||||||
'enabled_features': [],
|
'enabled_features': s.FLAGS,
|
||||||
'debug': s.DEBUG,
|
'debug': s.DEBUG,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -572,9 +572,12 @@ def package_models(request, package_uuid):
|
|||||||
context['model_types'] = {
|
context['model_types'] = {
|
||||||
'ML Relative Reasoning': 'ml-relative-reasoning',
|
'ML Relative Reasoning': 'ml-relative-reasoning',
|
||||||
'Rule Based Relative Reasoning': 'rule-based-relative-reasoning',
|
'Rule Based Relative Reasoning': 'rule-based-relative-reasoning',
|
||||||
'EnviFormer': 'enviformer',
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if s.FLAGS.get('ENVIFORMER', False):
|
||||||
|
context['model_types']['EnviFormer'] = 'enviformer'
|
||||||
|
|
||||||
|
if s.FLAGS.get('PLUGINS', False):
|
||||||
for k, v in s.CLASSIFIER_PLUGINS.items():
|
for k, v in s.CLASSIFIER_PLUGINS.items():
|
||||||
context['model_types'][v.display()] = k
|
context['model_types'][v.display()] = k
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
{% if meta.can_edit %}
|
{% if meta.can_edit and meta.enabled_features.MODEL_BUILDING %}
|
||||||
<li>
|
<li>
|
||||||
<a role="button" data-toggle="modal" data-target="#new_model_modal">
|
<a role="button" data-toggle="modal" data-target="#new_model_modal">
|
||||||
<span class="glyphicon glyphicon-plus"></span> New Model</a>
|
<span class="glyphicon glyphicon-plus"></span> New Model</a>
|
||||||
|
|||||||
@ -77,7 +77,7 @@
|
|||||||
class="form-control">
|
class="form-control">
|
||||||
<option value="MACCS" selected>MACCS Fingerprinter</option>
|
<option value="MACCS" selected>MACCS Fingerprinter</option>
|
||||||
</select>
|
</select>
|
||||||
{% if 'plugins' in meta.enabled_features %}
|
{% if meta.enabled_features.PLUGINS %}
|
||||||
<!-- Property Plugins go here -->
|
<!-- Property Plugins go here -->
|
||||||
<label for="ml-relative-reasoning-additional-fingerprinter">Fingerprinter</label>
|
<label for="ml-relative-reasoning-additional-fingerprinter">Fingerprinter</label>
|
||||||
<select id="ml-relative-reasoning-additional-fingerprinter"
|
<select id="ml-relative-reasoning-additional-fingerprinter"
|
||||||
@ -86,7 +86,7 @@
|
|||||||
</select>
|
</select>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<label for="ml-relative-reasoning-threshold">Threshold</label>
|
<label for="ml-relative-reasoning-threshold">Threshold</label>
|
||||||
<input type="number" min="0" , max="1" step="0.05" value="0.5"
|
<input type="number" min="0" max="1" step="0.05" value="0.5"
|
||||||
id="ml-relative-reasoning-threshold"
|
id="ml-relative-reasoning-threshold"
|
||||||
name="ml-relative-reasoning-threshold" class="form-control">
|
name="ml-relative-reasoning-threshold" class="form-control">
|
||||||
|
|
||||||
@ -122,7 +122,7 @@
|
|||||||
name="enviformer-threshold" class="form-control">
|
name="enviformer-threshold" class="form-control">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if 'applicability_domain' in enabled_features %}
|
{% if meta.enabled_features.APPLICABILITY_DOMAIN %}
|
||||||
<div class="modal-body hide" data-step="3" data-title="Advanced Options II">
|
<div class="modal-body hide" data-step="3" data-title="Advanced Options II">
|
||||||
<div class="jumbotron">Selection of parameter values for the Applicability Domain process.
|
<div class="jumbotron">Selection of parameter values for the Applicability Domain process.
|
||||||
Number of Neighbours refers to a requirement on the minimum number of compounds from the
|
Number of Neighbours refers to a requirement on the minimum number of compounds from the
|
||||||
|
|||||||
Reference in New Issue
Block a user