## skchem.cross_validation.similarity_threshold
Similarity threshold dataset partitioning functionality.
skchem.cross_validation.similarity_threshold.SimThresholdSplit(min_threshold=0.45, largest_cluster_fraction=0.1, fper='morgan', similarity_metric='jaccard', memory_optimized=True, n_jobs=1, block_width=1000, verbose=False)[source]¶Bases: object
block_width¶The width of the subsets of features. Only used in parallelized.
fit(inp, pairs=None)[source]¶| Parameters: | inp –
|
|---|
k_fold(n_folds)[source]¶Returns k-fold cross-validated folds with thresholded similarity.
| Parameters: | n_folds (int) – The number of folds to provide. |
|---|---|
| Returns: | generator[ – The splits in series. |
| Return type: | pd.Series, pd.Series |
n_instances_¶The number of instances that were used to fit the object.
n_jobs¶The number of processes to use to calculate the distance matrix. -1 for all available.
split(ratio)[source]¶Return splits of the data with thresholded similarity according to a specified ratio.
| Parameters: | ratio (tuple[ints]) – the ratio to use. |
|---|---|
| Returns: | Generator of boolean split masks for the reqested splits. |
| Return type: | generator[pd.Series] |
Example
st = SimThresholdSplit(ms, fper=’morgan’, similarity_metric=’jaccard’) train, valid, test = st.split(ratio=(70, 15, 15))
visualize_similarities(subsample=5000, ax=None)[source]¶Plot a histogram of similarities, with the threshold plotted.
| Parameters: |
|
|---|---|
| Returns: | matplotlib.axes |
visualize_space(dim_reducer='tsne', dim_red_kw={}, subsample=5000, ax=None, c=None)[source]¶Plot chemical space using a transformer
| Parameters: |
|
|---|---|
| Returns: | matplotlib.axes |
## skchem.cross_validation
Module implementing cross validation routines useful for chemical data.
skchem.cross_validation.SimThresholdSplit(min_threshold=0.45, largest_cluster_fraction=0.1, fper='morgan', similarity_metric='jaccard', memory_optimized=True, n_jobs=1, block_width=1000, verbose=False)[source]¶Bases: object
block_width¶The width of the subsets of features. Only used in parallelized.
fit(inp, pairs=None)[source]¶| Parameters: | inp –
|
|---|
k_fold(n_folds)[source]¶Returns k-fold cross-validated folds with thresholded similarity.
| Parameters: | n_folds (int) – The number of folds to provide. |
|---|---|
| Returns: | generator[ – The splits in series. |
| Return type: | pd.Series, pd.Series |
n_instances_¶The number of instances that were used to fit the object.
n_jobs¶The number of processes to use to calculate the distance matrix. -1 for all available.
split(ratio)[source]¶Return splits of the data with thresholded similarity according to a specified ratio.
| Parameters: | ratio (tuple[ints]) – the ratio to use. |
|---|---|
| Returns: | Generator of boolean split masks for the reqested splits. |
| Return type: | generator[pd.Series] |
Example
st = SimThresholdSplit(ms, fper=’morgan’, similarity_metric=’jaccard’) train, valid, test = st.split(ratio=(70, 15, 15))
visualize_similarities(subsample=5000, ax=None)[source]¶Plot a histogram of similarities, with the threshold plotted.
| Parameters: |
|
|---|---|
| Returns: | matplotlib.axes |
visualize_space(dim_reducer='tsne', dim_red_kw={}, subsample=5000, ax=None, c=None)[source]¶Plot chemical space using a transformer
| Parameters: |
|
|---|---|
| Returns: | matplotlib.axes |