java fit 改451轮组_.fit_transform方法的输出

我想更深入地了解scikit中PolynomialFeatures类中的方法.fit_transform()输出的内容 .

我知道该方法正在做两件事:1)通过将数据拟合到回归算法来为数据生成模型,以及2)基于1中找到的模型创建新数据 .

但我不理解的是输出 . 这是我的代码:

import numpy as np

import pandas as pd

from sklearn.model_selection import train_test_split

np.random.seed(0)

n = 15

x = np.linspace(0,10,n) + np.random.randn(n)/5

y = np.sin(x)+x/6 + np.random.randn(n)/10

X_train, X_test, y_train, y_test = train_test_split(x, y, random_state=0)

X_train1 = X_train.reshape(11,1)

y_train1 = y_train.reshape(11,1)

def answer_one():

from sklearn.linear_model import LinearRegression

from sklearn.preprocessing import PolynomialFeatures

poly1 = PolynomialFeatures(degree=1)

X_poly1 = poly1.fit_transform(X_train1)

return X_poly1

answer_one()

我得到的输出是:

array([[ 1. , 10.08877265],

[ 1. , 3.23065446],

[ 1. , 1.62431903],

[ 1. , 9.31004929],

[ 1. , 7.17166586],

[ 1. , 4.96972856],

[ 1. , 8.14799756],

[ 1. , 2.59103578],

[ 1. , 0.35281047],

[ 1. , 3.375973 ],

[ 1. , 8.72363612]])

我假设每个迷你数组中的每个第二个数字是由模型计算的值,但我不明白每个1是什么?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值