Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed that no nmr_only = Trues were created #95

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions nmrcraft/utils/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,14 @@ def add_rows_metrics(
]
unified_metrics.loc[len(unified_metrics)] = new_row
return unified_metrics


def str2bool(value: str) -> bool:
"""Function converts a string to boolean in a human expected way.

Args (str):
<value> as a string for example 'True' or 'true' or 't'
Returns (bool):
bool corresponding to if the <value> was true or false
"""
return value.lower() in ("yes", "true", "t", "1")
6 changes: 3 additions & 3 deletions scripts/training/multi_targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from nmrcraft.models.model_configs import model_configs
from nmrcraft.models.models import load_model
from nmrcraft.training.hyperparameter_tune import HyperparameterTuner
from nmrcraft.utils.general import add_rows_metrics
from nmrcraft.utils.general import add_rows_metrics, str2bool

# Setup MLflow
mlflow.set_experiment("Final_results")
Expand All @@ -36,8 +36,8 @@
)
parser.add_argument(
"--include_structural",
type=bool,
default=False,
type=str2bool,
default="False",
help="Handles if structural features will be included or only nmr tensors are used.",
)
parser.add_argument(
Expand Down
7 changes: 3 additions & 4 deletions scripts/training/one_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from nmrcraft.models.model_configs import model_configs
from nmrcraft.models.models import load_model
from nmrcraft.training.hyperparameter_tune import HyperparameterTuner
from nmrcraft.utils.general import add_rows_metrics
from nmrcraft.utils.general import add_rows_metrics, str2bool

# Setup MLflow
mlflow.set_experiment("Final_Results")
Expand All @@ -36,8 +36,8 @@
)
parser.add_argument(
"--include_structural",
type=bool,
default=False,
type=str2bool,
default="False",
help="Handles if structural features will be included or only nmr tensors are used.",
)
parser.add_argument(
Expand Down Expand Up @@ -161,7 +161,6 @@ def main(args) -> pd.DataFrame:
# Add arguments
args = parser.parse_args()
args.target = [args.target] # FIXME

unified_metrics = main(args)

# save all the results
Expand Down
Loading