|
|
|
|
|
|
|
|
import math |
|
|
import pandas as pd |
|
|
import numpy as np |
|
|
import matplotlib.pyplot as plt |
|
|
from rdkit.Chem import AllChem |
|
|
from sklearn import model_selection, metrics |
|
|
from glob import glob |
|
|
from rdkit import Chem |
|
|
from molvs import Standardizer |
|
|
|
|
|
|
|
|
model_cols = ['inputs["catalyst"].components[0].identifiers[1].value', |
|
|
'inputs["aryl halide"].components[0].identifiers[0].value', |
|
|
'inputs["base"].components[0].identifiers[1].value', |
|
|
'inputs["additive"].components[0].identifiers[0].value', |
|
|
'outcomes[0].products[0].measurements[0].percentage.value' |
|
|
] |
|
|
|
|
|
|
|
|
file_path = 'data/Sanitized_Ahneman_ORD_Data.csv' |
|
|
sanitized_df = pd.read_csv(file_path) |
|
|
df = sanitized_df[model_cols] |
|
|
|
|
|
|
|
|
print(f"number of NaN values: {df.isnull().sum().sum()}") |
|
|
|
|
|
|
|
|
print("Column Info") |
|
|
df.info() |
|
|
|
|
|
|
|
|
print("Dataset Statistics for Numerical Fields:") |
|
|
df.describe() |
|
|
|
|
|
|
|
|
|
|
|
input_cols = model_cols[:-1] |
|
|
|
|
|
|
|
|
prefix = ["Catalyst", "Aryl Halide", "Base", "Additives"] |
|
|
|
|
|
|
|
|
ohe_df = pd.get_dummies(df[input_cols], prefix=prefix) |
|
|
|
|
|
|
|
|
ohe_df["yield"] = df[model_cols[-1]] / 100 |
|
|
|
|
|
|
|
|
print(ohe_df.shape) |
|
|
|
|
|
ohe_df.to_csv('data/Prepared_Data.csv', index=False) |
|
|
|
|
|
|
|
|
|