开发者社区> 问答> 正文

使用Alp-主动学习python框架

我正在从事一个使用主动学习的机器学习研究项目。我正在尝试使用alp,它提供了主流主动学习技术的实现。

但是,我对所提供的示例感到有些困惑。第一个示例是这样的:

from active_learning.active_learning import ActiveLearner
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from sklearn.datasets import make_classification

X, X_unlabeled, y, y_oracle = train_test_split(*make_classification())
clf = LogisticRegression().fit(X, y)

AL = ActiveLearner(strategy='entropy')
AL.rank(clf, X_unlabeled, num_queries=5)

而且我不确定X,X_unlabeled,y和y_oracle中应该包含哪些数据。应该:

X包含所有未标记的数据,或者包含已标记和未标记的数据。 “ y”是一个空列表或包含训练数据的标签。 y_oracle 只包含训练数据的标签

展开
收起
祖安文状元 2020-02-22 15:28:17 840 0
1 条回答
写回答
取消 提交回答
  • >>> help(make_classification)
    
    make_classification(n_samples=100, n_features=20, n_informative=2, n_redundant=2,
                        n_repeated=0, n_classes=2, n_clusters_per_class=2, weights=None, 
                        flip_y=0.01, class_sep=1.0, hypercube=True, shift=0.0, scale=1.0, 
                        shuffle=True, random_state=None)
    
        Generate a random n-class classification problem.
    
        This initially creates clusters of points normally distributed (std=1)
        about vertices of a `2 * class_sep`-sided hypercube, and assigns an equal
        number of clusters to each class. It introduces interdependence between
        these features and adds various types of further noise to the data.
    
    

    大胆强调我的。该函数基本上会生成虚拟数据供您使用。此外,按照help,返回值为:

    Returns
    -------
    X : array of shape [n_samples, n_features]
        The generated samples.
    
    y : array of shape [n_samples]
        The integer labels for class membership of each sample.
    
    

    样本和标签,然后传递给train_test_split它们,然后随机播放并返回训练和测试数据。

    2020-02-22 15:28:30
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
From Python Scikit-Learn to Sc 立即下载
Data Pre-Processing in Python: 立即下载
双剑合璧-Python和大数据计算平台的结合 立即下载