摘要: 为了能够更快的查找数据,就需要创建对应的索引来帮助我们高效的完成查询。 索引名称不会显示,它只会为您加速搜索和查询。 标准语法: CREATE INDEX 索引名称 ON 表名(列名) 我们创建一个actor的表格 CREATE TABLE actor ( actor_id smallint(5) 阅读全文
posted @ 2022-04-09 13:32 庹庹呀 阅读(2134) 评论(0) 推荐(0)
摘要: 错误代码: model = ExtraTreesClassifier() model.fit(x,y) for i in range(x.shape[1]): print(data_raw.columns[i],format(model.feature_importances_[i],'.3f')) 阅读全文
posted @ 2020-10-29 20:09 庹庹呀 阅读(2069) 评论(0) 推荐(0)
摘要: 错误代码: from scipy import stats for i in range(x.shape[1]): pea = stats.pearsonr(x[:,i],y) #输出每个特征对因变量的影响 print(pea) pea errer: '(slice(None, None, None 阅读全文
posted @ 2020-10-29 20:07 庹庹呀 阅读(11941) 评论(0) 推荐(1)
摘要: 报错: ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all(). 意思是你的数组真实值不明确,出现问题代码: for i in range(0, 阅读全文
posted @ 2020-10-27 21:51 庹庹呀 阅读(8215) 评论(0) 推荐(0)
摘要: 错误代码: model.fit(x_train,y_train) 报错: Expected 2D array, got 1D array instead: 是因为在最新版本的sklearn中,所有的数据都应该是二维矩阵,哪怕它只是单独一行或一列。 解决:添加.reshape(-1,1)即可 mode 阅读全文
posted @ 2020-10-25 09:56 庹庹呀 阅读(9018) 评论(0) 推荐(0)
摘要: 线性回归中出现错误: TypeError Traceback (most recent call last) <ipython-input-23-444c0fe3ed1c> in <module> 11 if __name__ == "__main__": 12 draw(x_train,y_tra 阅读全文
posted @ 2020-10-14 09:52 庹庹呀 阅读(4352) 评论(0) 推荐(0)
摘要: 今天做等频离散化实验时出现错误吗,代码如下: col20 =df.loc[:,['col20']] #提取特征col20的数据 col20 col20_ = pd.qcut(col20,5) #对其进行等频离散化 col20_ 报错信息: Input array must be 1 dimensio 阅读全文
posted @ 2020-10-12 17:26 庹庹呀 阅读(8794) 评论(0) 推荐(0)
摘要: 源代码 from sklearn.preprocessing import Imputer data = Imputer(missing_values = 'NaN',strategy='most_frequent') 出现错误: cannot import name 'Imputer' from 阅读全文
posted @ 2020-09-22 11:47 庹庹呀 阅读(11556) 评论(0) 推荐(0)
摘要: 初次最小二乘法实现: import numpy as np import scipy as sp import pylab as pl from scipy.optimize import leastsq n = 9 def real_func(x): return np.sin(2*np.pi*x 阅读全文
posted @ 2020-09-05 16:20 庹庹呀 阅读(160) 评论(0) 推荐(0)
摘要: 报错代码: model = LinearRegression(copy_X=True, fit_intercept=True, n_jobs=1, normalize=False) model.fit(sInfonew['Weight'].values.reshape(-1,1),sInfonew[ 阅读全文
posted @ 2020-09-04 19:34 庹庹呀 阅读(1333) 评论(0) 推荐(0)