【发布时间】:2020-02-25 19:34:02
【问题描述】:
我想为分类问题创建合成数据。我正在使用sklearn.datasets 的make_classification 方法。
我希望数据在特定范围内,比如说[80, 155],但它会生成负数。
我尝试了很多 scale 和 class_sep 参数的组合,但没有得到想要的输出。
import pandas as pd
from sklearn.datasets import make_classification
weight = [0.2, 0.37, 0.21, 0.04, 0.11, 0.05, 0.02]
X, y = make_classification(n_samples=100, n_features=3,
n_informative=3, n_redundant=0, n_repeated=0,
n_classes=7, n_clusters_per_class=1, weights=weight,
class_sep=1,shuffle=True, random_state=41, scale= 1)
pd.DataFrame(X).describe()
输出
输出应该在一个特定的范围内,但它会选择标准偏差约为 1.33 的随机值。
【问题讨论】:
标签: python machine-learning scikit-learn data-science