<jupyter_start><jupyter_text>Getting the data<jupyter_code>df = pd.read_csv('data/jak2.csv')
PandasTools.AddMoleculeColumnToFrame(df,'smiles','Molecule',includeFingerprints=True)
df
plt.hist(df.value)
plt.show()<jupyter_output><empty_output><jupyter_text>Building a predictive model<jupyter_code>X = [AllChem.GetMorganFingerprintAsBitVect(x, useChirality=False, radius=2) for x in df.Molecule]
y = np.array(df.label)

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=0)
classifier = RandomForestClassifier()
classifier.fit(X_train, y_train)
y_pred = classifier.predict(X_test)
plot_confusion_matrix(classifier, X_test, y_test)
print(classification_report(y_test,y_pred))
pickle.dump(classifier, open('data/activity_model_jak2.pkl', 'wb'))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13043478260869565, 'fraction_numerical': 0.007453416149068323, 'mean_word_length': 11.4, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '302683', 'license': 'MIT', 'n_tokens_mistral': 330, 'n_tokens_neox': 318, 'n_words': 41, 'path': 'jak2_predictive_modeling.ipynb', 'repo_name': 'maxime-langevin/REINVENT', 'size': '805'}