Skip to content

Commit

Permalink
Merge pull request #2 from MukuFlash03/consolidate-differences
Browse files Browse the repository at this point in the history
Try-except block brought to the top
  • Loading branch information
MukuFlash03 authored Apr 16, 2024
2 parents 7f0d5f0 + 05551c8 commit cabc98a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
17 changes: 8 additions & 9 deletions emission/analysis/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,17 @@
import os

def get_config_data():
if os.getenv("PROD_STAGE") == "TRUE":
print("In production environment, opening internal debug.conf")
config_file = open('conf/analysis/debug.conf.internal.json')
else:
try:
print("Trying to open debug.conf.json")
config_file = open('conf/analysis/debug.conf.json')
except:
try:
print("Trying to open debug.conf.json")
config_file = open('conf/analysis/debug.conf.json')
except:
if os.getenv("PROD_STAGE") == "TRUE":
print("In production environment, opening internal debug.conf")
config_file = open('conf/analysis/debug.conf.internal.json')
else:
print("analysis.debug.conf.json not configured, falling back to sample, default configuration")
config_file = open('conf/analysis/debug.conf.json.sample')
ret_val = json.load(config_file)
print(ret_val)
config_file.close()
return ret_val

Expand Down
1 change: 1 addition & 0 deletions seed_model.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"py/object": "sklearn.ensemble._forest.RandomForestClassifier", "py/state": {"base_estimator": {"py/object": "sklearn.tree._classes.DecisionTreeClassifier", "py/state": {"class_weight": null, "classes_": null, "criterion": "gini", "max_depth": null, "max_features": null, "max_features_": null, "max_leaf_nodes": null, "min_impurity_split": 1e-07, "min_samples_leaf": 1, "min_samples_split": 2, "min_weight_fraction_leaf": 0.0, "n_classes_": null, "n_features_": null, "n_outputs_": null, "presort": false, "random_state": null, "splitter": "best", "tree_": null, "_sklearn_version": "0.23.2"}}, "base_estimator_": {"py/id": 1}, "bootstrap": true, "class_weight": null, "classes_": {"py/object": "numpy.ndarray", "dtype": "float64", "values": [1.0, 5.0]}, "criterion": "gini", "estimator_params": {"py/tuple": ["criterion", "max_depth", "min_samples_split", "min_samples_leaf", "min_weight_fraction_leaf", "max_features", "max_leaf_nodes", "min_impurity_split", "random_state"]}, "estimators_": [{"py/object": "sklearn.tree._classes.DecisionTreeClassifier", "py/state": {"class_weight": null, "classes_": {"py/object": "numpy.ndarray", "dtype": "float64", "values": [0.0, 1.0]}, "criterion": "gini", "max_depth": null, "max_features": "auto", "max_features_": 3, "max_leaf_nodes": null, "min_impurity_split": 1e-07, "min_samples_leaf": 1, "min_samples_split": 2, "min_weight_fraction_leaf": 0.0, "n_classes_": {"py/object": "numpy.int64", "dtype": "int64", "value": 2}, "n_features_": 13, "n_outputs_": 1, "presort": false, "random_state": 1842313873, "splitter": "best", "tree_": {"py/reduce": [{"py/type": "sklearn.tree._tree.Tree"}, {"py/tuple": [13, {"py/object": "numpy.ndarray", "dtype": "int64", "values": [2]}, 1]}, {"max_depth": 1, "node_count": 3, "nodes": {"py/object": "numpy.ndarray", "dtype": "[('left_child', '<i8'), ('right_child', '<i8'), ('feature', '<i8'), ('threshold', '<f8'), ('impurity', '<f8'), ('n_node_samples', '<i8'), ('weighted_n_node_samples', '<f8')]", "values": [{"py/tuple": [1, 2, 0, 1609.96044921875, 0.49586776859504134, 9, 11.0]}, {"py/tuple": [-1, -1, -2, -2.0, 0.0, 4, 5.0]}, {"py/tuple": [-1, -1, -2, -2.0, 0.0, 5, 6.0]}]}, "values": {"py/object": "numpy.ndarray", "dtype": "float64", "values": [[[5.0, 6.0]], [[5.0, 0.0]], [[0.0, 6.0]]]}}]}, "_sklearn_version": "0.23.2"}}, {"py/object": "sklearn.tree._classes.DecisionTreeClassifier", "py/state": {"class_weight": null, "classes_": {"py/object": "numpy.ndarray", "dtype": "float64", "values": [0.0, 1.0]}, "criterion": "gini", "max_depth": null, "max_features": "auto", "max_features_": 3, "max_leaf_nodes": null, "min_impurity_split": 1e-07, "min_samples_leaf": 1, "min_samples_split": 2, "min_weight_fraction_leaf": 0.0, "n_classes_": {"py/object": "numpy.int64", "dtype": "int64", "value": 2}, "n_features_": 13, "n_outputs_": 1, "presort": false, "random_state": 513861128, "splitter": "best", "tree_": {"py/reduce": [{"py/type": "sklearn.tree._tree.Tree"}, {"py/tuple": [13, {"py/object": "numpy.ndarray", "dtype": "int64", "values": [2]}, 1]}, {"max_depth": 2, "node_count": 5, "nodes": {"py/object": "numpy.ndarray", "dtype": "[('left_child', '<i8'), ('right_child', '<i8'), ('feature', '<i8'), ('threshold', '<f8'), ('impurity', '<f8'), ('n_node_samples', '<i8'), ('weighted_n_node_samples', '<f8')]", "values": [{"py/tuple": [1, 4, 10, 0.5, 0.49586776859504134, 7, 11.0]}, {"py/tuple": [2, 3, 2, 0.44721126556396484, 0.24489795918367352, 4, 7.0]}, {"py/tuple": [-1, -1, -2, -2.0, 0.0, 3, 6.0]}, {"py/tuple": [-1, -1, -2, -2.0, 0.0, 1, 1.0]}, {"py/tuple": [-1, -1, -2, -2.0, 0.0, 3, 4.0]}]}, "values": {"py/object": "numpy.ndarray", "dtype": "float64", "values": [[[6.0, 5.0]], [[6.0, 1.0]], [[6.0, 0.0]], [[0.0, 1.0]], [[0.0, 4.0]]]}}]}, "_sklearn_version": "0.23.2"}}, {"py/object": "sklearn.tree._classes.DecisionTreeClassifier", "py/state": {"class_weight": null, "classes_": {"py/object": "numpy.ndarray", "dtype": "float64", "values": [0.0, 1.0]}, "criterion": "gini", "max_depth": null, "max_features": "auto", "max_features_": 3, "max_leaf_nodes": null, "min_impurity_split": 1e-07, "min_samples_leaf": 1, "min_samples_split": 2, "min_weight_fraction_leaf": 0.0, "n_classes_": {"py/object": "numpy.int64", "dtype": "int64", "value": 2}, "n_features_": 13, "n_outputs_": 1, "presort": false, "random_state": 1777896046, "splitter": "best", "tree_": {"py/reduce": [{"py/type": "sklearn.tree._tree.Tree"}, {"py/tuple": [13, {"py/object": "numpy.ndarray", "dtype": "int64", "values": [2]}, 1]}, {"max_depth": 1, "node_count": 3, "nodes": {"py/object": "numpy.ndarray", "dtype": "[('left_child', '<i8'), ('right_child', '<i8'), ('feature', '<i8'), ('threshold', '<f8'), ('impurity', '<f8'), ('n_node_samples', '<i8'), ('weighted_n_node_samples', '<f8')]", "values": [{"py/tuple": [1, 2, 0, 1609.96044921875, 0.49586776859504134, 6, 11.0]}, {"py/tuple": [-1, -1, -2, -2.0, 0.0, 4, 5.0]}, {"py/tuple": [-1, -1, -2, -2.0, 0.0, 2, 6.0]}]}, "values": {"py/object": "numpy.ndarray", "dtype": "float64", "values": [[[5.0, 6.0]], [[5.0, 0.0]], [[0.0, 6.0]]]}}]}, "_sklearn_version": "0.23.2"}}, {"py/object": "sklearn.tree._classes.DecisionTreeClassifier", "py/state": {"class_weight": null, "classes_": {"py/object": "numpy.ndarray", "dtype": "float64", "values": [0.0, 1.0]}, "criterion": "gini", "max_depth": null, "max_features": "auto", "max_features_": 3, "max_leaf_nodes": null, "min_impurity_split": 1e-07, "min_samples_leaf": 1, "min_samples_split": 2, "min_weight_fraction_leaf": 0.0, "n_classes_": {"py/object": "numpy.int64", "dtype": "int64", "value": 2}, "n_features_": 13, "n_outputs_": 1, "presort": false, "random_state": 2116785162, "splitter": "best", "tree_": {"py/reduce": [{"py/type": "sklearn.tree._tree.Tree"}, {"py/tuple": [13, {"py/object": "numpy.ndarray", "dtype": "int64", "values": [2]}, 1]}, {"max_depth": 1, "node_count": 3, "nodes": {"py/object": "numpy.ndarray", "dtype": "[('left_child', '<i8'), ('right_child', '<i8'), ('feature', '<i8'), ('threshold', '<f8'), ('impurity', '<f8'), ('n_node_samples', '<i8'), ('weighted_n_node_samples', '<f8')]", "values": [{"py/tuple": [1, 2, 10, 0.5, 0.4628099173553719, 7, 11.0]}, {"py/tuple": [-1, -1, -2, -2.0, 0.0, 3, 4.0]}, {"py/tuple": [-1, -1, -2, -2.0, 0.0, 4, 7.0]}]}, "values": {"py/object": "numpy.ndarray", "dtype": "float64", "values": [[[4.0, 7.0]], [[4.0, 0.0]], [[0.0, 7.0]]]}}]}, "_sklearn_version": "0.23.2"}}, {"py/object": "sklearn.tree._classes.DecisionTreeClassifier", "py/state": {"class_weight": null, "classes_": {"py/object": "numpy.ndarray", "dtype": "float64", "values": [0.0, 1.0]}, "criterion": "gini", "max_depth": null, "max_features": "auto", "max_features_": 3, "max_leaf_nodes": null, "min_impurity_split": 1e-07, "min_samples_leaf": 1, "min_samples_split": 2, "min_weight_fraction_leaf": 0.0, "n_classes_": {"py/object": "numpy.int64", "dtype": "int64", "value": 2}, "n_features_": 13, "n_outputs_": 1, "presort": false, "random_state": 416155427, "splitter": "best", "tree_": {"py/reduce": [{"py/type": "sklearn.tree._tree.Tree"}, {"py/tuple": [13, {"py/object": "numpy.ndarray", "dtype": "int64", "values": [2]}, 1]}, {"max_depth": 1, "node_count": 3, "nodes": {"py/object": "numpy.ndarray", "dtype": "[('left_child', '<i8'), ('right_child', '<i8'), ('feature', '<i8'), ('threshold', '<f8'), ('impurity', '<f8'), ('n_node_samples', '<i8'), ('weighted_n_node_samples', '<f8')]", "values": [{"py/tuple": [1, 2, 10, 0.5, 0.4628099173553719, 8, 11.0]}, {"py/tuple": [-1, -1, -2, -2.0, 0.0, 4, 4.0]}, {"py/tuple": [-1, -1, -2, -2.0, 0.0, 4, 7.0]}]}, "values": {"py/object": "numpy.ndarray", "dtype": "float64", "values": [[[4.0, 7.0]], [[4.0, 0.0]], [[0.0, 7.0]]]}}]}, "_sklearn_version": "0.23.2"}}, {"py/object": "sklearn.tree._classes.DecisionTreeClassifier", "py/state": {"class_weight": null, "classes_": {"py/object": "numpy.ndarray", "dtype": "float64", "values": [0.0, 1.0]}, "criterion": "gini", "max_depth": null, "max_features": "auto", "max_features_": 3, "max_leaf_nodes": null, "min_impurity_split": 1e-07, "min_samples_leaf": 1, "min_samples_split": 2, "min_weight_fraction_leaf": 0.0, "n_classes_": {"py/object": "numpy.int64", "dtype": "int64", "value": 2}, "n_features_": 13, "n_outputs_": 1, "presort": false, "random_state": 2057431241, "splitter": "best", "tree_": {"py/reduce": [{"py/type": "sklearn.tree._tree.Tree"}, {"py/tuple": [13, {"py/object": "numpy.ndarray", "dtype": "int64", "values": [2]}, 1]}, {"max_depth": 1, "node_count": 3, "nodes": {"py/object": "numpy.ndarray", "dtype": "[('left_child', '<i8'), ('right_child', '<i8'), ('feature', '<i8'), ('threshold', '<f8'), ('impurity', '<f8'), ('n_node_samples', '<i8'), ('weighted_n_node_samples', '<f8')]", "values": [{"py/tuple": [1, 2, 0, 1609.96044921875, 0.4628099173553719, 5, 11.0]}, {"py/tuple": [-1, -1, -2, -2.0, 0.0, 2, 4.0]}, {"py/tuple": [-1, -1, -2, -2.0, 0.0, 3, 7.0]}]}, "values": {"py/object": "numpy.ndarray", "dtype": "float64", "values": [[[4.0, 7.0]], [[4.0, 0.0]], [[0.0, 7.0]]]}}]}, "_sklearn_version": "0.23.2"}}, {"py/object": "sklearn.tree._classes.DecisionTreeClassifier", "py/state": {"class_weight": null, "classes_": {"py/object": "numpy.ndarray", "dtype": "float64", "values": [0.0, 1.0]}, "criterion": "gini", "max_depth": null, "max_features": "auto", "max_features_": 3, "max_leaf_nodes": null, "min_impurity_split": 1e-07, "min_samples_leaf": 1, "min_samples_split": 2, "min_weight_fraction_leaf": 0.0, "n_classes_": {"py/object": "numpy.int64", "dtype": "int64", "value": 2}, "n_features_": 13, "n_outputs_": 1, "presort": false, "random_state": 251491391, "splitter": "best", "tree_": {"py/reduce": [{"py/type": "sklearn.tree._tree.Tree"}, {"py/tuple": [13, {"py/object": "numpy.ndarray", "dtype": "int64", "values": [2]}, 1]}, {"max_depth": 1, "node_count": 3, "nodes": {"py/object": "numpy.ndarray", "dtype": "[('left_child', '<i8'), ('right_child', '<i8'), ('feature', '<i8'), ('threshold', '<f8'), ('impurity', '<f8'), ('n_node_samples', '<i8'), ('weighted_n_node_samples', '<f8')]", "values": [{"py/tuple": [1, 2, 2, 0.44721126556396484, 0.39669421487603307, 7, 11.0]}, {"py/tuple": [-1, -1, -2, -2.0, 0.0, 4, 8.0]}, {"py/tuple": [-1, -1, -2, -2.0, 0.0, 3, 3.0]}]}, "values": {"py/object": "numpy.ndarray", "dtype": "float64", "values": [[[8.0, 3.0]], [[8.0, 0.0]], [[0.0, 3.0]]]}}]}, "_sklearn_version": "0.23.2"}}, {"py/object": "sklearn.tree._classes.DecisionTreeClassifier", "py/state": {"class_weight": null, "classes_": {"py/object": "numpy.ndarray", "dtype": "float64", "values": [0.0, 1.0]}, "criterion": "gini", "max_depth": null, "max_features": "auto", "max_features_": 3, "max_leaf_nodes": null, "min_impurity_split": 1e-07, "min_samples_leaf": 1, "min_samples_split": 2, "min_weight_fraction_leaf": 0.0, "n_classes_": {"py/object": "numpy.int64", "dtype": "int64", "value": 2}, "n_features_": 13, "n_outputs_": 1, "presort": false, "random_state": 499412832, "splitter": "best", "tree_": {"py/reduce": [{"py/type": "sklearn.tree._tree.Tree"}, {"py/tuple": [13, {"py/object": "numpy.ndarray", "dtype": "int64", "values": [2]}, 1]}, {"max_depth": 1, "node_count": 3, "nodes": {"py/object": "numpy.ndarray", "dtype": "[('left_child', '<i8'), ('right_child', '<i8'), ('feature', '<i8'), ('threshold', '<f8'), ('impurity', '<f8'), ('n_node_samples', '<i8'), ('weighted_n_node_samples', '<f8')]", "values": [{"py/tuple": [1, 2, 2, 0.44721126556396484, 0.4628099173553719, 8, 11.0]}, {"py/tuple": [-1, -1, -2, -2.0, 0.0, 3, 4.0]}, {"py/tuple": [-1, -1, -2, -2.0, 0.0, 5, 7.0]}]}, "values": {"py/object": "numpy.ndarray", "dtype": "float64", "values": [[[4.0, 7.0]], [[4.0, 0.0]], [[0.0, 7.0]]]}}]}, "_sklearn_version": "0.23.2"}}, {"py/object": "sklearn.tree._classes.DecisionTreeClassifier", "py/state": {"class_weight": null, "classes_": {"py/object": "numpy.ndarray", "dtype": "float64", "values": [0.0, 1.0]}, "criterion": "gini", "max_depth": null, "max_features": "auto", "max_features_": 3, "max_leaf_nodes": null, "min_impurity_split": 1e-07, "min_samples_leaf": 1, "min_samples_split": 2, "min_weight_fraction_leaf": 0.0, "n_classes_": {"py/object": "numpy.int64", "dtype": "int64", "value": 2}, "n_features_": 13, "n_outputs_": 1, "presort": false, "random_state": 1059729264, "splitter": "best", "tree_": {"py/reduce": [{"py/type": "sklearn.tree._tree.Tree"}, {"py/tuple": [13, {"py/object": "numpy.ndarray", "dtype": "int64", "values": [2]}, 1]}, {"max_depth": 1, "node_count": 3, "nodes": {"py/object": "numpy.ndarray", "dtype": "[('left_child', '<i8'), ('right_child', '<i8'), ('feature', '<i8'), ('threshold', '<f8'), ('impurity', '<f8'), ('n_node_samples', '<i8'), ('weighted_n_node_samples', '<f8')]", "values": [{"py/tuple": [1, 2, 0, 1609.96044921875, 0.49586776859504134, 7, 11.0]}, {"py/tuple": [-1, -1, -2, -2.0, 0.0, 3, 5.0]}, {"py/tuple": [-1, -1, -2, -2.0, 0.0, 4, 6.0]}]}, "values": {"py/object": "numpy.ndarray", "dtype": "float64", "values": [[[5.0, 6.0]], [[5.0, 0.0]], [[0.0, 6.0]]]}}]}, "_sklearn_version": "0.23.2"}}, {"py/object": "sklearn.tree._classes.DecisionTreeClassifier", "py/state": {"class_weight": null, "classes_": {"py/object": "numpy.ndarray", "dtype": "float64", "values": [0.0, 1.0]}, "criterion": "gini", "max_depth": null, "max_features": "auto", "max_features_": 3, "max_leaf_nodes": null, "min_impurity_split": 1e-07, "min_samples_leaf": 1, "min_samples_split": 2, "min_weight_fraction_leaf": 0.0, "n_classes_": {"py/object": "numpy.int64", "dtype": "int64", "value": 2}, "n_features_": 13, "n_outputs_": 1, "presort": false, "random_state": 1831165987, "splitter": "best", "tree_": {"py/reduce": [{"py/type": "sklearn.tree._tree.Tree"}, {"py/tuple": [13, {"py/object": "numpy.ndarray", "dtype": "int64", "values": [2]}, 1]}, {"max_depth": 2, "node_count": 5, "nodes": {"py/object": "numpy.ndarray", "dtype": "[('left_child', '<i8'), ('right_child', '<i8'), ('feature', '<i8'), ('threshold', '<f8'), ('impurity', '<f8'), ('n_node_samples', '<i8'), ('weighted_n_node_samples', '<f8')]", "values": [{"py/tuple": [1, 4, 10, 0.5, 0.2975206611570248, 6, 11.0]}, {"py/tuple": [2, 3, 0, 1609.96044921875, 0.4444444444444444, 3, 6.0]}, {"py/tuple": [-1, -1, -2, -2.0, 0.0, 2, 2.0]}, {"py/tuple": [-1, -1, -2, -2.0, 0.0, 1, 4.0]}, {"py/tuple": [-1, -1, -2, -2.0, 0.0, 3, 5.0]}]}, "values": {"py/object": "numpy.ndarray", "dtype": "float64", "values": [[[2.0, 9.0]], [[2.0, 4.0]], [[2.0, 0.0]], [[0.0, 4.0]], [[0.0, 5.0]]]}}]}, "_sklearn_version": "0.23.2"}}], "max_depth": null, "max_features": "auto", "max_leaf_nodes": null, "min_impurity_split": 1e-07, "min_samples_leaf": 1, "min_samples_split": 2, "min_weight_fraction_leaf": 0.0, "n_classes_": 2, "n_estimators": 10, "n_features_": 13, "n_jobs": 1, "n_outputs_": 1, "oob_score": false, "random_state": null, "verbose": 0, "warm_start": false, "_sklearn_version": "0.23.2"}}

0 comments on commit cabc98a

Please sign in to comment.