Unsupervised learning finds hidden patterns, relationships, and data distributions without provided target labels. Unlike supervised learning, it learns from inputs rather than input-output pairs, making it useful when life-science data is abundant but mostly unlabeled. section 1.2.2 section 7.0
Common goals include:
- Dimensionality reduction compresses high-dimensional data, preserves useful signal, removes noise, and supports visualization. section 7.0 section 7.1
- Clustering divides compounds into similar subsets and learns its own grouping structure. section 7.0
- Density estimation models the probability distribution underlying the data and can flag low-probability points as possible outliers. section 7.0
Molecular screening and drug repurposing
A workflow loads 2,062 synthesized compounds from high-throughput screening, converts their SMILES strings into 2,048-bit Morgan fingerprints with radius 2, and uses dimensionality reduction to visualize the molecular data. IC50-based active and inactive labels are added only for supplementary analysis; the unsupervised approaches do not require them. section 7.1
Listing 7.1 Load & Featurize COVID Moonshot Data
import numpy as np
import pandas as pd
from rdkit import Chem, DataStructs
from rdkit.Chem import rdFingerprintGenerator
file_path = 'data/ch07/raw/CH07_activity_data.csv'
data = pd.read_csv(file_path)
def generate_morgan_fingerprint(smiles, radius=2, n_bits=2048):
mol = Chem.MolFromSmiles(smiles)
if mol is None:
return None
fp_gen = rdFingerprintGenerator.GetMorganGenerator(
radius=radius, fpSize=n_bits)
fp = fp_gen.GetFingerprint(mol)
arr = np.zeros((n_bits,), dtype=int)
DataStructs.ConvertToNumpyArray(fp, arr)
return arr
data['Morgan_Fingerprint'] = data['SMILES'].apply(generate_morgan_fingerprint)
data = data.dropna(subset=['Morgan_Fingerprint'])
data['label'] = np.select( #A
[data['f_avg_IC50'] < 5, data['f_avg_IC50'] >= 5], #A
[1, 2], #A
default=3, #A
) #A
fingerprints = np.array([list(fp) for fp in data['Morgan_Fingerprint']])
label_names = {1: 'Active', 2: 'Inactive', 3: 'Unknown'}Runnable Python code loads the screening dataset, parses SMILES with RDKit, generates Morgan fingerprints, converts them to NumPy arrays, and removes invalid molecules. section 7.1





















