Skip to content

Instantly share code, notes, and snippets.

View kudkudak's full-sized avatar
馃槂

Stanislaw Jastrzebski kudkudak

馃槂
View GitHub Profile
def get_sabina_clusters(protein, fingerprint):
# Read data
actives, inactives = get_protein_fingerprint_cluster_files(protein, fingerprint)
clusters_active = []
for a, _ in actives:
clusters_active.append(pd.io.parsers.read_csv(os.path.join(c["DATA_DIR"], a), header=None).as_matrix().astype("float32"))
inactive = pd.io.parsers.read_csv(os.path.join(c["DATA_DIR"], inactives), header=None).as_matrix().astype("float32")
protein = "beta2"
fingerprint = "KlekFP"
# Read data, not important
actives, inactives = get_protein_fingerprint_cluster_files(protein, fingerprint)
clusters_active = []
for a, _ in actives:
clusters_active.append(pd.io.parsers.read_csv(os.path.join(c["DATA_DIR"], a), header=None).as_matrix().astype("float32"))
inactive = pd.io.parsers.read_csv(os.path.join(c["DATA_DIR"], inactives), header=None).as_matrix().astype("float32")
[('actives/beta2_actives_cluster1_KlekFP.csv', 1), ('actives/beta2_actives_cluster2_KlekFP.csv', 2), ('actives/beta2_actives_cluster3_KlekFP.csv', 3), ('actives/beta2_actives_cluster4_KlekFP.csv', 4), ('actives/beta2_actives_cluster5_KlekFP.csv', 5), ('actives/beta2_actives_cluster6_KlekFP.csv', 6)] inactives/beta2_inactives_KlekFP.csv
Sizes: [408, 548, 548, 22, 2, 114]
Clusters 2 and 1
Shared examples # : 474
Indices of examples:
( 0 0 )
( 1 1 )
( 2 2 )
( 3 3 )
( 144 4 )
def hit_and_run(X, Y, N=100, T=10, sub_sample_size=100, eps=0.5):
"""
@param N hypothesis of points wanted
@param T number of mixing iterations
@param sub_sample_size how many samples of hypothesis take on the ray.
@param eps noise level. Note that i should be pretty big
"""
X = X[Y.known_ids]
Y = Y[Y.known_ids]
def pick_h(protein, fingerprint, loader, model=TWELM, full_param_grid = {'C': list(np.logspace(0, 5, 6)),
'h': [100, 200, 500, 1000]}):
comps = [[protein, fingerprint]]
loader = copy.deepcopy(loader)
preprocess_fncs = []
data = get_data(comps, loader, preprocess_fncs).values()[0][0][0]
import sys
sys.path.append("/home/ubuntu/hackathon_bes")
from utils import *
from run_nn import *
data = get_data("christine")
fit_predict(data["X_train"], data["Y_train"], test_datasets = [data["X_test"], data["X_valid"]],
learning_rate=0.01, L1_reg=0.00, L2_reg=0.000001, n_epochs=200, batch_size = 100)
def wac_score(y_true, y_pred):
"""
Parameters
----------
y_true: numpy.ndarray
True labels
y_pred: numpy.ndarray
Estimated labels
Returns
-------
# Ensure somehow we have some samples known
def fit(X, y):
while True:
indices = self._query_labels(X, y)
if not oracle(indices, y):
# No budget
break
# coding: utf-8
# In[1]:
get_ipython().magic(u'load_ext autoreload')
get_ipython().magic(u'autoreload 2')
import sys
sys.path.append("/afs/inf.ed.ac.uk/user/v/v1sjastr/scratch/v1sjastr/go-deep/")
import numpy as np
@kudkudak
kudkudak / clustering_1.md
Last active December 9, 2015 17:17
clustering_1

Klastry kluczy MACCS wygenerowane przez sklastrowanie wektor贸w, kt贸re wygenerowa艂em dla ka偶dego bitu z MACCS.

Ka偶dy klaster jest opisany SMARTem zwi膮zku (czasami jest "?", to mo偶e by膰 artefakt rdkit kt贸rego u偶ywa艂em), kt贸ry jest najbli偶ej 艣rodka klastru. Pod obrazkiem zamie艣ci艂em listy wszystkich kluczy w danym klastrze.

Ka偶dy SMARTS (klucz MACCS) reprezentuj臋 ok. 5 strukturami kt贸re do niego pasuj膮. Czyli na ka偶dy klaster przypada ok 5*ilo艣膰_kluczy_w_klastrze obrazk贸w.

Zamieszczam te偶 dwa klastrowania. Czy s膮 jakie艣 r贸偶nice pomi臋dzy nimi?

Na ko艅cu zamie艣ci艂em wyniki klasyfikacji 5ht6