jgrid.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:jamespy_py3 作者: jskDr 项目源码 文件源码
def gs_Ridge_BIKE(A_list, yV, XX=None, alphas_log=(1, -1, 9), n_folds=5, n_jobs=-1):
    """
    As is a list of A matrices where A is similarity matrix. 
    X is a concatened linear descriptors. 
    If no X is used, X can be empty
    """

    clf = binary_model.BIKE_Ridge(A_list, XX)
    parmas = {'alpha': np.logspace(*alphas_log)}
    ln = A_list[0].shape[0]  # ls is the number of molecules.

    kf_n_c = model_selection.KFold(n_splits=n_folds, shuffle=True)
    kf_n = kf_n_c.split(A_list)
    gs = model_selection.GridSearchCV(
        clf, parmas, scoring='r2', cv=kf_n, n_jobs=n_jobs)

    AX_idx = np.array([list(range(ln))]).T
    gs.fit(AX_idx, yV)

    return gs
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号