sklearn datasets 库使用说明

make_classification是sklearn库中的一个函数,用于生成具有指定属性的随机分类问题。它可以创建包含有用、冗余和无用特征的样本,支持设定类别数量、样本数量以及各种特征类型。该函数在机器学习算法的训练和测试中非常有用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

make_classification

这个函数生成一个随机的n类分类问题。

函数原型:

sklearn.datasets.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)[source]

参数介绍:

  • n_samples:int, default=100,指定样本的数量
  • n_features:int, default=20,指定特征的数量。These comprise n_informative informative features, n_redundant redundant features, n_repeated duplicated features and n_features-n_informative-n_redundant-n_repeated useless features drawn at random.
  • n_classes:int, default=2,指定分类问题中类别的数量

参考:
https://scikit-learn.org/stable/modules/generated/sklearn.datasets.make_classification.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值